OpenAPITools / OpenAPITools/openapi-generator
[BUG][JAVA] MergedSpec is not created correctly on Windows with inputSpecRootDirectory and nested directories
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?
- 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 using the generator under windows with inputSpecRootDirectory and specs separated in folders the generated merged spec contains invalid refs. For example:
... $ref: "./details\\details-transactions-api.yaml...
instead of
... $ref: "./details/details-transactions-api.yaml...
The result is that the nested specs are not used for generation and the expected artifacts are missing (tested in spring and typescript-axios generator). Side effect are warnings like the following:
Model details\details-transactions-api not generated since it's a free-form object
openapi-generator version
tested on 7.17.0 an 7.20.0
Suggest a fix
MergedSpecBuilder uses File.separator for generating the refs. It would be probably sufficient zu use OS-independently/as separator instead.
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 modules/openapi-generator/src/main/java/org/openapitools/codegen/config/MergedSpecBuilder.java around line 67 and reproduce the issue on Windows with inputSpecRootDirectory and nested spec folders. Check the generated merged spec refs and verify that nested specs are used during generation without missing artifacts or free-form object warnings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100