In an Asp.Net Core v3.1 api, Swagger v3.0, the Swagger UI cannot load API definitions when I have declared multiple versions.
Edit: Also from NuGet:
Mcrosoft.AspNetCore.Mvc.Versioning v4.1.1
NSwag.AspNetCore v13.7.0
Following the documentation of NSwag I realized that I have to add the following to my '''Startup.ConfigureServices()''':
services.AddApiVersioning(options =>
{
options.AssumeDefaultVersionWhenUnspecified = true;
options.ApiVersionReader = new UrlSegmentApiVersionReader();
})
.AddMvcCore()
.AddVersionedApiExplorer(options =>
{
options.GroupNameFormat = "VVV";
options.SubstituteApiVersionInUrl = true;
});
But '''AddVersionedApiExplore()''' is not available there... then I found this ApiExplorerOptions wiki where it states (I understood so) that since Asp.Net Core 3.0 the usage it is:
services.AddVersionedApiExplorer( options => { /* configure options */ } );
But I endup with the error 'IServiceCollection'
does not contain a definition for 'AddVersionedApiExplorer'
BTW, all the paths of the service run fine from Postman for each version, the swagger's page loads and shows both of versions I declared but it cannot load their definitions.
Can somebody please point me to the right direction?