How to document OData endpoints (swagger, swashbuckle, other)?
Asked Answered
T

5

14

What is the best way of documenting OData endpoints? Is there a way to use Swashbuckle for it?

Tiein answered 5/8, 2015 at 13:29 Comment(0)
S
8

Yes, try Swashbuckle.OData. It adds Swashbuckle support for ODataControllers.

See it in action here: http://swashbuckleodata.azurewebsites.net/swagger

Shaughn answered 18/11, 2015 at 18:8 Comment(2)
Site is down, unfortunatelyNortherly
Swashbuckle.OData no longer works with the latest version of Microsoft.Odata.Core. Apparently Microsoft changed the dependencies in Microsoft.AspNet.OData from System.Web.OData and Swashbuckle.OData hasn't been updated to use the latest OData packages.Candlepower
M
5

Yes, we are trying to support it like yaml -> Swagger, yaml -> csdl ..

But it will need time to implementation, you can see a prototype and track there https://github.com/OData/model-first

Mathian answered 10/8, 2015 at 9:25 Comment(0)
M
4

I actually got something working for this using the IDocumentFilter function within Swashbuckle. I answered a similar question on the GitHub repo for Swashbuckle. Check out my response here (it's either at bottom or toward bottom):

https://github.com/domaindrivendev/Swashbuckle/issues/149

I've posted an example of a working IDocumentFilter implementation that you could leverage to get your OData endpoint set up in the Swagger ui.

Marvelmarvella answered 2/9, 2015 at 16:28 Comment(0)
C
1

The easiest way to do that I found is to convert OData definition to Open API spec using https://github.com/oasis-tcs/odata-openapi

Then import the spec document into swagger is very easy.

Coming answered 29/4, 2019 at 11:42 Comment(0)
L
1

Asp NET and Asp NET Core Api Versioning

You can use Api Versioning (as it extends ApiExplorer with Odata information) for both WebApi and AspNetCore.

There are samples available for both:

This sample how it integrates well with Swashbuckle/Swagger ui.

Logy answered 15/2, 2020 at 15:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.