Provides APIs for annotating route handler endpoints in ASP.NET Core with OpenAPI annotations. This package was built from the source code at https://github.com/dotnet/dotnet/tree/87bc0b04e21d786669142109a5128c95618b75ed
$ dotnet add package Microsoft.AspNetCore.OpenApiMicrosoft.AspNetCore.OpenApi is a NuGet package that provides built-in support for generating OpenAPI documents from minimal or controller-based APIs in ASP.NET Core.
/openapi/{documentName}.json)To start using Microsoft.AspNetCore.OpenApi in your ASP.NET Core application, follow these steps:
dotnet add package Microsoft.AspNetCore.OpenApi
In your Program.cs file, register the services provided by this package in the DI container and map the provided OpenAPI document endpoint in the application.
var builder = WebApplication.CreateBuilder();
// Registers the required services
builder.Services.AddOpenApi();
var app = builder.Build();
// Adds the /openapi/{documentName}.json endpoint to the application
app.MapOpenApi();
app.Run();
For more information on configuring and using Microsoft.AspNetCore.OpenApi, refer to the official documentation.
The main types provided by this library are:
OpenApiOptions: Options for configuring OpenAPI document generation.IDocumentTransformer: Transformer that modifies the OpenAPI document generated by the library.Microsoft.AspNetCore.OpenApi is released as open-source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.