[transfers] Code generation: update services and models#1634
[transfers] Code generation: update services and models#1634AdyenAutomationBot wants to merge 1 commit intomainfrom
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 provides an automated update to 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. Changelog
Activity
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 updates services and models for the transfers service, apparently from an automated code generation process. The changes include refactoring the Counterparty model into more specific GrantCounterparty and GrantInfoCounterparty types, adding a new InterchangeData model, and updating various enums.
While the changes are mostly consistent, I've identified a critical issue in how discriminated unions are handled. The ObjectSerializer will fail to deserialize types like TransferEventEventsDataInner because the necessary mapping from discriminator values to type names is missing. This appears to be a bug in the code generator that affects all discriminated unions and will lead to runtime errors. Please see the specific comment for details on the issue and how to fix it.
| * @export | ||
| */ | ||
| export type TransferEventEventsDataInner = IssuingTransactionData | MerchantPurchaseData; | ||
| export type TransferEventEventsDataInner = InterchangeData | IssuingTransactionData | MerchantPurchaseData; |
There was a problem hiding this comment.
The discriminated union TransferEventEventsDataInner will not be deserialized correctly because the mapping in TransferEventEventsDataInnerClass is missing. The ObjectSerializer relies on this mapping to resolve the correct type based on the type discriminator property.
Without the mapping, the serializer will fail to find the concrete class for values like 'interchangeData', 'issuingTransactionData', or 'merchantPurchaseData' because these values don't match the class names (InterchangeData, IssuingTransactionData, MerchantPurchaseData) in the typeMap.
This seems to be a general issue with the code generator for all discriminated unions.
To fix this, TransferEventEventsDataInnerClass should have a mapping property defined, like this:
export class TransferEventEventsDataInnerClass {
static readonly discriminator: string = "type";
static readonly mapping: {[index: string]: string} | undefined = {
"interchangeData": "InterchangeData",
"issuingTransactionData": "IssuingTransactionData",
"merchantPurchaseData": "MerchantPurchaseData",
};
}This is a critical issue that will cause runtime errors during deserialization.
af884cb to
7f55164
Compare
This PR contains the automated changes for the
transfersservice.The commit history of this PR reflects the
adyen-openapicommits that have been applied.