|
{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} = {{>OptionProperty}}JsonSerializer.Deserialize<DateTime{{#useDateTimeOffset}}Offset{{/useDateTimeOffset}}{{#isNullable}}?{{/isNullable}}>(ref utf8JsonReader, jsonSerializerOptions)); |
OptionProperty.mustache uses x-is-value-type to decide if ? is needed.
JsonConverter.mustache uses isNullable from the OpenAPI spec for the same decision on the same property.
Consequence is that marking a DateTime field nullable: true in spec has zero effect on the deserialization path — the non-nullable converter is used regardless.
Proposed fix is to mark all value types as nullable, which would match the contract set in the OptionProperty.mustache (which sets the value types as nullable).
openapi-generator/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/JsonConverter.mustache
Line 224 in d11d0ef
OptionProperty.mustache uses
x-is-value-typeto decide if?is needed.JsonConverter.mustache uses
isNullablefrom the OpenAPI spec for the same decision on the same property.Consequence is that marking a
DateTimefieldnullable: truein spec has zero effect on the deserialization path — the non-nullable converter is used regardless.Proposed fix is to mark all value types as nullable, which would match the contract set in the OptionProperty.mustache (which sets the value types as nullable).