Describe the bug
When deserializing default value from a YAML document and that value is null it is converted to a JsonValue of kind string with the value of "null" making it ambiguous. In actuality it should result in a null JsonNode. Furthermore, there is no way to distinguish between an unset default value and a default value of null since JsonNode cannot represent a JSON null value beyond being null itself.
OpenApi File To Reproduce
https://api.ynab.com/papi/open_api_spec.yaml
Expected behavior
Default would return null instead of a JsonValue of kind string when deserializing from YAML and an additional property should be added such as DefaultIsNull. Alternatively, the type for the Default property should perhaps be changed to JsonElement with correct type deserialization.
Screenshots/Code Snippets
Currently have this workaround which tries to guess whether Default should be considered a null value or a string of "null".
var valueKind = property.Default.GetValueKind();
if (valueKind is JsonValueKind.String
&& property.Default.GetValue<string>() == "null"
&& property.Type is not null
&& (!property.Type.Value.HasFlag(JsonSchemaType.String) || property.Type.Value.HasFlag(JsonSchemaType.Null)))
valueKind = JsonValueKind.Null;
Describe the bug
When deserializing
defaultvalue from a YAML document and that value isnullit is converted to aJsonValueof kind string with the value of "null" making it ambiguous. In actuality it should result in anullJsonNode. Furthermore, there is no way to distinguish between an unsetdefaultvalue and adefaultvalue ofnullsinceJsonNodecannot represent a JSONnullvalue beyond beingnullitself.OpenApi File To Reproduce
https://api.ynab.com/papi/open_api_spec.yaml
Expected behavior
Defaultwould returnnullinstead of aJsonValueof kind string when deserializing from YAML and an additional property should be added such asDefaultIsNull. Alternatively, the type for theDefaultproperty should perhaps be changed toJsonElementwith correct type deserialization.Screenshots/Code Snippets
Currently have this workaround which tries to guess whether Default should be considered a
nullvalue or a string of "null".