You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The [`Microsoft.AspNetCore.OpenApi`](https://www.nuget.org/packages/Microsoft.AspNetCore.OpenApi) package provides built-in support for OpenAPI document generation in ASP.NET Core. The package provides the following features:
16
16
17
+
* Support for generating [OpenAPI version 3.1] documents.
18
+
* Support for [JSON Schema draft 2020-12].
17
19
* Support for generating OpenAPI documents at run time and accessing them via an endpoint on the app.
18
20
* Support for "transformer" APIs that allow modifying the generated document.
19
21
* Support for generating multiple OpenAPI documents from a single app.
20
22
* Takes advantage of JSON schema support provided by [`System.Text.Json`](/dotnet/api/system.text.json).
21
23
* Is compatible with native AoT.
22
24
25
+
[OpenAPI version 3.1]: https://spec.openapis.org/oas/v3.1.1.html
The default OpenAPI version for generated documents is`3.1`. The version can be changed by explicitly setting the [OpenApiVersion](/dotnet/api/microsoft.aspnetcore.openapi.openapioptions.openapiversion) property of the [OpenApiOptions](/dotnet/api/microsoft.aspnetcore.openapi.openapioptions) in the `configureOptions` delegate parameter of [AddOpenApi](/dotnet/api/microsoft.extensions.dependencyinjection.openapiservicecollectionextensions.addopenapi):
When generating the OpenAPI document at build time, the OpenAPI version can be selected by setting the `--openapi-version` in the `OpenApiGenerateDocumentsOptions` MSBuild item.
39
+
40
+
```xml
41
+
<!-- Configure build-time OpenAPI generation to produce an OpenAPI 3.1 document. -->
Install the `Microsoft.AspNetCore.OpenApi` package:
@@ -81,12 +103,12 @@ GET http://localhost:5000/openapi/internal.json
81
103
82
104
### Customize the OpenAPI version of a generated document
83
105
84
-
By default, OpenAPI document generation creates a document that is compliant with [v3.0 of the OpenAPI specification](https://spec.openapis.org/oas/v3.0.0). The following code demonstrates how to modify the default version of the OpenAPI document:
106
+
By default, OpenAPI document generation creates a document that is compliant with [OpenAPI version 3.1](https://spec.openapis.org/oas/v3.1.1.html). The following code demonstrates how to modify the default version of the OpenAPI document:
0 commit comments