@@ -1163,18 +1163,27 @@ Use <xref:System.Text.Json.Serialization.ReferenceHandler.Preserve> to enable un
1163
1163
<value >To be added.</value >
1164
1164
<remarks >
1165
1165
<para >
1166
- Nullability annotations are resolved from the properties, fields and constructor parameters
1166
+ Configures the serializer to throw an exception when trying to serialize a <see langword =" null" /> value from a non-nullable property getter,
1167
+ or when deserializing a <see langword =" null" /> value into a non-nullable property setter or constructor parameter.
1168
+ Nullability annotations are resolved from the properties, fields, and constructor parameters
1167
1169
that are used by the serializer. This includes annotations stemming from attributes such as
1168
1170
<see cref =" T:System.Diagnostics.CodeAnalysis.NotNullAttribute" />, <see cref =" T:System.Diagnostics.CodeAnalysis.MaybeNullAttribute" />,
1169
1171
<see cref =" T:System.Diagnostics.CodeAnalysis.AllowNullAttribute" /> and <see cref =" T:System.Diagnostics.CodeAnalysis.DisallowNullAttribute" />.
1170
1172
</para >
1171
1173
<para >
1172
1174
Due to restrictions in how nullable reference types are represented at run time,
1173
- this setting only governs nullability annotations of non-generic properties and fields .
1175
+ this setting only governs nullability annotations of non-generic properties, fields, and constructor parameters .
1174
1176
It cannot be used to enforce nullability annotations of root-level types, collection elements, or generic parameters.
1175
1177
The default setting for this property can be toggled application-wide using the
1176
1178
"System.Text.Json.Serialization.RespectNullableAnnotationsDefault" feature switch.
1177
1179
</para >
1180
+ <para >
1181
+ Nullability validation functions independently of required-ness validation,
1182
+ that is to say the setting has no effect in scenaria where the payload is missing a required property.
1183
+ This can be configured independently using the <see langword =" required" /> keyword,
1184
+ the <see cref =" P:System.Text.Json.Serialization.JsonRequiredAttribute" /> attribute,
1185
+ or the <see cref =" P:System.Text.Json.JsonSerializerOptions.RespectRequiredConstructorParameters" /> property.
1186
+ </para >
1178
1187
<para >
1179
1188
It is recommended that new applications always set this property to <see langword =" true" />,
1180
1189
in combination with the closely related <see cref =" P:System.Text.Json.JsonSerializerOptions.RespectRequiredConstructorParameters" /> property.
0 commit comments