Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix validation of kotlin collection type for enums and lists of complex types. #32

Merged
merged 1 commit into from
Apr 6, 2022

Conversation

srinivasankavitha
Copy link
Contributor

Collection types in kotlin need ::class for enums and lists of complex types.
Fixes the following issues:
#29
Netflix/dgs-framework#936

@@ -103,7 +103,7 @@ object InputArgumentUtils {
if (isListType(input.type!!) || isEnumType(input.type!!, typeRegistry)) {
val collectionType = getCollectionType(input.type!!, false)
if (! isSimpleType(collectionType)) {
inputArgumentHint.append("(collectionType=$collectionType) ")
inputArgumentHint.append("(collectionType=$collectionType::class) ")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do tis?

@@ -124,7 +124,7 @@ class DgsInputArgumentValidationInspector : AbstractBaseUastLocalInspectionTool(
val expectedInputArgumentHint = InputArgumentUtils.getHintForInputArgument(graphQLInput, typeDefinitionRegistry, isJavaFile)
if (expectedInputArgumentHint.contains("collectionType")) {
val expectedCollectionType = InputArgumentUtils.getCollectionType(graphQLInput.type!!, isJavaFile)
val inputCollectionType = inputArgumentAnnotation.findAttributeValue("collectionType")?.text?.removeSuffixIfPresent(".class")
val inputCollectionType = inputArgumentAnnotation.findAttributeValue("collectionType")?.text?.removeSuffixIfPresent(".class")?.removeSuffixIfPresent("::class")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

::class shouldn't be there in the first place, so this should probably be fixed elsewhere.

@srinivasankavitha srinivasankavitha merged commit ef43fb8 into main Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants