[relayedauthorizationwebhooks] Code generation: update services and models#1708
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates several models within the RelayedAuthorizationWebhooks namespace to improve the handling of unknown enum values during JSON deserialization by preserving raw values through explicit casting. Review feedback highlights that the new discriminator check in PaymentInstrumentAdditionalBankAccountIdentificationsInner.cs is overly restrictive and breaks forward compatibility, contradicting the patterns used in other models. Additionally, the assignment logic in AuthorisationDecisionResponse.cs needs validation to ensure that null values are not assigned to the non-nullable Status property, which could lead to an invalid object state.
| } | ||
|
|
||
| if (ibanAccountIdentification?.Type != null) | ||
| if (ibanAccountIdentification?.Type != null && IbanAccountIdentification.TypeEnum.FromStringOrDefault((string?)ibanAccountIdentification.Type) != null) |
There was a problem hiding this comment.
This stricter discriminator check breaks forward compatibility. If the API introduces a new account identification type, this method will throw a JsonException instead of potentially allowing the use of the existing model or skipping the unknown item. This contradicts the improvements made in other models (e.g., AmountAdjustment) where unknown enum values are now preserved via the Value property and explicit casting.
if (ibanAccountIdentification?.Type != null)|
|
||
| var authorisationDecisionResponse = new AuthorisationDecisionResponse(); | ||
| authorisationDecisionResponse.Status = status.Value!.Value; | ||
| authorisationDecisionResponse.Status = status.Value!; |
There was a problem hiding this comment.
The assignment status.Value! can result in a null value being assigned to the non-nullable Status property if the JSON contains an explicit null value (e.g., "status": null). While the previous version (status.Value!.Value) would have thrown a NullReferenceException during deserialization, the new code allows the object to be created in an invalid state. Consider validating that status.Value is not null before assignment to ensure the required property is correctly populated.
This PR contains the automated changes for the
relayedauthorizationwebhooksservice.The commit history of this PR reflects the
adyen-openapicommits that have been applied.