Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate entries when using inheritance or composition #4258

Open
yannickadam opened this issue Nov 25, 2016 · 3 comments
Open

Duplicate entries when using inheritance or composition #4258

yannickadam opened this issue Nov 25, 2016 · 3 comments

Comments

@yannickadam
Copy link

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:

image

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
@yannickadam
Copy link
Author

@wing328 Any chance to have your feedback on this?

@wing328
Copy link
Contributor

wing328 commented Dec 9, 2016

@yannickadam I'll take a look over the weekend using the spec you provided and reply back.

@axelbodo
Copy link

In DefaultCodegen for CompositeModel.fromModel the some properties are added twice, when calling addVars, when supportsInheritance is true: from properties and from allProperties. This is the root cause of the issue which may affect readOnlyVars, readWriteVars, requiredVars and optionalVars, and is language independent.

@axelbodo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants