OpenAPITools / OpenAPITools/openapi-generator
[Java] Add `SuppressWarnings("all")` to all generated Java source files
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Is your feature request related to a problem? Please describe.
I'm seeing tons of warnings in the Eclipse IDE for the generated files. Part of these can be resolved by having generators include a SuppressWarnings("all") annotation, but IMHO, all generated sources should always carry this by default.
Describe the solution you'd like
When generating a source file, include this annotation on the class, for all files generated, always and by default.
Describe alternatives you've considered
Configuring the generator, for example for Spring:
<configuration>
<inputSpec>m2m-connector-contract/openapi.yaml</inputSpec>
<generatorName>spring</generatorName>
<configOptions>
<additionalModelTypeAnnotations>
@SuppressWarnings("all")
</additionalModelTypeAnnotations>
<additionalOneOfTypeAnnotations>
@SuppressWarnings("all")
</additionalOneOfTypeAnnotations>
<additionalEnumTypeAnnotations>
@SuppressWarnings("all")
</additionalEnumTypeAnnotations>
</configOptions>
</configuration>
Unfortunately, this doesn't cover the *Api interfaces it generates, nor the ApiUtil class (but that one is warning free).
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 with the Spring generator configuration and the generated *Api interfaces, comparing them with the model, enum, and oneOf annotation options described in the issue. Check how generated Java classes and the ApiUtil class are emitted. Done means every generated Java source file, including *Api interfaces, carries SuppressWarnings("all") by default without requiring additional configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi, spring
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100