shaair
shaair

Reputation: 985

Multiple versioning URL not working in Swashbuckle.AspNetCore 5.0.0rc

Multiple versioning was working with Swashbuckle.AspNetCore 4.0.1 but not working in 5.0.0rc. Now only api-limited-docs working URL . Other url not generating.

  1. ../api/api-docs ---not working
  2. ../api/api-limitted-docs ---working

Following old code.

app.UseSwaggerUI(options =>
{
    options.RoutePrefix = "api-docs";
    string swaggerJsonBasePath = string.IsNullOrWhiteSpace(options.RoutePrefix) ? "." : "..";
    options.SwaggerEndpoint($"{swaggerJsonBasePath}/swagger/swagger.json", "v1");
});
app.UseSwaggerUI(options =>
{
    options.RoutePrefix = "api-limited-docs";
    string swaggerJsonBasePath = string.IsNullOrWhiteSpace(options.RoutePrefix) ? "." : "..";
    options.SwaggerEndpoint($"{swaggerJsonBasePath}/swagger/limitted/swagger.json", "v1");
});

Upvotes: 1

Views: 194

Answers (1)

shaair
shaair

Reputation: 985

Yes for the latest version it is available. Here is the change.

services.AddSwaggerGen(c =>
        {
            c.EnableAnnotations();
            c.SwaggerDoc("api", new OpenApiInfo { Title = "API - Title", Version = AppClientVersion.LatestVersion});
            c.SwaggerDoc("limited", new OpenApiInfo { Title = "limited- Title", Version = AppClientVersion.LatestVersion});
        });

Upvotes: 1

Related Questions