swagger-api / swagger-api/swagger-codegen
Duplicate entries when using inheritance or composition
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
A PR(#3935) has been opened by @j4velin regarding this problem, but I cannot find any related issue.
Using the simple definition below, we get duplicate vars for seaplane:

Also, I am unsure if the PR fully fixes the issue. Since the second call to addVars(...) will add new properties to m.allVars instead of m.vars, these properties will not be taken into account by postProcessModelProperty as it is run only on m.vars.
Swagger-codegen version
Master branch
Swagger declaration file content or url
definitions:
plane:
type: object
properties:
name:
type: string
length:
type: string
seaplane:
type: object
allOf:
- $ref: '#/definitions/plane'
- type: object
properties:
other:
type: string
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 at addVars(...) and follow how inheritance or composition populates m.vars and m.allVars. Check postProcessModelProperty and reproduce the seaplane definition from the issue; done means generated properties are not duplicated and all properties receive the expected post-processing.
Written by the indexing model from the issue text.
Assessment
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100