OpenAPITools / OpenAPITools/openapi-generator
[BUG] openapi-generator-maven-plugin v7.13.0 duplicates schemas/models when openapi v3.1.x is used
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
I'm using the plugin springdoc-openapi-maven-plugin v1.5 to generate the openapi.json file, and the plugin openapi-generator-maven-plugin v7.13.0 to generate the index.adoc file based on the openapi.json generated previously. The openapi.json file is generated with openapi version 3.1.0 but when openapi-generator-maven-plugin is executed, it generates as many schemas/models as they are referenced. e.g:
class Door{}
class Car{ private Door door; }
class House{ private Door door; }
openapi.json contains just one Door schema/model and Car.door and House.door has the ref: #/components/schemas/door which is correct – but when openapi-generator-maven-plugin is executed, the resulting index.adoc file has:
Model Car:
| name | type |
|---|---|
| door | Door_1 |
Model House:
| name | type |
|---|---|
| door | Door_2 |
Model Door1
| name | type |
|---|
Model Door2
| name | type |
|---|
if I change manually the version of openapi from 3.1.0 to 3.0.0 into openapi.json, it will work as expected, generating just one schema for 'Door' and setting just one type, not two.
This behaviour means that openapi-generator-maven-plugin is struggling to manage openapi 3.1.x properly.
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 openapi-generator-maven-plugin input path for the reported openapi.json, comparing OpenAPI 3.1.0 with the same document changed to 3.0.0. Reproduce the generated index.adoc output using the Door, Car, and House schemas; done means shared Door references produce one Door model and both properties use it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, documentation
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100