Upgrading .Net Core 2.2 Web API with SWAGGER and ODATA to .Net COre 3.1

Decided to take the plunge and update a fairly sizeable WebAPI with OData and Swagger to .Net Core 3.1. Why the hell would you do this you may ask? Well to take advantage of 3.1’s endpoint routing and OData’s recent support for this with OData 7.40. Inspired by Hassan Habib’s blog entry on Microsoft Dev blogs and decided to go for it. read more

Web API Adventures – Part 1 – Swagger

One thing not immediately obvious with the Swagger API documentation was how to generate metadata particularly for any parameters required as part of an API call.

Surely decorating the API method in question with Summary attributes would make it’s way through to the Swagger API documentation? After a bit of head scratching and googling I realised I was just a step away from achieving this.  I needed to enable the Build Output “XML Documentation file” in the projects build properties.  Give the XML a sensible name i.e bin\WebApiSwagger.XML .

Finally, in the SwaggerConfig.cs create yourself a method:-

protected static string GetXmlCommentsPath()
return System.String.Format(@”{0}\bin\WebApiSwagger.XML”, System.AppDomain.CurrentDomain.BaseDirectory);
} read more