Last active
May 3, 2022 09:06
-
-
Save rubenquadros/0a506a5324f893153d111c88a6871924 to your computer and use it in GitHub Desktop.
An extension function on KtClass to see if any param is missing SerializedName annotation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// returns the param if SerializedName annotation is missing | |
fun KtClass.getMissingAnnotationParam(): KtParameter? { | |
this.getPrimaryConstructorParameterList()?.parameters?.forEach { param -> | |
if (!param.annotationEntries.any { | |
it.shortName?.asString() == "SerializedName" | |
} | |
) { | |
return param | |
} | |
} | |
return null | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment