ODataController controllers missing from swagger UI
See original GitHub issueI am working on a POC with OData on AspNetCore Microsoft.AspNetCore.OData
I am trying to add Swagger UI to document The API
I am working with this versions : Swashbuckle.AspNetCore.Swagger 1.1 Swashbuckle.AspNetCore.SwaggerGen 1.1 Swashbuckle.AspNetCore.SwaggerGenUI 1.1
My problem is the ODataController is missing from the Swagger UI.
I have found some forum thread and the workaround was to add Annotations to the ODataController
[ApiExplorerSettings(IgnoreApi = false )]
If I do that the Api is not working since the routes are not defined .
has ApiExplorer enabled, but is using conventional routing. Only actions which use attribute routing support ApiExplorer.
so the only solution I have found to see the ODataController is to also add :
[Route("v1/api/[controller]")]
But if I do that I lose the Odata.context informations (in the json results) that are vital to give the total number of results without paging “@odata.context”: “http://localhost:29860/v1/api/$metadata#Products”, “@odata.count”: 4,
What can I do to make swagger work with OdataController without loosing all Odata annotations on the results ?
Thank you by advance for your attention
Issue Analytics
- State:
- Created 6 years ago
- Reactions:16
- Comments:29 (2 by maintainers)
Same issue here. My regular Controllers show up in Swagger but not my OData controllers.
I managed to make Swagger compatible with ODataController by following the code in this repository. I had only to change SetOutputFormatters in Startup.cs in this way: