-
Notifications
You must be signed in to change notification settings - Fork 473
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
[.NET Core 3.1] Hot to configure OData with Swagger? #2024
Comments
We managed to get this working by adding this: services.AddMvcCore(options => |
Ok, the solution is:
Thanks Mhirji :) |
I have created a service extension for the same. |
Works to me. Important note: formatters must be fixed AFTER odata is registered. This is why my original code |
It works |
Hi,
I would like to configure Swagger (Swashbuckle vr 5.0.0) in my project (.NET Core 3.1) with OData (vr 7.3). Currently I get an exception:
{"message":"No media types found in 'Microsoft.AspNet.OData.Formatter.ODataOutputFormatter.SupportedMediaTypes'. Add at least one media type to the list of supported media types. "}
Assemblies affected
Microsoft.AspNetCore.OData 7.3.0
Swashbuckle.AspNetCore 5.0.0
.NET Core 3.1
Reproduce steps
Expected result
You will see at least standard endpoint.
Actual result
You will see Swagger page with information 'Failed to load API Definition'
Additional detail
In my opinion API/Swagger shouldn't generate OData endpoints because they are marked as ignored ([ApiExplorerSettings(IgnoreApi = true)])
The text was updated successfully, but these errors were encountered: