swagger-api / swagger-api/swagger-codegen
[JAVA] Failed inheritance when generating objects with subtypes
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I am attempting to generate polymorphic Java model objects using a swagger 1.2 JSON file.
I've created a simple project using Gradle and a swagger example from
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/1.2.md#5272-inheritance-example
When the models are generated there is no inheritance. Is there something that I am missing?
Project example uploaded here, https://github.com/jsmithe/swagger-codgen-subtype-test
Swagger-codegen version
2.2.3
Swagger declaration file content or url
https://github.com/jsmithe/swagger-codgen-subtype-test/blob/master/src/main/resources/test.json
Command line used for generation
gradle generateApi
Using Gradle build file similar to that linked in root's readme.
https://github.com/jsmithe/swagger-codgen-subtype-test/blob/master/build.gradle
Steps to reproduce
Generate model with provided test.json
Related issues/PRs
Several old issues that indicate this should be working. Started with #116
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 test.json and build.gradle, then run gradle generateApi to reproduce the generated Java models. Compare the subtype models with the inheritance example in the Swagger 1.2 specification and determine where inheritance is lost. Done means the generated models preserve the declared parent/subtype relationships.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100