NSwag: Generate C# Client from multiple Versions of an API
NSwag: Generate C# Client from multiple Versions of an API We are versioning our API and generating the Swagger specification using Swashbuckle in ASP.NET Core 1.1. We can generate two API docs based on those JSON specification files: <!-- language: c# --> services.AddSwaggerGen(setupAction => { setupAction.SwaggerDoc("0.1", new Info { Title = "Api", Version = "0.1", Description = "API v0.1" }); setupAction.SwaggerDoc("0.2", new Info { Title = "Api", Version = "0.2", Description = "API v0.2" }); // more configuration omitted } We are including all actions in both spec files, unless it is mapped to a specific version using the [MapToApiVersion] and ApiExplorerSettings(GroupName ="<version>")] attributes. Methods belonging to an older version only are also decorated with the [Obsolete] attribute: [MapToApiVersion] ApiExplorerSettings(GroupName ="<version>...