From 6a0ed1ee942cfdd47f72b3421fdf269b1efde6ce Mon Sep 17 00:00:00 2001 From: martincostello Date: Sun, 14 Jan 2024 09:48:55 +0000 Subject: [PATCH] Migrate to NSwag Replace Swashbuckle with NSwag. --- src/TodoApp/Program.cs | 9 +++++---- src/TodoApp/Properties/launchSettings.json | 2 +- src/TodoApp/TodoApp.csproj | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/TodoApp/Program.cs b/src/TodoApp/Program.cs index 8f3515e7..355b7b72 100644 --- a/src/TodoApp/Program.cs +++ b/src/TodoApp/Program.cs @@ -18,9 +18,10 @@ // Configure OpenAPI documentation for the Todo API builder.Services.AddEndpointsApiExplorer(); -builder.Services.AddSwaggerGen(options => +builder.Services.AddOpenApiDocument(options => { - options.SwaggerDoc("v1", new() { Title = "Todo API", Version = "v1" }); + options.Title = "Todo API"; + options.Version = "v1"; }); if (string.Equals(builder.Configuration["CODESPACES"], "true", StringComparison.OrdinalIgnoreCase)) @@ -55,8 +56,8 @@ app.UseAuthentication(); app.UseAuthorization(); -// Add Swagger endpoint for OpenAPI -app.UseSwagger(); +// Add endpoint for OpenAPI +app.UseOpenApi(); // Add the HTTP endpoints app.MapAuthenticationRoutes(); diff --git a/src/TodoApp/Properties/launchSettings.json b/src/TodoApp/Properties/launchSettings.json index 86cb51bd..9cb69613 100644 --- a/src/TodoApp/Properties/launchSettings.json +++ b/src/TodoApp/Properties/launchSettings.json @@ -3,7 +3,7 @@ "TodoApp": { "commandName": "Project", "launchBrowser": true, - "applicationUrl": "https://localhost:5001;http://localhost:5000", + "applicationUrl": "https://localhost:50001;http://localhost:50000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/src/TodoApp/TodoApp.csproj b/src/TodoApp/TodoApp.csproj index c8739e94..cd33b618 100644 --- a/src/TodoApp/TodoApp.csproj +++ b/src/TodoApp/TodoApp.csproj @@ -13,7 +13,7 @@ - +