From 1c3b9affa00b72d6d739a489b0b446f687452d99 Mon Sep 17 00:00:00 2001 From: Vladimir Pecanac Date: Wed, 12 Aug 2026 11:25:09 +0200 Subject: [PATCH] IntroductionToWolverineLibrary: retarget net10.0, bump WolverineFx 6.25.5, switch to built-in OpenAPI 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. --- ...ntroductionToWolverineLibrary.Tests.csproj | 2 +- .../IntroductionToWolverineLibrary.csproj | 8 ++++---- .../IntroductionToWolverineLibrary/Program.cs | 19 +++++++------------ .../Properties/launchSettings.json | 6 +++--- 4 files changed, 15 insertions(+), 20 deletions(-) diff --git a/dotnet-client-libraries/IntroductionToWolverineLibrary/IntroductionToWolverineLibrary.Tests/IntroductionToWolverineLibrary.Tests.csproj b/dotnet-client-libraries/IntroductionToWolverineLibrary/IntroductionToWolverineLibrary.Tests/IntroductionToWolverineLibrary.Tests.csproj index 311a02920..5e236b42c 100644 --- a/dotnet-client-libraries/IntroductionToWolverineLibrary/IntroductionToWolverineLibrary.Tests/IntroductionToWolverineLibrary.Tests.csproj +++ b/dotnet-client-libraries/IntroductionToWolverineLibrary/IntroductionToWolverineLibrary.Tests/IntroductionToWolverineLibrary.Tests.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 enable enable diff --git a/dotnet-client-libraries/IntroductionToWolverineLibrary/IntroductionToWolverineLibrary/IntroductionToWolverineLibrary.csproj b/dotnet-client-libraries/IntroductionToWolverineLibrary/IntroductionToWolverineLibrary/IntroductionToWolverineLibrary.csproj index 040d6ebfb..e6736550c 100644 --- a/dotnet-client-libraries/IntroductionToWolverineLibrary/IntroductionToWolverineLibrary/IntroductionToWolverineLibrary.csproj +++ b/dotnet-client-libraries/IntroductionToWolverineLibrary/IntroductionToWolverineLibrary/IntroductionToWolverineLibrary.csproj @@ -1,15 +1,15 @@  - net8.0 + net10.0 enable enable - - - + + + diff --git a/dotnet-client-libraries/IntroductionToWolverineLibrary/IntroductionToWolverineLibrary/Program.cs b/dotnet-client-libraries/IntroductionToWolverineLibrary/IntroductionToWolverineLibrary/Program.cs index 52b9c6e69..1e2df0d20 100644 --- a/dotnet-client-libraries/IntroductionToWolverineLibrary/IntroductionToWolverineLibrary/Program.cs +++ b/dotnet-client-libraries/IntroductionToWolverineLibrary/IntroductionToWolverineLibrary/Program.cs @@ -3,8 +3,7 @@ var builder = WebApplication.CreateBuilder(args); -builder.Services.AddEndpointsApiExplorer(); -builder.Services.AddSwaggerGen(); +builder.Services.AddOpenApi(); builder.Services.AddControllers(); builder.Host.UseWolverine( x => { @@ -15,20 +14,17 @@ if (app.Environment.IsDevelopment()) { - app.UseSwagger(); - app.UseSwaggerUI(); + app.MapOpenApi(); } app.UseHttpsRedirection(); app.MapPost("/order", async (Order newOrder, IMessageBus bus) => await bus.InvokeAsync(newOrder)) - .WithName("NewBookOrder") - .WithOpenApi(); + .WithName("NewBookOrder"); -app.MapPost("/orderReply", async (Order newOrder, IMessageBus bus) => +app.MapPost("/orderReply", async (Order newOrder, IMessageBus bus) => await bus.InvokeAsync(newOrder)) - .WithName("NewBookOrderReply") - .WithOpenApi(); + .WithName("NewBookOrderReply"); app.MapPost("/bookReview", async (BookReview review, IMessageBus bus) => { @@ -36,10 +32,9 @@ await bus.InvokeAsync(newOrder)) return Results.Ok("Book review submitted successfully."); }) -.WithName("BookReviewEndpoint") -.WithOpenApi(); +.WithName("BookReviewEndpoint"); app.MapControllers(); -app.Run(); \ No newline at end of file +app.Run(); diff --git a/dotnet-client-libraries/IntroductionToWolverineLibrary/IntroductionToWolverineLibrary/Properties/launchSettings.json b/dotnet-client-libraries/IntroductionToWolverineLibrary/IntroductionToWolverineLibrary/Properties/launchSettings.json index 2685f52d0..6d093169f 100644 --- a/dotnet-client-libraries/IntroductionToWolverineLibrary/IntroductionToWolverineLibrary/Properties/launchSettings.json +++ b/dotnet-client-libraries/IntroductionToWolverineLibrary/IntroductionToWolverineLibrary/Properties/launchSettings.json @@ -13,7 +13,7 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, - "launchUrl": "swagger", + "launchUrl": "openapi/v1.json", "applicationUrl": "http://localhost:5137", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" @@ -23,7 +23,7 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, - "launchUrl": "swagger", + "launchUrl": "openapi/v1.json", "applicationUrl": "https://localhost:7125;http://localhost:5137", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" @@ -32,7 +32,7 @@ "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, - "launchUrl": "swagger", + "launchUrl": "openapi/v1.json", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }