From b700bf106281799b8002846b53bc3ad3d175b564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Rubio?= Date: Wed, 6 Nov 2024 15:50:49 +0100 Subject: [PATCH] Move config to appsettings. --- .../Extensions/OpenApiExtensions.cs | 6 +----- AspNetCore.Examples.Auth.Api/appsettings.json | 8 ++++++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/AspNetCore.Examples.Auth.Api/Extensions/OpenApiExtensions.cs b/AspNetCore.Examples.Auth.Api/Extensions/OpenApiExtensions.cs index ed81f95..fc99107 100644 --- a/AspNetCore.Examples.Auth.Api/Extensions/OpenApiExtensions.cs +++ b/AspNetCore.Examples.Auth.Api/Extensions/OpenApiExtensions.cs @@ -29,11 +29,7 @@ public static WebApplication UseCustomOpenApi(this WebApplication app, IConfigur var swaggerUIConfig = configuration.GetSection("OpenApi:SwaggerUI"); if (swaggerUIConfig.Exists()) { - app.UseSwaggerUI(config => - { - config.ConfigObject.Urls = [new() { Name = "V1", Url = "/openapi/v1.json" }]; - swaggerUIConfig.Bind(config); - }); + app.UseSwaggerUI(swaggerUIConfig.Bind); } var scalarConfig = configuration.GetSection("OpenApi:Scalar"); diff --git a/AspNetCore.Examples.Auth.Api/appsettings.json b/AspNetCore.Examples.Auth.Api/appsettings.json index 7c279f3..db65177 100644 --- a/AspNetCore.Examples.Auth.Api/appsettings.json +++ b/AspNetCore.Examples.Auth.Api/appsettings.json @@ -14,6 +14,14 @@ }, "OpenApi": { "SwaggerUI": { + "ConfigObject": { + "Urls": [ + { + "Name": "V1", + "Url": "/openapi/v1.json" + } + ] + }, "OAuthConfigObject": { "ClientId": "interactive.public", "ScopeSeparator": " ",