Open wessmq opened 3 years ago
requests fail on nullable and non-required properties if returned as null from server
The spec above did not describe that any of the properties can be nullable.
This is expected behavior. Set nullable to true for any parameters where null can be received by the client and this will work.
I have a similar structure to the example one above, and when I try to construct a ChildObject1(object_type="ChildObject1"), for example, my code throws a RecursionError in model_utils's get_discriminated_classes method. It looks like because the discriminator() property for all the child objects is set to a list of all of the sibling class plus the child class its, the method tries to recurse forever trying to find grandchildren of the parent object that don't exist.
@bherw that sounds like a separate issue. Can you file a separate ticket with it with a minimal sample that reproduces your issue? Sounds like you have a cyclic schema definition and our code isn't terminating after it loops back on itself.
Thanks, @spacether, I reported #8579
Bug Report Checklist
Description
I am trying to generate python client code from yaml that uses allOf with a discriminator property, generated code in 4.3.1 is not describing inheritance between generated models, schemas that are composed from parent model (using allOf) do not have the attributes of the parent as it is represented in JAVA with class extension.
Tried generating using v5 that came out recently and the request validation is failing around get_discriminated_attributes in model_utils
openapi-generator version
4.3.1 / 5.0.0
OpenAPI declaration file content or url
in 4.3.1, generated models are: ParentObject with objectType property ChildObject1 with extraProp1 and no mention of ParentObject properties/any relation to it (unlike Java where there is a clear inheritance) same with ChildObject2
in 5.0, generated code looks more attentive to the allOf attributes, but when running requests with created object of type ChildObject1 for example, request validation fails on initial steps, and GET requests fail on nullable and non-required properties if returned as null from server
Steps to reproduce
Related issues/PRs
Suggest a fix