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
Copy file name to clipboardExpand all lines: aspnetcore/fundamentals/openapi/include-metadata.md
+10-9Lines changed: 10 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -619,24 +619,19 @@ public enum DayOfTheWeekAsString
619
619
}
620
620
```
621
621
622
-
A special case is when an enum type has the `[Flags]` attribute, which indicates that the enum can be treated as a bit field; that is, a set of flags. A flags enum with a `[JsonConverterAttribute]` is defined as `type: string` in the generated schema with no `enum` property, since the value could be any combination of the enum values. For example, the following enum:
622
+
A special case is when an enum type has the `[Flags]` attribute, which indicates that the enum can be treated as a bit field; that is, a set of flags. A flags `enum` with a `[JsonConverterAttribute]` is defined as `type: string` in the generated schema with no `enum` property. No `enum` property is generated because the value could be any combination of the enum values. For example, the following `enum` could have values such as `"Pepperoni, Sausage"` or `"Sausage, Mushrooms, Anchovies"`:
could have values such as `"Pepperoni, Sausage"` or `"Sausage, Mushrooms, Anchovies"`.
630
-
631
629
An enum type without a [`[JsonConverter]`](xref:System.Text.Json.Serialization.JsonConverterAttribute) will be defined as `type: integer` in the generated schema.
632
630
633
-
**Note:** The [`[AllowedValues]`](xref:System.ComponentModel.DataAnnotations.AllowedValuesAttribute) attribute does not set the `enum` values of a property.
634
-
635
-
The following code shows how to configure JSON options globally, for Minimal APIs and Controler based APIs:
* The [`[AllowedValues]`](xref:System.ComponentModel.DataAnnotations.AllowedValuesAttribute) attribute does not set the `enum` values of a property.
634
+
* zz can be set globally, see
640
635
641
636
#### nullable
642
637
@@ -674,6 +669,12 @@ An abstract class with a [`[JsonPolymorphic]`](xref:System.Text.Json.Serializati
674
669
675
670
A schema transformer can be used to override any default metadata or add additional metadata, such as `example` values, to the generated schema. See [Use schema transformers](xref:fundamentals/openapi/customize-openapi#use-schema-transformers) for more information.
676
671
672
+
## Set JSON serialization options globally
673
+
674
+
The following code shows how to configure JSON options globally, for Minimal APIs and Controler based APIs:
0 commit comments