OpenAPITools / OpenAPITools/openapi-generator
[BUG] Model classes generation with oneOf and allOf
Open
Nobody has claimed this yet.
Issue: Bug
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
Generated model classes does not have references when using oneOf and allOf
Contact1 and Contact2 are generated but , Pet class does not have reference for Contact1 and Contact2
openapi-generator version
openapi-generator-maven-plugin 3.3.4
OpenAPI declaration file content or url
Pet:
type: object
allOf:
- oneOf:
- type: object
properties:
contact1:
$ref: '#/components/schemas/contact1'
- type: object
properties:
contact1:
$ref: '#/components/schemas/contact2'
- allOf:
- type: object
properties:
id:
type: integer
format: int64
name:
type: string
tag:
type: string
contact1:
type: object
properties:
location:
type: string
city:
type: string
contact2:
type: object
properties:
email:
type: string
mobile:
type: string
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix
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 petstore.yaml.txt and reproduce the issue using openapi-generator-maven-plugin 3.3.4, focusing on the generated Pet, Contact1, and Contact2 model classes. Trace how the generator handles the nested oneOf and allOf schemas; done means Pet retains references to Contact1 and Contact2 in the generated models.
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
- 35/100