Generate required fields constructor when JSpecify is enabled#910
Merged
sjohnr merged 2 commits intoNetflix:masterfrom Feb 3, 2026
Merged
Generate required fields constructor when JSpecify is enabled#910sjohnr merged 2 commits intoNetflix:masterfrom
sjohnr merged 2 commits intoNetflix:masterfrom
Conversation
sjohnr
requested changes
Jan 6, 2026
...en-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/generators/java/DataTypeGenerator.kt
Outdated
Show resolved
Hide resolved
* Add tests for JSpecify constructor generation based on field nullability * Generated required fields constructor when JSpecify enabled * Fix ktlint formatting in DataTypeGenerator * fixed ktlint formatting in CodeGenTest * gate required-fields constructor behind javaGenerateAllConstructor + avoid duplicates * added tests for required-fields constructor behavior
sjohnr
added a commit
to sar9ho/dgs-codegen
that referenced
this pull request
Feb 3, 2026
* expand conditional for generating required-args constructor to check requiredFields.size < 256 even if fields is not
d1433e2 to
b62e95d
Compare
sjohnr
approved these changes
Feb 3, 2026
* expand conditional for generating required-args constructor to check requiredFields.size < 256 even if fields is not
b62e95d to
310dd4b
Compare
Contributor
|
Thanks @sar9ho! Sorry for the delay. I have merged this to |
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.
Adds a “required fields” constructor for Java types when generateJSpecifyAnnotations = true.
Behavior:
For testing, I added some targeted cases in CodeGenTest ^
Fixes #900
Fixes #901