Skip to content

Commit 9515281

Browse files
authored
Add NSwag to sample (#644)
1 parent f30a33a commit 9515281

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

9.0/BlazorWebAssemblyStandaloneWithIdentity/Backend/Backend.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="9.0.0" />
1212
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.7" />
1313
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="9.0.0" />
14+
<PackageReference Include="NSwag.AspNetCore" Version="14.6.1" />
1415
</ItemGroup>
1516

1617
</Project>

9.0/BlazorWebAssemblyStandaloneWithIdentity/Backend/Program.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@
5656
// Add Endpoints API Explorer
5757
builder.Services.AddEndpointsApiExplorer();
5858

59-
// add OpenAPI services
60-
builder.Services.AddOpenApi();
59+
// Add NSwag services
60+
builder.Services.AddOpenApiDocument();
6161

6262
var app = builder.Build();
6363

@@ -67,8 +67,9 @@
6767
await using var scope = app.Services.CreateAsyncScope();
6868
await SeedData.InitializeAsync(scope.ServiceProvider);
6969

70-
// resolve OpenAPI document
71-
app.MapOpenApi();
70+
// Add OpenAPI/Swagger generator and the Swagger UI
71+
app.UseOpenApi();
72+
app.UseSwaggerUi();
7273
}
7374

7475
// create routes for the identity endpoints

9.0/BlazorWebAssemblyStandaloneWithIdentity/BlazorWasmAuth.slnLaunch.user

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[
22
{
3-
"Name": "New Profile",
3+
"Name": "Start Projects",
44
"Projects": [
55
{
6-
"Name": "BlazorWasmAuth\\BlazorWasmAuth.csproj",
6+
"Path": "BlazorWasmAuth\\BlazorWasmAuth.csproj",
77
"Action": "Start"
88
},
99
{
10-
"Name": "Backend\\Backend.csproj",
10+
"Path": "Backend\\Backend.csproj",
1111
"Action": "StartWithoutDebugging"
1212
}
1313
]

0 commit comments

Comments
 (0)