Skip to main content
net10.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/de35e2b0a0d8d5d1e307907983a6838da1092898

Published
Apr 10, 2025
1y ago
Total Downloads
246.3M
246,317,261

Install

dotnet add package Microsoft.AspNetCore.OpenApi --version 10.0.0-preview.3.25172.1
ProductVersions
.NET
net10.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 v10.0.0-preview.2.25164.1 and v10.0.0-preview.3.25172.1.

Adoption Assessment

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

ASP.NET Core Guide
This version is marked prerelease. Validate its API and upgrade path before production use.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.