Skip to content

[JavaSpring] removes hardcoded Nullable import and import ist only if required#21829

Merged
wing328 merged 1 commit intoOpenAPITools:masterfrom
parenko:i-19955
Aug 28, 2025
Merged

[JavaSpring] removes hardcoded Nullable import and import ist only if required#21829
wing328 merged 1 commit intoOpenAPITools:masterfrom
parenko:i-19955

Conversation

@parenko
Copy link
Contributor

@parenko parenko commented Aug 28, 2025

This PR removes hard coded Nullable import in Mustache templates and would fix #21498.
CC @ondrej-simon

Also this PR allows to override Nullable import eg with: <importMapping>Nullable=org.jspecify.annotations.Nullable</importMapping>
which would fix #19955 and in feature Releases easily replaced with org.jspecify.annotations.Nullable.
CC @slobodator

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • File the PR against the correct branch: master (upcoming 7.x.0 minor release - breaking changes with fallbacks), 8.0.x (breaking changes without fallbacks)
  • If your PR solves a reported issue, reference it using GitHub's linking syntax (e.g., having "fixes #123" present in the PR description)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Java Spring technical committee:
@cachescrubber (2022/02) @welshm (2022/02) @MelleD (2022/02) @atextor (2022/02) @manedev79 (2022/02) @javisst (2022/02) @borsch (2022/02) @banlevente (2022/02) @Zomzog (2022/09) @martin-mfg (2023/08)

@wing328

Also allows to override it eg with: <importMapping>Nullable=org.jspecify.annotations.Nullable</importMapping>
@slobodator
Copy link
Contributor

@parenko Nice fix, thanks!

Hope, the only one org.jspecify.annotations.Nullable will be left and that will happen on my life :-)

@wing328 wing328 added this to the 7.16.0 milestone Aug 28, 2025
@wing328 wing328 merged commit daa8eb4 into OpenAPITools:master Aug 28, 2025
63 checks passed
@wing328
Copy link
Member

wing328 commented Aug 28, 2025

@parenko thanks for the pr, which has been merged

can you please PM me via Slack when you've time?

https://join.slack.com/t/openapi-generator/shared_invite/zt-36ucx4ybl-jYrN6euoYn6zxXNZdldoZA

Goopher pushed a commit to Goopher/openapi-generator that referenced this pull request Sep 9, 2025
Also allows to override it eg with: <importMapping>Nullable=org.jspecify.annotations.Nullable</importMapping>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG][Java][Spring] 7.14.0 hardcodes nullable import from Spring [REQ] Add Support for JSpecify Annotations

3 participants