Description
I have integrated successfully with the Microsoft.AspNetCore.OData.Versioning v3.0.0-beta1 package in my service and now I want to enable swagger. My service ONLY supports URL path versioning and not the query filter version. I used the https://github.com/Microsoft/aspnet-api-versioning/tree/master/samples/aspnetcore/SwaggerODataSample sample as a reference and everything works if I use query parameter versioning. Since my actual application uses only URL path formatting and has no support for query parameter versioning support, I tried this out in the sample by editing the Startup.cs by replacing the below two lines:
services.AddApiVersioning( options => options.ReportApiVersions = true );
with
services.AddApiVersioning( options => { options.ApiVersionReader = new UrlSegmentApiVersionReader(); options.ReportApiVersions = true; options.RouteConstraintName = "apiVersion"; });
and
app.UseMvc( routeBuilder => routeBuilder.MapVersionedODataRoutes( "odata", "api", modelBuilder.GetEdmModels() ) );
with
routeBuilder.MapVersionedODataRoutes("odata", "v{apiVersion}", modelBuilder.GetEdmModels());
When I do this the swagger UI doesn't give me an option anymore to specify the version in the URL path so when I try the API, it fails with 404 Not Found since it shows the API as v{version}. This would result in the API call as http://localhost:5000/v{version}/People(1) for example which makes sense to be 404 Not Found.
Is this possible with the Microsoft.AspNetCore.OData.Versioning.ApiExplorer v3.0.0-beta1 package today and if so, how would I configure this to work?