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
Polymorphism support doesn't allow custom discriminator values #366
Comments
Here's the related discussion from the Swagger folks: OAI/OpenAPI-Specification#403 Looks like a proper fix is a long way off. Any suggested workarounds? |
It looks like the implementation idea I submitted in swagger-api/swagger-spec#403 (using enum values for matching) could solve your problem... But this is just an idea, not code... |
My vote goes to option 4 from OAI/OpenAPI-Specification#403.
It sounds like this will end up as the path going forward, but it's definitely breaking right now. Thoughts @brjohnstmsft, @Azure/adx-sdk-team? |
Seems like the extension is the cleanest solution. It doesn't have to be breaking if we ensure that it's optional (i.e. -- fall back to the current behavior if it's not there). |
Since I haven't heard any objections, I'm going to start implementing a fix based on adding a new extension (tentatively named |
👍 |
Still working on this. Found this related bug along the way: #456 |
The Swagger spec for Schema Object says this about
discriminator
(emphasis mine):The constraint on value makes it impossible to model OData polymorphism using Swagger. In OData V4, the discriminator is always an annotation (JSON property) called
@odata.type
and its value is defined as a#
followed by the fully-qualified name of the type in the EDM model. In the example ofDog
inheriting fromPet
, Swagger expectspetType
to beDog
, while OData requires it to be something like#Microsoft.Azure.Dog
(assuming a namespace ofMicrosoft.Azure
in the EDM model).We need a way to model polymorphism in existing REST APIs that use OData without having to change those APIs.
The text was updated successfully, but these errors were encountered: