-
-
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
[BUG][Python] Multi-level inheritance not working correctly #1662
Comments
The (post) 4.0.0-beta version of the tool gives us the following error:
|
This may be related to #583? |
@ericraymond : @wing328 is working on a fix in #1842 |
See also #1663 (comment) for a related issue where we can't use the |
I think the python code for discriminator in
I've worked on related stuff in #2121 , but it was for composed schemas without discriminator. I encountered this issue and I've pushed #2170, which seem to work even for oneOf/anyOf inheritance. Can you check that one out if it fixes your issue ? |
Hi @rienafairefr, Sorry for the late reply. I am testing out your PRs. It looks like there is something odd going on with I already made some comments on #2121 and #2170. With best regards, |
We are also facing issues with our Python model generation when there is an 'allOf' reference in the swagger JSON file. The issues are similar to what is described above (empty models in our case). The openapi generator used is v4.1.2. We are wondering what the status is to fix this for the Python client generation? We actually need this functionality pretty bad. |
This looks like this is working with the composition features that have existed since 2019. |
Description
The generated Python client does not properly return the final classes when multi-level inheritance is used.
For example:
GET /pet
returns any ofAngryDog
,NiceDog
, andFunnyCat
object, the Python client will return aPet
object (without all final_type-specific attributes missing).GET /dog
returns any ofAngryDog
orNiceDog
object, the Python client will return aPet
object (without all final_type-specific attributes missing).Please note that you can also see that the member fields of the
Pet
andDog
parent object are missing in theAngryDog
(cfr. #453).openapi-generator version
I used OpenAPI generator CLI version
4.0.0-SNAPSHOT
:https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.0.0-SNAPSHOT/openapi-generator-cli-4.0.0-20181210.103357-85.jar
OpenAPI declaration file content or url
See
multi-level-inheritance.yaml
in the attached zip-file:multi-level-inheritance.zip
Command line used for generation
Steps to reproduce
Generate client code
See also
multi-level-inheritance.sh
.Start (mocked) server
Run the client test
Output:
Related issues/PRs
Similar issues has been seen with CSHARP and Java:
Suggest a fix
When we add an addition
discriminator
in theDog
schema thenGET /dog
does properly return either anAngryDog
orNiceDog
object.The text was updated successfully, but these errors were encountered: