Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 344
free4ride Avatar asked Aug 05 '15 13:08

free4ride


3 Answers

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

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

like image 67
Richard Beauchamp Avatar answered Nov 16 '22 03:11

Richard Beauchamp


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

like image 5
Fan Ouyang Avatar answered Nov 16 '22 04:11

Fan Ouyang


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.

like image 4
Erik Dahl Avatar answered Nov 16 '22 03:11

Erik Dahl