OpenAPITools / OpenAPITools/openapi-generator
[BUG] Generator is merging nested models
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
When multiple nested models have identical contents, the generator automatically merges them and generates only one model. This is not expected because these models are unrelated. Need an option to disable merging.
openapi-generator version
4.0.0-beta2
OpenAPI declaration file content or url
definitions:
outer1:
type: object
properties:
inner1:
type: object
properties:
foo:
type: string
outer2:
type: object
properties:
inner2:
type: object
properties:
foo:
type: string
Command line used for generation
java -jar openapi-generator-cli-4.0.0-beta2.jar generate -i api.yaml -g jaxrs-spec
Steps to reproduce
Generate code. Inner1 is generated as Outer1Inner1, but inner2 is not being generated. Outer2 now has a field Outer1Inner1 inner2, which is not expected.
This issue not language-specific.
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 by reproducing the issue with the supplied api.yaml definitions and the openapi-generator-cli command using the jaxrs-spec generator. Trace where identical nested models are merged and identify the existing option-handling path; done means an option can disable merging so both unrelated nested models are generated separately.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100