Recording this here as I know I’ll hit this again on some other project…
I wanted to add Swagger api documentation to an existing OData v4 API, something I had done a couple of times before using the Swashbuckle and Swashbuckle.OData projects. But for some reason this time it would not work - the json doc and the SwaggerUI were there but there was no content – the paths collection in the swagger doc was empty – I suspected it had something to do with the way Swashbuckle.OData was building the API descriptions but nothing looked odd in teh way I had configured the OData routes. In the end I cloned out the Swashbuckle.OData project and built locally so I could debug (this was further hampered by the project using Code Contracts – a good thing, but not currently supported in VS2017).
I quickly traced the problem to an extension method:
internal static IEnumerable<ODataRoute> GetODataRoutes(this HttpConfiguration httpConfig)
Contract.Requires(httpConfig != null);
The route collection had a count of 12 but the call to select routes of type ODataRoute was returning zero results – when I examined the private field holding the collection the routes were all of type Castle.Proxies.RouteProxy – a quck Google search turned up the answer in this groups message – I had added Glimpse and in the version I had they replaced the routes with proxies - this has been fixed in versions of Glimpse.AspNet later than 1.8.0 (the version I was on) – updating to a later version fixed my Swagger issues