You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
We have been using the API "Versioning through custom headers" principle, wherein nswag was generating {version} placeholder and we replaced the value based on incoming client request header value. This {version} placeholder is not available anymore after upgrading to the latest version of NSwag.
services.AddRouting(options => options.LowercaseUrls = true);
services.AddApiVersioning(options =>
{
options.ReportApiVersions = true;
options.AssumeDefaultVersionWhenUnspecified = true;
options.DefaultApiVersion = new ApiVersion(1, 0);
});
services.AddInfrastructure(Configuration);
// Register the Swagger generator, defining 1 or more Swagger documents
services.AddOpenApiDocument(document =>
{
document.DocumentName = "v1";
document.Title = "xxxxxx Web APIs";
document.Version = "1.0";
// This adds the ability to handle a custom required header in the OpenAPI contract
document.OperationProcessors.Add(new OperationRequiredHeaderAttributes());
});
Generated code (missing the version number in the url) : // Operation Path: "api/v{version}/security/groups" urlBuilder_.Append("api/v"); urlBuilder_.Append("/security/groups");
`
The text was updated successfully, but these errors were encountered:
Hello,
We have been using the API "Versioning through custom headers" principle, wherein nswag was generating {version} placeholder and we replaced the value based on incoming client request header value. This {version} placeholder is not available anymore after upgrading to the latest version of NSwag.
Startup.cs implementation:
` services
.AddControllers(options =>
{
options.UseGeneralRoutePrefix("api/v{version:apiVersion}");
options.EnableEndpointRouting = true;
options.Filters.Add();
})
.AddNewtonsoftJson();
Generated code (missing the version number in the url) :
// Operation Path: "api/v{version}/security/groups" urlBuilder_.Append("api/v"); urlBuilder_.Append("/security/groups");
`
The text was updated successfully, but these errors were encountered: