You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I guess on second thought here, it's unclear how we'd actually represent a model which is nothing other than a union of other models. Maybe the desired outcome of this ticket is simply to raise an error during code generation?
For oneOf we should probably make a type alias to Union[ThingOne, ThingTwo]. anyOf is a lot harder... my read of it is that it has to validate against at least one schema but can contain properties of other schemas. So we might have to generate several models, each of which has the requirements of one schema and optional fields from all of the others. Sounds messy.
I'd love to know how folks are actually using anyOf to get a better feel for how the implementation should shake out.
Openapi schemas can combine oneOf anyOf allOf and properties all in a single schema.
So I don't think that For oneOf we should probably make a type alias to Union[ThingOne, ThingTwo] would work for all cases.
Activity
forest-benchling commentedon Apr 14, 2021
cc @packyg @bowenwr @dtkav @adamrp
forest-benchling commentedon Apr 19, 2021
I guess on second thought here, it's unclear how we'd actually represent a model which is nothing other than a union of other models. Maybe the desired outcome of this ticket is simply to raise an error during code generation?
dbanty commentedon Dec 18, 2021
For
oneOfwe should probably make a type alias toUnion[ThingOne, ThingTwo].anyOfis a lot harder... my read of it is that it has to validate against at least one schema but can contain properties of other schemas. So we might have to generate several models, each of which has the requirements of one schema and optional fields from all of the others. Sounds messy.I'd love to know how folks are actually using
anyOfto get a better feel for how the implementation should shake out.[-]Models generated with `oneOf` or `anyOf` have empty properties[/-][+]Support top level `oneOf` and `anyOf`[/+]spacether commentedon Dec 28, 2021
Openapi schemas can combine oneOf anyOf allOf and properties all in a single schema.
So I don't think that
For oneOf we should probably make a type alias to Union[ThingOne, ThingTwo]would work for all cases.dvaerum commentedon Jun 6, 2022
What is the status for this issue? Because I am in a situation there I need it and would love to not create workarounds for it 😉