-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Schema inheritance/polymorphism with [FromForm]
parameter
#2271
Comments
Any update on this? It's annoying to be able to test some endpoints. |
Hi, I'm also keen to hear if there's any update on the issue described here. Our use case is that we're trying to implement an OAuth 2.0 compatible identity service where the Using .NET 6 web API we're able to achieve it on the code level but Swagger UI is not displaying this properly because the generated open api schema is reflecting just the base model and doesn't contain any details about sub-classes (as mentioned by reporter of this issue). One of our requirements is to have all APIs properly documented so we're currently exploring some workaround using custom JS but it'd be great to know if there's a better way how to achieve desired outcome for We're using the "Swashbuckle.AspNetCore" and "Swashbuckle.AspNetCore.Annotations" version 6.4.0 packages. Same thing was also reported here by another participant on this ticket. Base model for reference:
And relevant section from
|
TL;DR what you're trying to do is not currently supported and to do so will require a significant refactor to an area of the code that is already becoming a maintenance nightmare. This is fundamentally due to the way ApiExplorer, the ASP.NET Core metadata layer that Swashbuckle is built on top of, treats
Will keep open and mark as medium priority - this whole area really needs a major overahall at this point 😢 |
Hi , thanks for the feedback and for keeping the ticket open, we will explore additional options in the meantime. |
Hi, I ended up here in the same situation. Polymorphism with multipart form data. Is there any way to customize/rewrite part of definition? |
This issue is stale because it has been open for 60 days with no activity. It will be automatically closed in 14 days if no further updates are made. |
I am currently attempting to generate an accurate schema that represents a polymorphic object model, however, the specification seemingly discards/ignores all inheritance/polymorphism detail.
I have created a basic example as below. Consider the following model and associated Controller Action:
With certain details omitted for simplicity - such as the custom Model Binding required to properly instantiate an instance of the abstract class - I would expect an endpoint schema which is equivalent to:
However, the following is generated, lacking any sub-class detail:
I see the same results when attempting to utilise an interface over an abstract class.
The text was updated successfully, but these errors were encountered: