Skip to content

Code generation: update services and models #1492

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 22, 2025
Merged

Conversation

AdyenAutomationBot
Copy link
Collaborator

@AdyenAutomationBot AdyenAutomationBot commented May 21, 2025

OpenAPI spec files or templates have been modified on 21-05-2025 by commit.

Features 💎

  • BalancePlatform API

    • Add walletProviderDeviceType in TransactionRuleRestrictions
    • Add enum INTEREST in TransferRoute.CategoryEnum
  • Transfer API

    • Add attribute executionDate in Transfer, TransferData and TransferInfo
  • BalancePlatform Webhooks

  • Transfer Webhooks

    • Add attribute executionDate in TransferData

@AdyenAutomationBot AdyenAutomationBot requested a review from a team as a code owner May 21, 2025 11:38
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @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!

Summary of Changes

Hello team,

Gemini or gemini-code-assist here to provide a summary of this pull request. This PR updates the generated Java code based on recent modifications to the OpenAPI specification, as indicated by the title and description. The primary functional change involves the introduction of a new ExecutionDate model and its integration into the Transfer and TransferData models within both the main Transfers API and the Transfer Webhooks package. Additionally, some minor documentation improvements were made to existing models in the ACS webhooks package.

Highlights

  • New Model: ExecutionDate: A new model class, ExecutionDate, has been added to represent the date and timezone for scheduled transfers.
  • Transfers API Updates: The Transfer and TransferData models in the main Transfers API now include the new executionDate field, allowing for specifying the processing date and timezone for transfers.
  • Transfer Webhooks Updates: The TransferData model in the Transfer Webhooks package has been updated to include the executionDate field, and a corresponding ExecutionDate model was added to this package.
  • Documentation Improvements: Minor Javadoc comments were updated in the AuthenticationNotificationData and PurchaseInfo models within the ACS webhooks package for improved clarity.

Changelog

Click here to see the changelog
  • src/main/java/com/adyen/model/acswebhooks/AuthenticationNotificationData.java
    • Updated Javadoc comments for the id field (lines 166, 177, 187).
    • Updated Javadoc comments for the paymentInstrumentId field (lines 198, 209, 219).
  • src/main/java/com/adyen/model/acswebhooks/PurchaseInfo.java
    • Updated Javadoc comments for the date field (lines 52, 63, 73).
    • Updated Javadoc comments for the merchantName field (lines 84, 95, 105).
  • src/main/java/com/adyen/model/transfers/ExecutionDate.java
    • Added a new model class ExecutionDate with date (LocalDate) and timezone (String) properties.
  • src/main/java/com/adyen/model/transfers/Transfer.java
    • Added import for ExecutionDate (line 21).
    • Added JSON_PROPERTY_EXECUTION_DATE constant (line 171).
    • Added executionDate field of type ExecutionDate (line 172).
    • Added getter, setter, and chaining methods for executionDate (lines 873-901).
    • Updated equals, hashCode, and toString methods to include executionDate (lines 1182, 1195, 1212).
  • src/main/java/com/adyen/model/transfers/TransferData.java
    • Added import for ExecutionDate (line 21).
    • Added JSON_PROPERTY_EXECUTION_DATE constant (line 198).
    • Added executionDate field of type ExecutionDate (line 199).
    • Added getter, setter, and chaining methods for executionDate (lines 1056-1084).
    • Updated equals, hashCode, and toString methods to include executionDate (lines 1497, 1514, 1535).
  • src/main/java/com/adyen/model/transferwebhooks/ExecutionDate.java
    • Added a new model class ExecutionDate with date (LocalDate) and timezone (String) properties for the transfer webhooks package.
  • src/main/java/com/adyen/model/transferwebhooks/TransferData.java
    • Added import for ExecutionDate (line 21).
    • Added JSON_PROPERTY_EXECUTION_DATE constant (line 198).
    • Added executionDate field of type ExecutionDate (line 199).
    • Added getter, setter, and chaining methods for executionDate (lines 1056-1084).
    • Updated equals, hashCode, and toString methods to include executionDate (lines 1497, 1514, 1535).
Using Gemini Code Assist

The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and 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 to provide feedback.

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.


Code generated anew,
From spec changes, fresh and true.
Models updated fast,
Future API built to last.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates services and models, likely based on modifications to OpenAPI specifications or templates. The main change involves the introduction of an ExecutionDate model and its integration into various transfer-related classes. The generated code appears consistent with these changes. My primary feedback concerns a potential maintainability issue due to model duplication.

Summary of Findings

  • Code Duplication of ExecutionDate Model: The ExecutionDate model class is duplicated in two packages: com.adyen.model.transfers and com.adyen.model.transferwebhooks. A review comment with medium severity has been added to address this potential maintainability issue.
  • Javadoc Improvements (Low Severity - Not Commented): Javadoc comments in src/main/java/com/adyen/model/acswebhooks/AuthenticationNotificationData.java and src/main/java/com/adyen/model/acswebhooks/PurchaseInfo.java were updated. These changes generally improve clarity (e.g., adding 'The' to start sentences, and providing a more descriptive explanation for merchantName in PurchaseInfo.java). These are positive but considered low-severity changes, so no specific comments were added due to review settings.
  • Minimal Javadoc for Generated Methods (Low Severity - Not Commented): The newly generated getters, setters, and builder-style methods for the executionDate field in Transfer.java, TransferData.java (both versions), and TransferInfo.java have minimal Javadoc (e.g., @param executionDate without further description of the parameter's role in that context). While typical for auto-generated code, more descriptive Javadoc could be beneficial if manual enhancements were part of the development workflow. This is considered a low-severity observation, so no specific comments were added due to review settings.

Merge Readiness

The changes in this PR are largely related to code generation. The most significant point to consider is the duplication of the ExecutionDate model across different packages, which has been flagged as a medium severity maintainability concern. It would be beneficial to discuss or address this to ensure long-term code health. Other changes, such as Javadoc updates and the integration of the new executionDate field into existing models, appear to be standard and correctly implemented as per the generation logic.

I am unable to approve pull requests. It is recommended that the model duplication issue be reviewed and a decision made on how to proceed before merging. Other reviewers should make the final determination on merging.

Comment on lines +1 to +171
*/
@JsonProperty(JSON_PROPERTY_DATE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setDate(LocalDate date) {
this.date = date;
}

/**
* The timezone that applies to the execution date. Use a timezone identifier from the [tz database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). Example: **America/Los_Angeles**. Default value: **Europe/Amsterdam**.
*
* @param timezone The timezone that applies to the execution date. Use a timezone identifier from the [tz database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). Example: **America/Los_Angeles**. Default value: **Europe/Amsterdam**.
* @return the current {@code ExecutionDate} instance, allowing for method chaining
*/
public ExecutionDate timezone(String timezone) {
this.timezone = timezone;
return this;
}

/**
* The timezone that applies to the execution date. Use a timezone identifier from the [tz database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). Example: **America/Los_Angeles**. Default value: **Europe/Amsterdam**.
* @return timezone The timezone that applies to the execution date. Use a timezone identifier from the [tz database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). Example: **America/Los_Angeles**. Default value: **Europe/Amsterdam**.
*/
@JsonProperty(JSON_PROPERTY_TIMEZONE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getTimezone() {
return timezone;
}

/**
* The timezone that applies to the execution date. Use a timezone identifier from the [tz database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). Example: **America/Los_Angeles**. Default value: **Europe/Amsterdam**.
*
* @param timezone The timezone that applies to the execution date. Use a timezone identifier from the [tz database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). Example: **America/Los_Angeles**. Default value: **Europe/Amsterdam**.
*/
@JsonProperty(JSON_PROPERTY_TIMEZONE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setTimezone(String timezone) {
this.timezone = timezone;
}

/**
* Return true if this ExecutionDate object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ExecutionDate executionDate = (ExecutionDate) o;
return Objects.equals(this.date, executionDate.date) &&
Objects.equals(this.timezone, executionDate.timezone);
}

@Override
public int hashCode() {
return Objects.hash(date, timezone);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ExecutionDate {\n");
sb.append(" date: ").append(toIndentedString(date)).append("\n");
sb.append(" timezone: ").append(toIndentedString(timezone)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}

/**
* Create an instance of ExecutionDate given an JSON string
*
* @param jsonString JSON string
* @return An instance of ExecutionDate
* @throws JsonProcessingException if the JSON string is invalid with respect to ExecutionDate
*/
public static ExecutionDate fromJson(String jsonString) throws JsonProcessingException {
return JSON.getMapper().readValue(jsonString, ExecutionDate.class);
}
/**
* Convert an instance of ExecutionDate to an JSON string
*
* @return JSON string
*/
public String toJson() throws JsonProcessingException {
return JSON.getMapper().writeValueAsString(this);
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This new ExecutionDate class (in package com.adyen.model.transferwebhooks) appears to be identical in structure and purpose to com.adyen.model.transfers.ExecutionDate (located in src/main/java/com/adyen/model/transfers/ExecutionDate.java), which is also part of this pull request's changes.

While this might be an artifact of the OpenAPI generation process from separate specifications (as suggested by the PR title/description), having duplicated model classes can introduce maintainability challenges in the long run:

  • Inconsistency Risk: If one class requires an update (e.g., a new field, modified validation rules, or Javadoc improvements), the other instance might be overlooked. This could lead to divergent behavior or understanding of ExecutionDate in different parts of the system.
  • Increased Maintenance Overhead: Any changes to the concept of an ExecutionDate would need to be applied and tested in multiple places.
  • Code Bloat: It adds redundant code to the codebase.

Could we investigate if it's feasible to define ExecutionDate in a shared common module or adjust the OpenAPI specifications/generation templates to reference a single, canonical definition? If this duplication is a known and accepted outcome of the current generation strategy due to specific constraints, it would be beneficial to acknowledge this, perhaps with a comment in the code or internal documentation explaining the rationale.

@gcatanese gcatanese added the Feature Indicates a new feature addition label May 22, 2025
@gcatanese gcatanese merged commit 1efbaa9 into main May 22, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Indicates a new feature addition
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants