-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
How to describe polymorphic endpoint #2340
Comments
One problem is, that Swagger does not evaluate the |
refs #2340 - add JsonTypeInfo.property to schema if not existing
@frantuma Thanks for the fix. We really wanted this to be fixed. How can I try and test this fix? We are using swagger jaxrs2 plugin 2.0.8 at the moment. |
This is available in latest |
@frantuma I got a chance to try your fix with the following: the swagger doc shows me the 'type' field but not include the sub types in it as part of the generated doc |
your scenario seems to be working on e.g. in this test can you share more details about the annotated resources and classes, the swagger configuration, and the resolved spec? |
I have @Schema(type="object", discriminatorProperty = "type", required = true, oneOf = {Dog.class, Cat.class}) on the Animal class. I think it might be an issue with swagger-ui example not showing it correctly, when I look at the schema in UI then seems to be showing fine |
If i get it right, it might be an issue with swagger-ui? if this is the case, please open an issue there (providing the spec causing the issue) |
Hit a NPE when my model had some required fields but did not have the discriminatorProperty as part of the class definition. swagger-core/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java Line 1643 in 6c702f1
Changed the condition to following and it fixed it, |
…ator ref #2340 - fixes discriminator property resolving
thanks @SabhtarshaMojo , it was indeed a bug, fixed in #3293 |
We use Spring+Jackson(Java). And in our API we can send different object to same endpoint.
For example
Sending to /test
will show Dog.class
Sending to /test
will show Cat.class
How to describe polymorphic endpoint in Swagger?
The text was updated successfully, but these errors were encountered: