Microsoft.OpenApi 2.13.0

Category overview screenshot

OpenAPI.NET

Package Nuget
Models and Writers nuget
YamlReader nuget

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: OpenAPI Initiative

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

Note: we just released a new major version of the library, which brings support for OpenAPI 3.1! 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 v2-compatible tool is maintained in OpenAPI.NET.OData's support/v2 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.

Showing the top 20 packages that depend on Microsoft.OpenApi.

Packages Downloads
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/aspnetcore/tree/3dfc6fda80a10797b8c8fda1970e7b377fd8ed8d
33
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/aspnetcore/tree/7c810658463f35c39c54d5fb8a8dbbfd463bf747
31
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/aspnetcore/tree/8486d31e24f30e3fa1809a95699a0adc16f448d7
31
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/aspnetcore/tree/d47e49e9c1e173ac90821f7e89cc38e710274241
30
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/aspnetcore/tree/e56abc45c4f8adc518abfc11a59849d616431e2c
32
Swashbuckle.AspNetCore.Swagger
Middleware to expose Swagger JSON endpoints from APIs built on ASP.NET Core
30
Swashbuckle.AspNetCore.Swagger
Middleware to expose Swagger JSON endpoints from APIs built on ASP.NET Core
31
Swashbuckle.AspNetCore.Swagger
Middleware to expose Swagger JSON endpoints from APIs built on ASP.NET Core
32
Swashbuckle.AspNetCore.Swagger
Middleware to expose Swagger JSON endpoints from APIs built on ASP.NET Core
36
Swashbuckle.AspNetCore.Swagger
Middleware to expose Swagger JSON endpoints from APIs built on ASP.NET Core
133
Swashbuckle.AspNetCore.Swagger
Middleware to expose Swagger JSON endpoints from APIs built on ASP.NET Core
232
Swashbuckle.AspNetCore.Swagger
Middleware to expose Swagger JSON endpoints from APIs built on ASP.NET Core
447
Swashbuckle.AspNetCore.Swagger
Middleware to expose Swagger JSON endpoints from API's built on ASP.NET Core
31
Swashbuckle.AspNetCore.Swagger
Middleware to expose Swagger JSON endpoints from API's built on ASP.NET Core
39
Swashbuckle.AspNetCore.SwaggerGen
Swagger Generator for API's built on ASP.NET Core
38

https://github.com/microsoft/OpenAPI.NET/releases

.NET 8.0

  • No dependencies.

.NET Standard 2.0

Version Downloads Last updated
3.11.0 3 10/26/2026
3.10.2 8 09/05/2026
3.10.0 4 09/05/2026
3.9.0 4 07/30/2026
3.8.0 2 08/03/2026
3.7.0 6 06/22/2026
3.6.0 6 06/08/2026
3.5.5 7 06/08/2026
3.5.4 8 06/08/2026
3.5.3 14 04/27/2026
3.5.2 16 04/27/2026
3.5.1 13 04/04/2026
3.5.0 15 03/26/2026
3.4.0 14 03/07/2026
3.3.1 12 01/27/2026
3.3.0 11 01/27/2026
3.2.0 25 01/21/2026
3.1.3 18 01/20/2026
3.1.2 14 01/09/2026
3.1.1 15 12/20/2025
3.0.3 20 12/21/2025
3.0.2 19 12/11/2025
3.0.1 19 11/20/2025
3.0.0 20 11/15/2025
2.13.0 2 10/26/2026
2.12.2 3 09/05/2026
2.12.1 3 09/05/2026
2.12.0 3 09/05/2026
2.11.0 4 07/28/2026
2.10.0 2 08/03/2026
2.9.0 10 06/22/2026
2.8.0 8 06/08/2026
2.7.6 14 06/08/2026
2.7.5 16 06/08/2026
2.7.4 16 04/27/2026
2.7.3 11 04/28/2026
2.7.2 6 04/05/2026
2.7.1 9 03/26/2026
2.7.0 12 03/07/2026
2.6.1 17 01/27/2026
2.6.0 17 01/26/2026
2.5.0 17 01/21/2026
2.4.3 14 01/21/2026
2.4.2 18 01/08/2026
2.4.1 14 12/21/2025
2.4.0 15 12/21/2025
2.3.12 14 12/21/2025
2.3.11 15 12/11/2025
2.3.10 21 11/20/2025
2.3.9 20 11/09/2025
2.3.8 17 11/05/2025
2.3.7 21 10/27/2025
2.3.6 21 10/23/2025
2.3.5 20 10/21/2025
2.3.4 20 10/08/2025
2.3.3 24 10/06/2025
2.3.2 25 09/21/2025
2.3.1 16 09/11/2025
2.3.0 18 08/29/2025
2.2.0 22 08/28/2025
2.1.0 25 08/22/2025
2.0.1 25 08/23/2025
2.0.0 26 07/11/2025
2.0.0-preview9 27 02/26/2025
2.0.0-preview8 30 02/18/2025
2.0.0-preview7 28 02/18/2025
2.0.0-preview6 28 02/18/2025
2.0.0-preview5 26 01/31/2025
2.0.0-preview4 21 01/19/2025
2.0.0-preview3 25 01/19/2025
2.0.0-preview2 21 01/31/2025
2.0.0-preview10 20 03/07/2025
2.0.0-preview1 29 01/19/2025
2.0.0-preview.31 20 07/11/2025
2.0.0-preview.30 22 07/11/2025
2.0.0-preview.29 23 06/27/2025
2.0.0-preview.28 17 06/27/2025
2.0.0-preview.27 20 06/27/2025
2.0.0-preview.26 25 06/27/2025
2.0.0-preview.25 21 06/27/2025
2.0.0-preview.23 19 06/09/2025
2.0.0-preview.22 28 06/09/2025
2.0.0-preview.21 23 06/27/2025
2.0.0-preview.20 24 06/09/2025
2.0.0-preview.19 23 05/18/2025
2.0.0-preview.18 27 05/18/2025
2.0.0-preview.17 24 04/27/2025
2.0.0-preview.16 18 04/04/2025
2.0.0-preview.15 25 04/04/2025
2.0.0-preview.14 24 04/04/2025
2.0.0-preview.13 33 04/04/2025
2.0.0-preview.12 26 03/07/2025
2.0.0-preview.11 23 03/07/2025
1.6.31 4 09/05/2026
1.6.30 6 09/05/2026
1.6.29 14 04/16/2026
1.6.28 24 10/08/2025
1.6.27 25 10/07/2025
1.6.26 20 09/25/2025
1.6.25 20 08/24/2025
1.6.24 32 04/04/2025
1.6.23 22 01/19/2025
1.6.22 30 01/19/2025
1.6.21 30 01/19/2025
1.6.18 21 01/19/2025
1.6.17 24 01/19/2025
1.6.16 26 01/19/2025
1.6.15 23 01/19/2025
1.6.14 134 03/27/2024
1.6.13 34 03/02/2024
1.6.12 25 03/02/2024
1.6.11 24 03/02/2024
1.6.10 35 03/03/2024
1.6.9 32 01/07/2024
1.6.8 29 03/02/2024
1.6.7 34 03/01/2024
1.6.6 33 03/01/2024
1.6.5 29 03/02/2024
1.6.4 34 03/03/2024
1.6.4-preview4 31 03/05/2024
1.6.4-preview3 29 03/05/2024
1.6.4-preview2 32 03/04/2024
1.6.4-preview1 30 03/05/2024
1.6.3 32 03/01/2024
1.6.2 28 02/08/2024
1.6.1 32 01/01/2024
1.6.0 33 03/01/2024
1.5.0 33 03/02/2024
1.4.5 38 03/24/2024
1.4.4 34 03/02/2024
1.4.4-preview1 25 03/06/2024
1.4.3 48 09/20/2023
1.4.2 28 01/02/2024
1.4.1 26 03/02/2024
1.4.0 35 03/03/2024
1.4.0-preview3 34 03/06/2024
1.4.0-preview2 24 03/06/2024
1.4.0-preview1 33 03/06/2024
1.3.2 37 03/12/2024
1.3.1 38 03/13/2024
1.3.1-preview6 29 03/10/2024
1.3.1-preview5 29 02/28/2024
1.3.1-preview4 32 03/09/2024
1.3.1-preview3 30 11/13/2023
1.3.1-preview2 25 03/09/2024
1.3.1-preview 33 03/06/2024
1.3.0-preview 34 03/04/2024
1.2.3 620 08/18/2023
1.2.2 30 03/12/2024
1.2.1 39 03/25/2024
1.2.0 36 12/20/2023
1.2.0-preview.3 29 03/04/2024
1.2.0-preview.2 24 03/04/2024
1.2.0-preview 37 03/04/2024
1.1.4 30 08/18/2023
1.1.3 32 03/02/2024
1.1.2 35 03/02/2024
1.1.1 30 08/18/2023
1.1.0 34 03/01/2024
1.1.0-preview.4 26 03/06/2024
1.1.0-preview.3 29 03/06/2024
1.1.0-preview.2 23 03/06/2024
1.1.0-preview.1 31 03/05/2024
1.0.1 34 03/12/2024
1.0.0 33 03/02/2024
1.0.0-beta017 25 03/02/2024
1.0.0-beta016 28 03/13/2024
1.0.0-beta015 29 03/03/2024
1.0.0-beta014 27 03/03/2024
1.0.0-beta013 36 03/08/2024
1.0.0-beta012 29 03/03/2024
1.0.0-beta011 26 03/13/2024
1.0.0-beta010 25 01/19/2025
1.0.0-beta009 27 03/03/2024
1.0.0-beta008 33 03/06/2024