-
Notifications
You must be signed in to change notification settings - Fork 9k
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
Discriminator does not switch schema #2438
Comments
I'm also seeing this. There's a lot of conflicting information across Swagger repos regarding support for |
I see the same in v2.2.6 |
This is a very important feature for us as well. We use a workaround at the moment: For the GET method we define multiple responses like "200 Cat" and "200 Dog". It would be greate to see the discriminator be supported very soon, because with upper workaround our api spec is hard to maintain and the rendered ui is not easy to read. |
An ETA when it will be supported? an example how it works in ReDoc |
@raderio at the moment, it's not in our immediate plans. |
It's pretty surprising to me that this isn't supported out of the box (or being prioritized). The way it shows just the "parent" and doesn't give anybody an idea of the other types available in any way is... not great, to put it lightly. It's going to be very unintuitive for users that want to try our routes that use polymorphic inputs and outputs. |
Would a pull request be welcome for this? |
@pschichtel certainly by me. I'd be happy to test. |
Is this on the roadmap in 2024? |
Created a PR for this #10224 |
Using Swagger UI v2.2.3
Swagger file:
What I expect to see:
Under
GET /animals
some indication that aDog
orCat
may actually be returned with correspondinghuntingSkill
orpackSize
parameters.Under
POST /animals
parameters section a text box corresponding tohuntingSkill
whenanimalType
dropdown is set toCat
, and apackSize
text box whenanimalType
is set toDog
What I actually see:
Basic
Animal
represented for bothGET
andPOST
.If I change the schema
$ref
inGET
orPOST
to one of the options then the model will show all fields for anAnimal
plus the specific type of animal. However theanimalType
parameter can still be changed to the other type.The text was updated successfully, but these errors were encountered: