-
Notifications
You must be signed in to change notification settings - Fork 73
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
Improve declaration of untagged unions to allow for generator optimizations #2548
Conversation
2464721
to
971d470
Compare
971d470
to
e11bcdc
Compare
45845e3
to
636ff57
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a brief description of this new variant type in the docs?
And mentioning explicitly that this is used for legacy types and should generally avoided as it results in less optimal code generation in client libraries.
Done. |
@swallez added a commit to fix openapi generation (also enhanced error logging for the deserialization of the schema.json, thanks @Anaethelion) |
3f8a336
to
1828fe2
Compare
Spec Meeting 2024/06/27
|
734db8d
to
3456d83
Compare
…untagged variants
3456d83
to
b1de1c5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Problem
RangeQuery
is currently declared as:This declaration is highly problematic for statically typed clients as there is no way to correctly deserialize into the correct union variant, because for example the following variants share the same underlying JSON type:
There are more types for which the same issue applies, for example:
Proposal
Rearrange and mark these kind of untagged unions, that only differ by the type of some fields, in a specific way so that code generators can drive specialized generation to allow for asymmetric (de-)serialization:
In .NET world, the resulting class design could look like this:
Motivation and initial discussion: #2545