← All recipes
Moderne licensed

Migrate Swashbuckle to built-in OpenAPI

Recipe IDOpenRewrite.Recipes.CSharp.Migration.Dotnet.Net9.MigrateSwashbuckleToOpenApiArtifactOpenRewrite.Recipes.CSharp.Migration.Dotnet

Migrate from Swashbuckle to the built-in OpenAPI support in ASP.NET Core 10+. Replaces AddSwaggerGen() with AddOpenApi(), UseSwaggerUI() with MapOpenApi(), removes UseSwagger(), removes Swashbuckle packages, and adds Microsoft.AspNetCore.OpenApi. Only fires when every project targets net10.0+ (the version that ships Microsoft.OpenApi 2.x with its flattened type namespaces).

Single recipecsharpdotnetaspnetcoremigrationProprietary

Usage

This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.

mod run . --recipe OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net9.MigrateSwashbuckleToOpenApi

If the recipe isn’t available locally, install it with:

mod config recipes nuget install OpenRewrite.Recipes.CSharp.Migration.Dotnet