Handle NullValue in input field default value code generation#920
Open
lcamilo15 wants to merge 1 commit intoNetflix:masterfrom
Open
Handle NullValue in input field default value code generation#920lcamilo15 wants to merge 1 commit intoNetflix:masterfrom
lcamilo15 wants to merge 1 commit intoNetflix:masterfrom
Conversation
When a GraphQL input field has `= null` as its default value, the
code generator called toString() on the NullValue AST node, producing
the literal string `NullValue{}` instead of valid Java/Kotlin `null`.
This is the same root cause as the EnumValue bug fixed in PR Netflix#33.
Fixes Netflix#770
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
NullValue{}being generated instead ofnullwhen a GraphQL input field has= nullas its default valueNullValuein both Java and Kotlin code generators, alongside the existingEnumValue,BooleanValue,IntValue, etc. casesEnumValuebug fixed in PR Fix input type code generation for enum fields with default values #33 — theelsebranch called.toString()on the AST nodeTest plan
generateInputWithDefaultNullValuetest for Java codegen (CodeGenTest.kt)generateInputWithDefaultNullValuetest for Kotlin codegen (KotlinCodeGenTest.kt)assertCompilesJava/assertCompilesKotlin)Fixes #770