Skip to main content
net9.0

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/aspnetcore/tree/b4d87e3b9131a019bc3b51df99ff69ac79bef459

Published
Oct 13, 2026
8d ago
Total Downloads
246.3M
246,317,261

Install

dotnet add package Microsoft.AspNetCore.OpenApi --version 9.0.21
ProductVersions
.NET
net9.0

README

About

Microsoft.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.

Key Features

  • Supports viewing generated OpenAPI documents at runtime via a parameterized endpoint (/openapi/{documentName}.json)
  • Supports generating an OpenAPI document at build-time
  • Supports customizing the generated document via document transformers

How to Use

To start using Microsoft.AspNetCore.OpenApi in your ASP.NET Core application, follow these steps:

Installation

dotnet add package Microsoft.AspNetCore.OpenApi

Configuration

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.

Main Types

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.

Feedback & Contributing

Microsoft.AspNetCore.OpenApi is released as open-source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.

Changes from Previous Version

No structural changes between v9.0.20 and v9.0.21.

Adoption Assessment

Teams staying close to first-party ASP.NET Core primitives and minimal external framework layering.

ASP.NET Core Guide
Compatibility metadata lists 1 target framework; confirm the exact target used by your application.
Editorial Note: First-party OpenAPI generation support aligned with modern ASP.NET Core hosting patterns. Trade-off: Feature customization depth may require additional conventions or complementary packages.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.