From cba564a811b76c4d22d6ec41f85a12ecb00bcdec Mon Sep 17 00:00:00 2001 From: ThompsonNye Date: Mon, 16 Jun 2025 19:52:04 +0200 Subject: [PATCH] Switch to Scalar swagger ui --- .../Common/StartupExtensions.cs | 15 +++------------ .../Properties/launchSettings.json | 2 +- src/Vegasco.Server.Api/Vegasco.Server.Api.csproj | 2 +- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/Vegasco.Server.Api/Common/StartupExtensions.cs b/src/Vegasco.Server.Api/Common/StartupExtensions.cs index ada640e..ac96a37 100644 --- a/src/Vegasco.Server.Api/Common/StartupExtensions.cs +++ b/src/Vegasco.Server.Api/Common/StartupExtensions.cs @@ -1,4 +1,5 @@ using Asp.Versioning.ApiExplorer; +using Scalar.AspNetCore; using Vegasco.Server.Api.Endpoints; using Vegasco.Server.ServiceDefaults; @@ -36,18 +37,8 @@ internal static class StartupExtensions if (app.Environment.IsDevelopment()) { - app.MapOpenApi("/swagger/{documentName}/swagger.json"); - app.UseSwaggerUI(o => - { - // Create a Swagger endpoint for each API version - IReadOnlyList apiVersions = app.DescribeApiVersions(); - foreach (ApiVersionDescription apiVersionDescription in apiVersions) - { - string url = $"/swagger/{apiVersionDescription.GroupName}/swagger.json"; - string name = apiVersionDescription.GroupName.ToUpperInvariant(); - o.SwaggerEndpoint(url, name); - } - }); + app.MapOpenApi(); + app.MapScalarApiReference(); } return app; diff --git a/src/Vegasco.Server.Api/Properties/launchSettings.json b/src/Vegasco.Server.Api/Properties/launchSettings.json index 0dec4f4..474c37d 100644 --- a/src/Vegasco.Server.Api/Properties/launchSettings.json +++ b/src/Vegasco.Server.Api/Properties/launchSettings.json @@ -3,7 +3,7 @@ "https": { "commandName": "Project", "launchBrowser": true, - "launchUrl": "swagger", + "launchUrl": "scalar/v1", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, diff --git a/src/Vegasco.Server.Api/Vegasco.Server.Api.csproj b/src/Vegasco.Server.Api/Vegasco.Server.Api.csproj index 6b8436f..86548ed 100644 --- a/src/Vegasco.Server.Api/Vegasco.Server.Api.csproj +++ b/src/Vegasco.Server.Api/Vegasco.Server.Api.csproj @@ -29,9 +29,9 @@ + -