![]() |
VOOZH | about |
dotnet add package Microsoft.OpenApi --version 3.7.0
NuGet\Install-Package Microsoft.OpenApi -Version 3.7.0
<PackageReference Include="Microsoft.OpenApi" Version="3.7.0" />
<PackageVersion Include="Microsoft.OpenApi" Version="3.7.0" />Directory.Packages.props
<PackageReference Include="Microsoft.OpenApi" />Project file
paket add Microsoft.OpenApi --version 3.7.0
#r "nuget: Microsoft.OpenApi, 3.7.0"
#:package Microsoft.OpenApi@3.7.0
#addin nuget:?package=Microsoft.OpenApi&version=3.7.0Install as a Cake Addin
#tool nuget:?package=Microsoft.OpenApi&version=3.7.0Install as a Cake Tool
| Package | Nuget |
|---|---|
| Models and Writers | 👁 nuget |
| YamlReader | 👁 nuget |
| Hidi | 👁 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: <a href="https://www.openapis.org">OpenAPI Initiative</a>
Project Objectives:
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 .
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.
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);
In order to test the validity of an OpenApi document, we avail the following tools:
A commandline tool for validating and transforming OpenAPI descriptions. Installation guidelines and documentation
Microsoft.OpenApi.Workbench
A workbench tool consisting of a GUI where you can test and convert OpenAPI descriptions in both JSON and YAML from v2-->v3 and vice versa.
git clone https://github.com/microsoft/OpenAPI.NET.git(.slnx) in the root of the project with Visual Studiosrc/Microsoft.OpenApi.Workbench directory and set it as the startup project👁 a screenshot of the workbench application
Convert to render the results.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 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 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
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/f7b4c5716faaee8fb8a289aed29118cad955c45f |
|
|
Microsoft.OpenApi.Readers
OpenAPI.NET Readers for JSON and YAML documents |
|
|
Microsoft.Azure.WebJobs.Extensions.OpenApi.Core
This package helps render OpenAPI document and Swagger UI of Azure Functions endpoints through the in-process worker. |
|
|
Microsoft.OpenApi.OData
This package contains the codes you need to convert OData CSDL to Open API Document of Model. |
Showing the top 20 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
|
|
|
AssetRipper/AssetRipper
GUI application to analyze game files
|
|
|
microsoft/aspire
Aspire is the tool for code-first, extensible, observable dev and deploy.
|
|
|
ServiceStack/ServiceStack
Thoughtfully architected, obscenely fast, thoroughly enjoyable web services for all
|
|
|
domaindrivendev/Swashbuckle.AspNetCore
Swagger tools for documenting API's built on ASP.NET Core
|
|
|
microsoft/kiota
OpenAPI based HTTP Client code generator
|
|
|
evolutionary-architecture/evolutionary-architecture-by-example
Navigate the complex landscape of .NET software architecture with our step-by-step, story-like guide. Unpack the interplay between modular monoliths, microservices, domain-driven design, and various architectural patterns. Go beyond the one-size-fits-all solutions and understand how to blend these approaches based on your unique needs.
|
|
|
microsurging/surging
Surging is a micro-service engine that provides a lightweight, high-performance, modular RPC request pipeline. support Event-based Asynchronous Pattern and reactive programming.
|
|
|
dotnet/aspnet-api-versioning
Provides a set of libraries which add service API versioning to ASP.NET Web API, OData with ASP.NET Web API, and ASP.NET Core.
|
|
|
davidfowl/TodoApp
Todo application with ASP.NET Core Blazor WASM, Minimal APIs and Authentication
|
|
|
microsoft/dotnet-podcasts
.NET reference application shown at .NET Conf featuring ASP.NET Core, Blazor, .NET MAUI, Microservices, Orleans, Playwright, and more!
|
|
|
wiremock/WireMock.Net
WireMock.Net is a flexible product for stubbing and mocking web HTTP responses using advanced request matching and response templating. Based on WireMock Java, but extended and different functionality. Full documentation can be found at https://wiremock.org/dotnet/.
|
|
|
smartstore/Smartstore
A modular, scalable and ultra-fast open-source all-in-one eCommerce platform built on ASP.NET Core 10
|
|
|
Azure/data-api-builder
Data API builder provides modern REST, GraphQL endpoints and MCP tools to your Azure Databases and on-prem stores.
|
|
|
CoreUnion/CoreShop
基于 Asp.Net Core 9.0、Uni-App开发,支持可视化布局的小程序商城系统,前后端分离,支持分布式部署,跨平台运行,拥有分销、代理、团购、拼团、秒杀、直播、优惠券、自定义表单等众多营销功能,拥有完整SKU、下单、售后、物流流程。支持一套代码编译发布微信小程序版、H5版、Android版、iOS版、支付宝小程序版、字节跳动小程序版、QQ小程序版等共10个平台。
|
|
|
VirtoCommerce/vc-platform
Virto Commerce B2B Innovation Platform
|
|
|
aspnet/AspLabs
Repo for ASP.NET experiments that are not ready for a production release
|
|
|
dotnet/dotnet
Home of .NET's Virtual Monolithic Repository which includes all the code needed to build the .NET SDK.
|
|
|
MUnique/OpenMU
This project aims to create an easy to use, extendable and customizable server for a MMORPG called "MU Online".
|