Skip to content

Commit

Permalink
Actually Fix the Default Swagger Version
Browse files Browse the repository at this point in the history
  • Loading branch information
da3dsoul committed Nov 12, 2023
1 parent 30cce37 commit 4ad65b8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Shoko.Server/API/APIExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static IServiceCollection AddAPI(this IServiceCollection services)

// add a swagger document for each discovered API version
// note: you might choose to skip or document deprecated API versions differently
foreach (var description in provider.ApiVersionDescriptions)
foreach (var description in provider.ApiVersionDescriptions.OrderByDescending(a => a.ApiVersion))
{
options.SwaggerDoc(description.GroupName, CreateInfoForApiVersion(description));
}
Expand Down Expand Up @@ -173,7 +173,6 @@ public static IServiceCollection AddAPI(this IServiceCollection services)

services.AddApiVersioning(o =>
{
o.DefaultApiVersion = new ApiVersion(3, 0);
o.ReportApiVersions = true;
o.AssumeDefaultVersionWhenUnspecified = true;
o.ApiVersionReader = ApiVersionReader.Combine(
Expand Down Expand Up @@ -305,7 +304,7 @@ public static IApplicationBuilder UseAPI(this IApplicationBuilder app)
{
// build a swagger endpoint for each discovered API version
var provider = app.ApplicationServices.GetRequiredService<IApiVersionDescriptionProvider>();
foreach (var description in provider.ApiVersionDescriptions)
foreach (var description in provider.ApiVersionDescriptions.OrderByDescending(a => a.ApiVersion))
{
options.SwaggerEndpoint($"/swagger/{description.GroupName}/swagger.json",
description.GroupName.ToUpperInvariant());
Expand Down

0 comments on commit 4ad65b8

Please sign in to comment.