Swagger UI and OpenAPI in Dotnet 9
Detailed Documentation: Using OpenApi Documents
Install NuGet Package: Swashbuckle.AspNetCore.SwaggerUI
// add OpenApi document generationbuilder.Services.AddOpenApi();
var app = builder.Build();
// Configure the HTTP request pipeline.if (app.Environment.IsDevelopment()){ // enable the OpenApi document endpoint app.MapOpenApi();
// enable Swagger UI based on the OpenApi document app.UseSwaggerUI(options => { options.SwaggerEndpoint("/openapi/v1.json", "v1"); });}