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

Fixe python model template to work with inheritance #425

Merged

Conversation

giavjeko
Copy link
Contributor

There are several issues with the python model template that causes incorrect behavior with inherited models.

  1. Subclass constructor never calls the super constructor or even takes the super constructor arguments.
  2. Subclass swagger_types and attribute_map don't include parent's properties. Because of that, all parent class properties will be removed in ApiClient.__deserialize_model.
  3. OpenAPI specification v3 supports discriminator mapping by custom names (docs). That allows us to have custom strings in discriminator fields which then need to be mapped to class names. Currently, the model template does not render those mappings correctly.

This change fixes all the issues above.

@HugoMario
Copy link
Contributor

great! thanks a lot @giavjeko !!

@HugoMario HugoMario merged commit a4cc729 into swagger-api:master Jul 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants