OpenAPITools / OpenAPITools/openapi-generator
[BUG] Generation creates redundant allOf objects
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
See existing tests:
https://github.com/OpenAPITools/openapi-generator/pull/14459/files#r1073301024
Generated source code generates redundant AllOf files despite models already having those properties inlined.
Generate file with suffix AllOf is not used.
openapi-generator version
master
OpenAPI declaration file content or url
See example in PR
Generation Details
See example in PR
Steps to reproduce
Run tests
Related issues/PRs
#14121 #2178 #14459 #2360 #14278
Suggest a fix
Short term:
Remove file
Long term:
I think inlining models introduces a lot of bugs in the generator and are inconsistently handled across different generators.
Proper approach would be to navigate architecture of the generator to use rely on normalization rules (and enable others to write ones themselves) but then keeping generation logic free of complex (and bug free transformations) like inlining models - that puts extra efforts on communicating changes across different generators etc.
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 existing tests and examples referenced in PR #14459, then run the generation tests described in the issue. Confirm that redundant AllOf files are produced while their properties are already inlined and that the generated files are unused; the issue also points to related issues #14121, #2178, #2360, and #14278 for context.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100