-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
[Python] Inheritance doesn't work #623
Comments
@emreakca @poli-granot this could be fixed by applying the changes in swagger-api/swagger-codegen@843c638 to https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/python/model.mustache#L13 and other relevant files. would you like to file a PR for this? |
I am working on a PR which will fix this issue. The problem is that the mustache files iterate through #vars per here: https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/python/model.mustache#L36. #vars does not include the variables inherited from the allOf class. However, the requiredVars and optionalVars DO include those needed properties. My fix will iterate over the requiredVars and optionalVars. |
composed schema inheritance is working in the python-experimental generator |
chore(deps): update dependency @types/node to v14.18.13
Description
The generated Python SubClass doesn't inherited from the BaseClass, when allOf is used.
The generated class shows
instead of
This issue was already posted (#453), but it's not solved nor answered.
openapi-generator version
3.1.1
Command line used for generation
Suggestion
Either do the inheritance correctly (as shown at the beginning), with the right constructors (
__init__
)or add the Properties of the BaseClass to the SubClass, as in swagger 2.
The text was updated successfully, but these errors were encountered: