Repository navigation
[JAVA] add JSpecify @Nullable in builder and singleRequestParameter #24648
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
Merged
wing328
merged 45 commits into
OpenAPITools:master
from
jpfinne:feature/jspecify_java_builder
Aug 12, 2026
Merged
Changes from 26 commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
59c67f2
Merge pull request #4 from OpenAPITools/master
jpfinne 784da69
Merge branch 'OpenAPITools:master' into master
jpfinne 9ee6075
Merge branch 'OpenAPITools:master' into master
jpfinne 91ce7ba
Merge branch 'OpenAPITools:master' into master
jpfinne 0808d0e
Merge branch 'OpenAPITools:master' into master
jpfinne 46d9c9c
Merge branch 'OpenAPITools:master' into master
jpfinne 7b6cf90
Merge branch 'OpenAPITools:master' into master
jpfinne b50a337
Merge branch 'OpenAPITools:master' into master
jpfinne ae1bff7
Merge branch 'OpenAPITools:master' into master
jpfinne 5229d8d
Merge branch 'OpenAPITools:master' into master
jpfinne cdc74eb
Merge branch 'OpenAPITools:master' into master
jpfinne df30bd2
Merge branch 'OpenAPITools:master' into master
jpfinne 246b21d
Merge branch 'OpenAPITools:master' into master
jpfinne 8e39563
Merge branch 'OpenAPITools:master' into master
jpfinne deec130
Merge branch 'OpenAPITools:master' into master
jpfinne e1cf666
add jspecify @Nullable annotation to builder and toIndentedString for…
jpfinne 236338d
include more use cases in jspecify.yaml
jpfinne 356595c
include more use cases in jspecify.yaml
jpfinne f49accb
Regenerate test samples
jpfinne 30a40a5
Merge remote-tracking branch 'refs/remotes/upstream/master' into feat…
jpfinne 2740a6e
Regenerate test samples
jpfinne d64ea09
Merge remote-tracking branch 'upstream/master' into feature/jspecify_…
jpfinne bb0e7d8
Fix extra space in webclient single_request_parameter for toIndentedS…
jpfinne d381a73
Invalid sha for JSONTest.java !!!
jpfinne 1ad3f1e
Support space at the end of the @Nullable annotation to avoid handlin…
jpfinne 2ea64df
generate all arg constructor on restTemplate and webclient
jpfinne a46a2b3
Remove @Nullable on private toIndentedString
jpfinne 7bd1863
Fix unit test
jpfinne 64ce445
Fix unit test
jpfinne ecf0f73
Add regenerated samples with tags
jpfinne 4cbbfad
Add regenerated samples with tags
jpfinne 9f6d68d
Force rebuild
jpfinne e031b85
Force rebuild
jpfinne b75d455
Handling of resttemplate api Nullable arguments
jpfinne 5ce5282
Merge remote-tracking branch 'upstream/master' into feature/jspecify_…
jpfinne ce877e4
Handling of resttemplate api Nullable arguments
jpfinne f0501ee
Rollback resttemplate api: not for this PR
jpfinne 4d3cbf7
Add @Nullable on single_request_parameter
jpfinne 282a4f7
Add @Nullable on useAbstractionForFiles
jpfinne a3e671f
Fix unittest
jpfinne 7aba350
Merge remote-tracking branch 'upstream/master' into feature/jspecify_…
jpfinne 3656352
Merge master and fix use useAbstractionForFiles=true for restclient a…
jpfinne bfabfc7
fix restclient api_test
jpfinne df96fba
Add sample for array of file
jpfinne 8df500c
Fix unit tests
jpfinne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
19 changes: 19 additions & 0 deletions
19
bin/configs/java-restclient-springBoot4-jackson3-jspecify-openapiNullable.yaml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| generatorName: java | ||
| outputDir: samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable | ||
| library: restclient | ||
| inputSpec: modules/openapi-generator/src/test/resources/3_0/java/jspecify.yaml | ||
| templateDir: modules/openapi-generator/src/main/resources/Java | ||
| validateSpec: false | ||
| additionalProperties: | ||
| artifactId: petstore-restclient | ||
| hideGenerationTimestamp: "true" | ||
| containerDefaultToNull: "true" | ||
| useSpringBoot4: true | ||
| useJackson3: true | ||
| openApiNullable: true | ||
| useJspecify: true | ||
| generateBuilders: true | ||
| generateConstructorWithAllArgs: true | ||
| typeMappings: | ||
| OffsetDateTime: java.time.Instant | ||
| BigDecimal: java.math.BigDecimal |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,4 +9,3 @@ additionalProperties: | |
| containerDefaultToNull: "true" | ||
| useJakartaEe: true | ||
| useSpringBoot4: true | ||
|
|
||
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
1 change: 1 addition & 0 deletions
1
modules/openapi-generator/src/main/resources/Java/nullableArgument_builder.mustache
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {{#useJspecify}}{{#lambda.jSpecifyNullable}}{{^required}}@{{javaxPackage}}.annotation.Nullable {{/required}}{{/lambda.jSpecifyNullable}}{{#lambda.jSpecifyDatatype}}{{#removeAnnotations}}{{{datatypeWithEnum}}}{{/removeAnnotations}}{{/lambda.jSpecifyDatatype}}{{/useJspecify}}{{^useJspecify}}{{#removeAnnotations}}{{{datatypeWithEnum}}}{{/removeAnnotations}}{{/useJspecify}} |
2 changes: 1 addition & 1 deletion
2
modules/openapi-generator/src/main/resources/Java/nullable_var_annotations.mustache
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| {{#lambda.jSpecifyNullable}}{{#required}}{{#isNullable}}@{{javaxPackage}}.annotation.Nullable{{/isNullable}}{{^useJspecify}}{{^isNullable}}@{{javaxPackage}}.annotation.Nonnull{{/isNullable}}{{/useJspecify}}{{/required}}{{^required}}@{{javaxPackage}}.annotation.Nullable{{/required}}{{/lambda.jSpecifyNullable}} | ||
| {{^useJspecify}}{{#required}}{{#isNullable}}@{{javaxPackage}}.annotation.Nullable{{/isNullable}}{{^isNullable}}@{{javaxPackage}}.annotation.Nonnull{{/isNullable}}{{/required}}{{^required}}@{{javaxPackage}}.annotation.Nullable{{/required}}{{/useJspecify}}{{#useJspecify}}{{#lambda.jSpecifyNullable}}{{^required}}@{{javaxPackage}}.annotation.Nullable {{/required}}{{/lambda.jSpecifyNullable}}{{/useJspecify}} | ||
|
jpfinne marked this conversation as resolved.
Resolved
|
||
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
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
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
30 changes: 30 additions & 0 deletions
30
...java/restclient-springBoot4-jackson3-jspecify-openapiNullable/.github/workflows/maven.yml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time | ||
| # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | ||
| # | ||
| # This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) | ||
|
|
||
| name: Java CI with Maven | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main, master ] | ||
| pull_request: | ||
| branches: [ main, master ] | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build jspecify | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| java: [ 17, 21 ] | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Set up JDK | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: ${{ matrix.java }} | ||
| distribution: 'temurin' | ||
| cache: maven | ||
| - name: Build with Maven | ||
| run: mvn -B package --no-transfer-progress --file pom.xml |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.