简体   繁体   中英

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");
});

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});
        });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM