Skip to content

Commit 66c1d0c

Browse files
committed
config JsonOptions globally /3
1 parent f79e278 commit 66c1d0c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

aspnetcore/fundamentals/openapi/include-metadata.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ An enum type without a [`[JsonConverter]`](xref:System.Text.Json.Serialization.
631631
**Note:**
632632

633633
* The [`[AllowedValues]`](xref:System.ComponentModel.DataAnnotations.AllowedValuesAttribute) attribute does not set the `enum` values of a property.
634-
* See [Set JSON serialization options globally](#set-json-serialization-options-globally) later in this article.
634+
* See [Set JSON serialization options globally](#set-json-serialization-options-globally), which sets `JsonStringEnumConverter` globally.
635635

636636
#### nullable
637637

@@ -675,6 +675,19 @@ The following code shows how to configure JSON options globally, for Minimal API
675675

676676
[!code-csharp[](~/fundamentals/openapi/samples/10.x/WebJson/Program.cs?highlight=8-19)]
677677

678+
## MVC JSON options and global JSON options
679+
680+
### Key Differences
681+
682+
| **Aspect** | **MVC JSON Options** | **Global JSON Options** |
683+
|-----------------------|--------------------------------------------|-----------------------------------------------|
684+
| **Scope** | Limited to MVC controllers and endpoints. | Minimal Api's and OpenAPI docs. |
685+
| **Configuration** | `AddControllers().AddJsonOptions()` | `Configure<JsonOptions>()` |
686+
| **Purpose** | Handles serialization and deserializtion of JSON requests and responses in APIs. | Defines global JSON handling for Minimal APIs and OpenAPI schemas. |
687+
| **Influence on OpenAPI** | None | Directly influences OpenAPI schema generation.|
688+
689+
---
690+
678691
## Additional resources
679692

680693
* <xref:fundamentals/openapi/using-openapi-documents>

0 commit comments

Comments
 (0)