Skip to content

Commit 50d78ec

Browse files
Update OpenAPI document generation details (#35215)
* Update OpenAPI document generation details * Format openApi.md for better readability
1 parent fa44e88 commit 50d78ec

File tree

1 file changed

+2
-2
lines changed
  • aspnetcore/release-notes/aspnetcore-10/includes

1 file changed

+2
-2
lines changed

aspnetcore/release-notes/aspnetcore-10/includes/openApi.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ Some of the changes you will see in the generated OpenAPI document include:
1111

1212
* Nullable types no longer have the `nullable: true` property in the schema.
1313
* Instead of a `nullable: true` property, they have a `type` keyword whose value is an array that includes `null` as one of the types.
14-
* Properties or parameters defined as a C# `int` or `long` may now appear in the generated OpenAPI document without the `type: integer` field
14+
* Properties or parameters defined as a C# `int` or `long` now appear in the generated OpenAPI document without the `type: integer` field
1515
and have a `pattern` field limiting the value to digits.
16-
This happens when the <xref:System.Text.Json.JsonSerializerOptions.NumberHandling> property in the <xref:System.Text.Json.JsonSerializerOptions> is set to `AllowReadingFromString` -- the default for ASP.NET Core Web applications. If you want C# `int` and `long` to be represented in the OpenAPI as `type: integer`, you should set the <xref:System.Text.Json.JsonSerializerOptions.NumberHandling> property to `Strict`.
16+
This happens when the <xref:System.Text.Json.JsonSerializerOptions.NumberHandling> property in the <xref:System.Text.Json.JsonSerializerOptions> is set to `AllowReadingFromString`, the default for ASP.NET Core Web apps. To enable C# `int` and `long` to be represented in the OpenAPI as `type: integer`, set the <xref:System.Text.Json.JsonSerializerOptions.NumberHandling> property to `Strict`.
1717

1818
With this feature, 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).
1919

0 commit comments

Comments
 (0)