swagger-api / swagger-api/swagger-codegen
How should swagger-codegen deal with multiple inline objects within allOf: ?
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
Currently, swagger-codegen only recognizes that last inline object defined in an allOf: array. The OpenAPI Specification is silent on this issue and leaves it to the tools to decide.
https://github.com/OAI/OpenAPI-Specification/issues/848
I am writing this issue so that this issue can be defined in swagger-codegen.
Swagger-codegen version
2.2.2-SNAPSHOT
Swagger declaration file content or url
See issue # 4226 for example.
Suggest a Fix
Specify a constraint that only one inline object can be created within a model definition.
OR
Handle it properly. If this option is chosen, how are discriminators dealt with in the inline objects? What other issues will come up when this is addressed?
IIUC, 2.2.3 addresses inheritance, interfaces and composition in a more complete way, right? So maybe for 2.2.2, the constraint is the best option.
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
Review issue #4226 for the referenced example, then read the OpenAPI Specification discussion in issue #848 and the swagger-codegen 2.2.2 composition behavior. The work would need a decided policy for multiple inline objects in allOf, including how discriminators are handled, or an explicit constraint limiting them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi
- Domain
- api, devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100