Context
In auto-generated model classes, DateTimeOffset? fields (optional dates) are deserialized using the non-nullable type:
createdAt = new Option<DateTimeOffset?>(JsonSerializer.Deserialize<DateTimeOffset>(ref utf8JsonReader, jsonSerializerOptions));
System.Text.Json throws a JsonException when the JSON value is null and the target type is non-nullable DateTimeOffset. This pattern exists in 174 occurrences across all services (ConfigurationWebhooks, Transfers, BalancePlatform, Checkout, etc.).
This is low priority since the Adyen API typically omits optional date fields rather than sending explicit null, but it is a latent runtime crash waiting to happen.
Proposed Change
Update the code generator template to use the nullable type in Deserialize<T> when the target property is T?:
createdAt = new Option<DateTimeOffset?>(JsonSerializer.Deserialize<DateTimeOffset?>(ref utf8JsonReader, jsonSerializerOptions));
The fix belongs in the adyen-sdk-automation generator template, not in the library itself, since these files are auto-generated and manual edits would be overwritten.
Benefit
Prevents a JsonException crash when an optional date field is explicitly present as null in a webhook payload.
Context
In auto-generated model classes,
DateTimeOffset?fields (optional dates) are deserialized using the non-nullable type:System.Text.Jsonthrows aJsonExceptionwhen the JSON value isnulland the target type is non-nullableDateTimeOffset. This pattern exists in 174 occurrences across all services (ConfigurationWebhooks, Transfers, BalancePlatform, Checkout, etc.).This is low priority since the Adyen API typically omits optional date fields rather than sending explicit
null, but it is a latent runtime crash waiting to happen.Proposed Change
Update the code generator template to use the nullable type in
Deserialize<T>when the target property isT?:The fix belongs in the
adyen-sdk-automationgenerator template, not in the library itself, since these files are auto-generated and manual edits would be overwritten.Benefit
Prevents a
JsonExceptioncrash when an optional date field is explicitly present asnullin a webhook payload.