OpenAPITools / OpenAPITools/openapi-generator
[BUG][JAVA][QUARKUS] 7.11.0 version introduces springframework Nullable annotation in Quarkus project.
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
With the new version 7.11.0 of the openapi-generator, a @Nullable annotation was introduced in the SpringCodegen.java from org.springframework.lang
Since we are using the JavaCamelServerCodegen.java in our Quarkus project, which extends the SpringCodegen.java, these annotations are introduced in our generated pojo's, causing a compilation failure.
openapi-generator version
7.11.0
Generation Details
Example of generation. The @Nullable is only added to non-required attributes.
@Generated(value = "org.openapitools.codegen.languages.JavaCamelServerCodegen", date = "2025-02-03T10:45:30.354153+01:00[Europe/Madrid]", comments = "Generator version: 7.11.0")
public class Pojo {
private String name;
private String code;
private @Nullable String attr1;
private @Nullable String attr2;
Related issues/PRs
This is related with the PR merged recently:
https://github.com/OpenAPITools/openapi-generator/pull/20345/commits/1742b932d38d7d9d84ef1c6dc63cf3a104fc2982#diff-9de34b4aad5de707e8aa0c031f20a6573f8f50826a437f0652c54b3788b37d41
Coming from issue: https://github.com/OpenAPITools/openapi-generator/issues/17382
Suggest a fix
We propose to switch to a more neutral annotation like jakarta.annotation.Nullable which is compatible across frameworks.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in SpringCodegen.java and trace how JavaCamelServerCodegen.java inherits nullable annotations into generated POJOs. Compare the 7.11.0 change referenced in PR 20345 with the Quarkus generation example; done means non-required fields no longer introduce an incompatible Spring annotation while generated Java remains valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100