OpenAPITools / OpenAPITools/openapi-generator
[BUG] Compilation error on models when supporting files (JSON.java,RFC3339DateFormat.java) are not generated
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
When generating just model objects using the java generator compilation fails if supporting files are not generated because of unused import org.openapitools.client.JSON.
openapi-generator version
6.0.1 (also occurs in 7.0.0-SNAPSHOT)
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Generate models with supporting files set to false.
See https://github.com/peter-janssen/openapi-bug (run .mvnw compile results in a compilation error)
Related issues/PRs
Somewhat related:
https://github.com/OpenAPITools/openapi-generator/issues/7177
Suggest a fix
It is unclear to me what exactly the purpose of org.openapitools.client.JSON but a naive suggestion would be not to add the import when it is not used or make it toggleable .
Workaround
To prevent all supported files to be generated it can be limited using:
<supportingFilesToGenerate>JSON.java,RFC3339DateFormat.java</supportingFilesToGenerate>
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 linked openapi.yaml and pom.xml generation configuration, then reproduce the failure by running .mvnw compile with supporting files disabled. Inspect the generated model imports and the generator's handling of JSON.java and RFC3339DateFormat.java. Done means model-only generation compiles without requiring omitted supporting files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100