Support discriminator for polymorphic types and support oneOf #830
bowenwr
started this conversation in
Feature request
Replies: 2 comments 1 reply
-
I tested this with the latest code on main (roughly 0.7.0-rc.1) and it does attempt to generate proper responses now using the same code it would for unions inside a model (basically a series of try/except). So it's better than nothing, though for sure we still should add discriminators in a future version. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Any updates on this? Is it possible to add support for discriminators with mapping like this? "discriminator": {
"propertyName": "type",
"mapping": {
"Product": "#/components/schemas/ProductOrderItem",
"Compound": "#/components/schemas/CompoundOrderItem"
}
} Could you please advice any workaround to generate referenced models? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is your feature request related to a problem? Please describe.
When an endpoint returns
oneOf
several different classes, currently it returns an empty object. Sample component snippet:Describe the solution you'd like
Support discriminators to be able to deserialize polymorphic types.
Beta Was this translation helpful? Give feedback.
All reactions