Skip to content

Commit df577fd

Browse files
IntroductionToWolverineLibrary: retarget net10.0, bump WolverineFx 6.25.5, switch to built-in OpenAPI (#2084)
WolverineFx 6.x no longer ships the runtime Roslyn compiler in the core package, so the sample fails to start with TypeLoadMode.Dynamic unless WolverineFx.RuntimeCompilation is referenced. Added it alongside the WolverineFx bump. Replaced Swashbuckle with the built-in OpenAPI support the .NET 10 webapi template uses (AddOpenApi/MapOpenApi) and dropped the now-redundant per-endpoint WithOpenApi() calls from all three endpoints. Repointed launchUrl to the OpenAPI document.
1 parent 56ae90f commit df577fd

4 files changed

Lines changed: 15 additions & 20 deletions

File tree

dotnet-client-libraries/IntroductionToWolverineLibrary/IntroductionToWolverineLibrary.Tests/IntroductionToWolverineLibrary.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77

Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.7" />
11-
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
12-
<PackageReference Include="WolverineFx" Version="2.15.2" />
10+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.11" />
11+
<PackageReference Include="WolverineFx" Version="6.25.5" />
12+
<PackageReference Include="WolverineFx.RuntimeCompilation" Version="6.25.5" />
1313
</ItemGroup>
1414

1515
</Project>

dotnet-client-libraries/IntroductionToWolverineLibrary/IntroductionToWolverineLibrary/Program.cs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
var builder = WebApplication.CreateBuilder(args);
55

6-
builder.Services.AddEndpointsApiExplorer();
7-
builder.Services.AddSwaggerGen();
6+
builder.Services.AddOpenApi();
87
builder.Services.AddControllers();
98
builder.Host.UseWolverine( x =>
109
{
@@ -15,31 +14,27 @@
1514

1615
if (app.Environment.IsDevelopment())
1716
{
18-
app.UseSwagger();
19-
app.UseSwaggerUI();
17+
app.MapOpenApi();
2018
}
2119

2220
app.UseHttpsRedirection();
2321

2422
app.MapPost("/order", async (Order newOrder, IMessageBus bus) => await bus.InvokeAsync(newOrder))
25-
.WithName("NewBookOrder")
26-
.WithOpenApi();
23+
.WithName("NewBookOrder");
2724

28-
app.MapPost("/orderReply", async (Order newOrder, IMessageBus bus) =>
25+
app.MapPost("/orderReply", async (Order newOrder, IMessageBus bus) =>
2926
await bus.InvokeAsync<string>(newOrder))
30-
.WithName("NewBookOrderReply")
31-
.WithOpenApi();
27+
.WithName("NewBookOrderReply");
3228

3329
app.MapPost("/bookReview", async (BookReview review, IMessageBus bus) =>
3430
{
3531
await bus.PublishAsync(review);
3632

3733
return Results.Ok("Book review submitted successfully.");
3834
})
39-
.WithName("BookReviewEndpoint")
40-
.WithOpenApi();
35+
.WithName("BookReviewEndpoint");
4136

4237

4338
app.MapControllers();
4439

45-
app.Run();
40+
app.Run();

dotnet-client-libraries/IntroductionToWolverineLibrary/IntroductionToWolverineLibrary/Properties/launchSettings.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"commandName": "Project",
1414
"dotnetRunMessages": true,
1515
"launchBrowser": true,
16-
"launchUrl": "swagger",
16+
"launchUrl": "openapi/v1.json",
1717
"applicationUrl": "http://localhost:5137",
1818
"environmentVariables": {
1919
"ASPNETCORE_ENVIRONMENT": "Development"
@@ -23,7 +23,7 @@
2323
"commandName": "Project",
2424
"dotnetRunMessages": true,
2525
"launchBrowser": true,
26-
"launchUrl": "swagger",
26+
"launchUrl": "openapi/v1.json",
2727
"applicationUrl": "https://localhost:7125;http://localhost:5137",
2828
"environmentVariables": {
2929
"ASPNETCORE_ENVIRONMENT": "Development"
@@ -32,7 +32,7 @@
3232
"IIS Express": {
3333
"commandName": "IISExpress",
3434
"launchBrowser": true,
35-
"launchUrl": "swagger",
35+
"launchUrl": "openapi/v1.json",
3636
"environmentVariables": {
3737
"ASPNETCORE_ENVIRONMENT": "Development"
3838
}

0 commit comments

Comments
 (0)