Open chrfin opened 2 years ago
I'm trying to implement api-versioning using .NET 6.0 and it works fine, but I can't get automatic document generation to work.
How can the following be done with NSwag? -> https://github.com/dotnet/aspnet-api-versioning/wiki/API-Documentation#aspnet-core
All examples I can find manually call AddOpenApiDocument for every version, but I would like to do that automatically for every version. For now I use an intermediate IServiceProvider, but this generates valid warnings:
AddOpenApiDocument
IServiceProvider
var versionDescriptionProvider = builder.Services.BuildServiceProvider().GetService<IApiVersionDescriptionProvider>(); foreach (var description in versionDescriptionProvider.ApiVersionDescriptions) { builder.Services.AddOpenApiDocument(document => { document.DocumentName = description.GroupName; document.ApiGroupNames = new[] { description.GroupName }; }); }
I am also interested in this. DId you find a solution yet?
No, still using the mentioned workaround...
I'm trying to implement api-versioning using .NET 6.0 and it works fine, but I can't get automatic document generation to work.
How can the following be done with NSwag? -> https://github.com/dotnet/aspnet-api-versioning/wiki/API-Documentation#aspnet-core
All examples I can find manually call
AddOpenApiDocument
for every version, but I would like to do that automatically for every version.For now I use an intermediate
IServiceProvider
, but this generates valid warnings: