mix OData and REST API controllers - ApiExplorer/OpenAPI issues #1411
Unanswered
swurzinger
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How can I have both OData controllers and non-OData controllers in the same project without causing conflicts? Some of the issues that arise:
[ODataIgnored]
attribute to exclude controllers from the OData routing conventions, but that would require to be added to every controller. Is there some alternative like a filter/convention/... ?IControllerModelConvention
which setscontroller.ApiExplorer.IsVisible = false
for OData controllers.ODataOutputFormatter
is added to every endpoint, causing various issues for OpenAPI document generation. This results in many ApiResponseFormats to be added to every request, even if they are non-OData endpoints. This happens becauseMicrosoft.AspNetCore.Mvc.ApiExplorer.ApiResponseTypeProvider
callsODataOutputFormatter.GetSupportedContentTypes(contentType, responseType)
, which can't tell whether it's dealing with an OData endpoint and just returns all configured response types it supports. The OData check only happens inODataOutputFormatter.CanWriteResult
when the response is going to be serialized (but this is irrelevant for ApiExplorer).What could be a good solution for this, especially the last one?
Beta Was this translation helpful? Give feedback.
All reactions