From fd8b40aae9a09e04f27f9e0f38866fb551ce01f1 Mon Sep 17 00:00:00 2001 From: guardrex <1622880+guardrex@users.noreply.github.com> Date: Tue, 27 Jan 2026 11:10:23 -0500 Subject: [PATCH] Add NSwag to sample --- .../Backend/Backend.csproj | 1 + .../Backend/Program.cs | 9 +++++---- .../BlazorWasmAuth.slnLaunch.user | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/9.0/BlazorWebAssemblyStandaloneWithIdentity/Backend/Backend.csproj b/9.0/BlazorWebAssemblyStandaloneWithIdentity/Backend/Backend.csproj index 4015a857c..bdd57eda4 100644 --- a/9.0/BlazorWebAssemblyStandaloneWithIdentity/Backend/Backend.csproj +++ b/9.0/BlazorWebAssemblyStandaloneWithIdentity/Backend/Backend.csproj @@ -11,6 +11,7 @@ + diff --git a/9.0/BlazorWebAssemblyStandaloneWithIdentity/Backend/Program.cs b/9.0/BlazorWebAssemblyStandaloneWithIdentity/Backend/Program.cs index 48e5dcf20..ed5b6ae12 100644 --- a/9.0/BlazorWebAssemblyStandaloneWithIdentity/Backend/Program.cs +++ b/9.0/BlazorWebAssemblyStandaloneWithIdentity/Backend/Program.cs @@ -56,8 +56,8 @@ // Add Endpoints API Explorer builder.Services.AddEndpointsApiExplorer(); -// add OpenAPI services -builder.Services.AddOpenApi(); +// Add NSwag services +builder.Services.AddOpenApiDocument(); var app = builder.Build(); @@ -67,8 +67,9 @@ await using var scope = app.Services.CreateAsyncScope(); await SeedData.InitializeAsync(scope.ServiceProvider); - // resolve OpenAPI document - app.MapOpenApi(); + // Add OpenAPI/Swagger generator and the Swagger UI + app.UseOpenApi(); + app.UseSwaggerUi(); } // create routes for the identity endpoints diff --git a/9.0/BlazorWebAssemblyStandaloneWithIdentity/BlazorWasmAuth.slnLaunch.user b/9.0/BlazorWebAssemblyStandaloneWithIdentity/BlazorWasmAuth.slnLaunch.user index 24ec3068e..10645d1cb 100644 --- a/9.0/BlazorWebAssemblyStandaloneWithIdentity/BlazorWasmAuth.slnLaunch.user +++ b/9.0/BlazorWebAssemblyStandaloneWithIdentity/BlazorWasmAuth.slnLaunch.user @@ -1,13 +1,13 @@ [ { - "Name": "New Profile", + "Name": "Start Projects", "Projects": [ { - "Name": "BlazorWasmAuth\\BlazorWasmAuth.csproj", + "Path": "BlazorWasmAuth\\BlazorWasmAuth.csproj", "Action": "Start" }, { - "Name": "Backend\\Backend.csproj", + "Path": "Backend\\Backend.csproj", "Action": "StartWithoutDebugging" } ]