Microsoft.OpenApi
3.11.0
Prefix Reserved
dotnet add package Microsoft.OpenApi --version 3.11.0
NuGet\Install-Package Microsoft.OpenApi -Version 3.11.0
<PackageReference Include="Microsoft.OpenApi" Version="3.11.0" />
<PackageVersion Include="Microsoft.OpenApi" Version="3.11.0" />
<PackageReference Include="Microsoft.OpenApi" />
paket add Microsoft.OpenApi --version 3.11.0
#r "nuget: Microsoft.OpenApi, 3.11.0"
#:package Microsoft.OpenApi@3.11.0
#addin nuget:?package=Microsoft.OpenApi&version=3.11.0
#tool nuget:?package=Microsoft.OpenApi&version=3.11.0

OpenAPI.NET
| Package | Nuget |
|---|---|
| Models and Writers | |
| YamlReader |
The OpenAPI.NET SDK contains a useful object model for OpenAPI documents in .NET along with common serializers to extract raw OpenAPI JSON and YAML documents from the model.
See more information on the OpenAPI specification and its history here: <a href="https://www.openapis.org">OpenAPI Initiative</a>
Project Objectives:
- Provide a single shared object model in .NET for OpenAPI descriptions.
- Include the most primitive Reader for ingesting OpenAPI JSON and YAML documents in both V2 and V3 formats.
- Provide OpenAPI description writers for both V2 and V3 specification formats.
- Enable developers to create Readers that translate different data formats into OpenAPI descriptions.
Installation
- Install core Nuget package Microsoft.OpenApi
- Install Yaml Reader Nuget package Microsoft.OpenApi.YamlReader
Note: we just released a new major version of the library, which brings support for OpenAPI 3.2! You can read more about the changes of this upcoming version in the upgrade guide.
Processors
The OpenAPI.NET project holds the base object model for representing OpenAPI documents as .NET objects. Some developers have found the need to write processors that convert other data formats into this OpenAPI.NET object model. We'd like to curate that list of processors in this section of the readme.
The base JSON and YAML processors are built into this project. Below is the list of the other supported processor projects.
C# Comment / Annotation Processor : Converts standard .NET annotations ( /// comments ) emitted from your build (MSBuild.exe) into OpenAPI.NET document object.
OData CSDL Processor : Converts the XML representation of the Entity Data Model (EDM) describing an OData Service into OpenAPI.NET document object.
Example Usage
Creating an OpenAPI Document
var document = new OpenApiDocument
{
Info = new OpenApiInfo
{
Version = "1.0.0",
Title = "Swagger Petstore (Simple)",
},
Servers = new List<OpenApiServer>
{
new OpenApiServer { Url = "http://petstore.swagger.io/api" }
},
Paths = new OpenApiPaths
{
["/pets"] = new OpenApiPathItem
{
Operations = new()
{
[HttpMethod.Get] = new OpenApiOperation
{
Description = "Returns all pets from the system that the user has access to",
Responses = new OpenApiResponses
{
["200"] = new OpenApiResponse
{
Description = "OK"
}
}
}
}
}
}
};
Reading and writing an OpenAPI description
var (openApiDocument, _) = await OpenApiDocument.LoadAsync("https://raw.githubusercontent.com/OAI/OpenAPI-Specification/refs/heads/main/_archive_/schemas/v3.0/pass/petstore.yaml");
// Write V2 as JSON
var outputString = await openApiDocument.SerializeAsJsonAsync(OpenApiSpecVersion.OpenApi2_0);
Validating/Testing OpenAPI descriptions
Microsoft.OpenApi.Hidi is a command line tool for validating and transforming OpenAPI descriptions. The OpenAPI.NET v3-compatible tool is maintained in OpenAPI.NET.OData's main branch. See its installation guidelines and documentation.
Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
To provide feedback and ask questions you can use Stack Overflow with the OpenAPI.NET tag.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- System.Text.Json (>= 8.0.5)
-
net8.0
- No dependencies.
NuGet packages (767)
Showing the top 5 NuGet packages that depend on Microsoft.OpenApi:
| Package | Downloads |
|---|---|
|
Swashbuckle.AspNetCore.Swagger
Middleware to expose Swagger JSON endpoints from APIs built on ASP.NET Core |
|
|
Microsoft.AspNetCore.OpenApi
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/5254d8bcf59917edc1e1abc33bdf2442b77b1c70 |
|
|
Microsoft.OpenApi.Readers
OpenAPI.NET Readers for JSON and YAML documents |
|
|
MassTransit.AspNetCore
MassTransit AspNetCore Support, including Dashboard; MassTransit provides a developer-focused, modern platform for creating distributed applications without complexity. |
|
|
Microsoft.Azure.WebJobs.Extensions.OpenApi.Core
This package helps render OpenAPI document and Swagger UI of Azure Functions endpoints through the in-process worker. |
GitHub repositories (2)
Showing the top 2 popular GitHub repositories that depend on Microsoft.OpenApi:
| Repository | Stars |
|---|---|
|
microsoft/semantic-kernel
Integrate cutting-edge LLM technology quickly and easily into your apps
|
|
|
dotnet/eShop
A reference .NET application implementing an eCommerce site
|
| Version | Downloads | Last Updated |
|---|---|---|
| 3.11.0 | 80,493 | 10/19/2026 |
| 3.10.2 | 1,030,647 | 8/20/2026 |
| 3.10.0 | 257,311 | 8/12/2026 |
| 3.9.0 | 603,282 | 7/15/2026 |
| 3.8.0 | 363,267 | 7/6/2026 |
| 3.7.0 | 941,197 | 6/10/2026 |
| 3.6.0 | 205,957 | 6/1/2026 |
| 3.5.5 | 70,707 | 5/29/2026 |
| 2.13.0 | 155,617 | 10/19/2026 |
| 2.12.2 | 6,216,668 | 8/20/2026 |
| 2.12.1 | 30,764 | 8/20/2026 |
| 2.12.0 | 7,697,731 | 8/12/2026 |
| 2.11.0 | 4,237,890 | 7/15/2026 |
| 2.10.0 | 2,266,362 | 7/6/2026 |
| 2.9.0 | 4,735,825 | 6/10/2026 |
| 2.8.0 | 306,812 | 6/1/2026 |
| 2.7.6 | 1,037,376 | 5/29/2026 |
| 2.7.5 | 57,835,331 | 5/26/2026 |
| 1.6.31 | 562,692 | 8/20/2026 |
| 1.6.30 | 504,080 | 8/13/2026 |