[management] Code generation: update services and models#850
Conversation
Summary of ChangesHello @AdyenAutomationBot, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request delivers automated code updates for the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a number of changes, including new models and properties, which appear to be auto-generated from an OpenAPI specification. While most changes are additive, there is a recurring critical issue across many files: the error handling for invalid enum values in setters has been changed from throwing an InvalidArgumentException to logging an error with error_log. This change means that the application will no longer fail fast when invalid data is used to construct model objects. Instead, it will silently log an error and continue execution with an object in an invalid state. This can lead to subtle bugs and makes debugging significantly harder. I have added comments on each occurrence of this pattern with a suggestion to revert to throwing an exception to ensure data integrity and robust error handling.
| error_log( | ||
| sprintf( | ||
| "Invalid value '%s' for 'processingType', must be one of '%s'", | ||
| "processingType: unexpected enum value '%s' - Supported values are [%s]", | ||
| $processingType, | ||
| implode("', '", $allowedValues) | ||
| implode(', ', $allowedValues) | ||
| ) | ||
| ); |
There was a problem hiding this comment.
Using error_log instead of throwing an exception for invalid enum values can lead to silent failures. The previous implementation with throw new \InvalidArgumentException was safer as it immediately stopped execution and notified the caller of the invalid data. With error_log, the invalid value is assigned to the property, and the program continues, potentially leading to unexpected behavior and making bugs harder to trace. It is highly recommended to revert to throwing an exception to enforce the model's contract and maintain data integrity.
throw new \InvalidArgumentException(
sprintf(
"processingType: unexpected enum value '%s' - Supported values are [%s]",
$processingType,
implode(', ', $allowedValues)
)
);| error_log( | ||
| sprintf( | ||
| "pricePlan: unexpected enum value '%s' - Supported values are [%s]", | ||
| $pricePlan, | ||
| implode(', ', $allowedValues) | ||
| ) | ||
| ); |
There was a problem hiding this comment.
Using error_log instead of throwing an exception for invalid enum values can lead to silent failures. The previous implementation with throw new \InvalidArgumentException was safer as it immediately stopped execution and notified the caller of the invalid data. With error_log, the invalid value is assigned to the property, and the program continues, potentially leading to unexpected behavior and making bugs harder to trace. It is highly recommended to revert to throwing an exception to enforce the model's contract and maintain data integrity.
throw new \InvalidArgumentException(
sprintf(
"pricePlan: unexpected enum value '%s' - Supported values are [%s]",
$pricePlan,
implode(', ', $allowedValues)
)
);| error_log( | ||
| sprintf( | ||
| "Invalid value '%s' for 'serviceLevel', must be one of '%s'", | ||
| "serviceLevel: unexpected enum value '%s' - Supported values are [%s]", | ||
| $serviceLevel, | ||
| implode("', '", $allowedValues) | ||
| implode(', ', $allowedValues) | ||
| ) | ||
| ); |
There was a problem hiding this comment.
Using error_log instead of throwing an exception for invalid enum values can lead to silent failures. The previous implementation with throw new \InvalidArgumentException was safer as it immediately stopped execution and notified the caller of the invalid data. With error_log, the invalid value is assigned to the property, and the program continues, potentially leading to unexpected behavior and making bugs harder to trace. It is highly recommended to revert to throwing an exception to enforce the model's contract and maintain data integrity.
throw new \InvalidArgumentException(
sprintf(
"serviceLevel: unexpected enum value '%s' - Supported values are [%s]",
$serviceLevel,
implode(', ', $allowedValues)
)
);| error_log( | ||
| sprintf( | ||
| "Invalid value '%s' for 'status', must be one of '%s'", | ||
| "status: unexpected enum value '%s' - Supported values are [%s]", | ||
| $status, | ||
| implode("', '", $allowedValues) | ||
| implode(', ', $allowedValues) | ||
| ) | ||
| ); |
There was a problem hiding this comment.
Using error_log instead of throwing an exception for invalid enum values can lead to silent failures. The previous implementation with throw new \InvalidArgumentException was safer as it immediately stopped execution and notified the caller of the invalid data. With error_log, the invalid value is assigned to the property, and the program continues, potentially leading to unexpected behavior and making bugs harder to trace. It is highly recommended to revert to throwing an exception to enforce the model's contract and maintain data integrity.
throw new \InvalidArgumentException(
sprintf(
"status: unexpected enum value '%s' - Supported values are [%s]",
$status,
implode(', ', $allowedValues)
)
);| error_log( | ||
| sprintf( | ||
| "Invalid value '%s' for 'simcardStatus', must be one of '%s'", | ||
| "simcardStatus: unexpected enum value '%s' - Supported values are [%s]", | ||
| $simcardStatus, | ||
| implode("', '", $allowedValues) | ||
| implode(', ', $allowedValues) | ||
| ) | ||
| ); |
There was a problem hiding this comment.
Using error_log instead of throwing an exception for invalid enum values can lead to silent failures. The previous implementation with throw new \InvalidArgumentException was safer as it immediately stopped execution and notified the caller of the invalid data. With error_log, the invalid value is assigned to the property, and the program continues, potentially leading to unexpected behavior and making bugs harder to trace. It is highly recommended to revert to throwing an exception to enforce the model's contract and maintain data integrity.
throw new \InvalidArgumentException(
sprintf(
"simcardStatus: unexpected enum value '%s' - Supported values are [%s]",
$simcardStatus,
implode(', ', $allowedValues)
)
);| error_log( | ||
| sprintf( | ||
| "Invalid value '%s' for 'communicationFormat', must be one of '%s'", | ||
| "communicationFormat: unexpected enum value '%s' - Supported values are [%s]", | ||
| $communicationFormat, | ||
| implode("', '", $allowedValues) | ||
| implode(', ', $allowedValues) | ||
| ) | ||
| ); |
There was a problem hiding this comment.
Using error_log instead of throwing an exception for invalid enum values can lead to silent failures. The previous implementation with throw new \InvalidArgumentException was safer as it immediately stopped execution and notified the caller of the invalid data. With error_log, the invalid value is assigned to the property, and the program continues, potentially leading to unexpected behavior and making bugs harder to trace. It is highly recommended to revert to throwing an exception to enforce the model's contract and maintain data integrity.
throw new \InvalidArgumentException(
sprintf(
"communicationFormat: unexpected enum value '%s' - Supported values are [%s]",
$communicationFormat,
implode(', ', $allowedValues)
)
);| error_log( | ||
| sprintf( | ||
| "Invalid value '%s' for 'acquiringFees', must be one of '%s'", | ||
| "acquiringFees: unexpected enum value '%s' - Supported values are [%s]", | ||
| $acquiringFees, | ||
| implode("', '", $allowedValues) | ||
| implode(', ', $allowedValues) | ||
| ) | ||
| ); |
There was a problem hiding this comment.
Using error_log instead of throwing an exception for invalid enum values can lead to silent failures. The previous implementation with throw new \InvalidArgumentException was safer as it immediately stopped execution and notified the caller of the invalid data. With error_log, the invalid value is assigned to the property, and the program continues, potentially leading to unexpected behavior and making bugs harder to trace. It is highly recommended to revert to throwing an exception to enforce the model's contract and maintain data integrity.
throw new \InvalidArgumentException(
sprintf(
"acquiringFees: unexpected enum value '%s' - Supported values are [%s]",
$acquiringFees,
implode(', ', $allowedValues)
)
);| error_log( | ||
| sprintf( | ||
| "Invalid value '%s' for 'status', must be one of '%s'", | ||
| "status: unexpected enum value '%s' - Supported values are [%s]", | ||
| $status, | ||
| implode("', '", $allowedValues) | ||
| implode(', ', $allowedValues) | ||
| ) | ||
| ); |
There was a problem hiding this comment.
Using error_log instead of throwing an exception for invalid enum values can lead to silent failures. The previous implementation with throw new \InvalidArgumentException was safer as it immediately stopped execution and notified the caller of the invalid data. With error_log, the invalid value is assigned to the property, and the program continues, potentially leading to unexpected behavior and making bugs harder to trace. It is highly recommended to revert to throwing an exception to enforce the model's contract and maintain data integrity.
throw new \InvalidArgumentException(
sprintf(
"status: unexpected enum value '%s' - Supported values are [%s]",
$status,
implode(', ', $allowedValues)
)
);| error_log( | ||
| sprintf( | ||
| "pinSupport: unexpected enum value '%s' - Supported values are [%s]", | ||
| $pinSupport, | ||
| implode(', ', $allowedValues) | ||
| ) | ||
| ); |
There was a problem hiding this comment.
Using error_log for invalid enum values can lead to silent failures. It is better to throw an InvalidArgumentException to immediately halt execution and alert the developer to the issue. With error_log, the invalid value is assigned to the property, and the program continues, potentially leading to unexpected behavior and making bugs harder to trace. It is highly recommended to throw an exception to enforce the model's contract and maintain data integrity.
throw new \InvalidArgumentException(
sprintf(
"pinSupport: unexpected enum value '%s' - Supported values are [%s]",
$pinSupport,
implode(', ', $allowedValues)
)
);| error_log( | ||
| sprintf( | ||
| "Invalid value '%s' for 'communicationFormat', must be one of '%s'", | ||
| "communicationFormat: unexpected enum value '%s' - Supported values are [%s]", | ||
| $communicationFormat, | ||
| implode("', '", $allowedValues) | ||
| implode(', ', $allowedValues) | ||
| ) | ||
| ); |
There was a problem hiding this comment.
Using error_log instead of throwing an exception for invalid enum values can lead to silent failures. The previous implementation with throw new \InvalidArgumentException was safer as it immediately stopped execution and notified the caller of the invalid data. With error_log, the invalid value is assigned to the property, and the program continues, potentially leading to unexpected behavior and making bugs harder to trace. It is highly recommended to revert to throwing an exception to enforce the model's contract and maintain data integrity.
throw new \InvalidArgumentException(
sprintf(
"communicationFormat: unexpected enum value '%s' - Supported values are [%s]",
$communicationFormat,
implode(', ', $allowedValues)
)
);03ea0c9 to
359a479
Compare
359a479 to
e9bc80e
Compare
|



This PR contains the automated changes for the
managementservice.The commit history of this PR reflects the
adyen-openapicommits that have been applied.Management API
AlipayPlusInfo,GivexInfo,MaestroUsa,PayByBankPlaidInfo,SepaDirectDebitInfo,SvsInfo,ValuelinkInfoMototo support settings for Mail Order/Telephone Order transactions inTerminalSettingsForceRebootDetailsfor Terminals schedule actions (ScheduleTerminalActionsRequest)PricePlanEnuminAffirmInfoSupportEmailinAfterpayTouchInfoDomainSuffixinProfileUnreferencedinRefundsSplitConfigurationRuleadd attributeCardRegionwith enumCardRegionEnum