Skip to content
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

Add identifier for oneOf [...] operation responses #17

Open
Chaosdave34 opened this issue Aug 18, 2023 · 3 comments
Open

Add identifier for oneOf [...] operation responses #17

Chaosdave34 opened this issue Aug 18, 2023 · 3 comments

Comments

@Chaosdave34
Copy link

Add a way to identify the Schema of operation responses. For example the get_channel operation, when successfull, can return 1 of 4 different schemas.
If you take a look at the schemas you see, that they can be identified by the type property, but there is no convinient way (at least I dont see any) to get this parameter from the response field of an operation.
Maybe add a identifiedBy field to the response content.

@danny-may
Copy link

There is already a standard way to do this in OpenAPI 3 using the descriminator property of a schema
https://swagger.io/docs/specification/data-models/inheritance-and-polymorphism/
Would definitely be nice to have any fields which act as descriminators be documented

@A5rocks
Copy link

A5rocks commented Aug 29, 2023

That's not in OpenAPI 3.1 though? And can't the descriminator just be calculated by the thing going from specification -> deserialization code?

@mbialecka
Copy link
Contributor

OpenAPI 3.1 allows for discriminator: https://spec.openapis.org/oas/latest.html#discriminator-object
We considered this approach and may implement discriminators in the future. It's somewhat problematic given most of the fields we'd discriminate against are int enums, and the mapping keys are strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants