Skip to content

[configurationwebhooks] Code generation: update services and models - #1991

Merged
poojah-adyen merged 1 commit into
mainfrom
sdk-automation/configurationwebhooks
Jul 23, 2026
Merged

[configurationwebhooks] Code generation: update services and models#1991
poojah-adyen merged 1 commit into
mainfrom
sdk-automation/configurationwebhooks

Conversation

@AdyenAutomationBot

@AdyenAutomationBot AdyenAutomationBot commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

This PR contains the automated changes for the configurationwebhooks service.

The commit history of this PR reflects the adyen-openapi commits that have been applied.

Breaking Changes 🛠

Mandate

• The createdAt field type changed from Object to OffsetDateTime (getter/setter/builder signatures updated).
• The updatedAt field type changed from Object to OffsetDateTime (getter/setter/builder signatures updated).

New Features 💎

Configuration Webhooks

  • MandateBankAccountAccountIdentification — Added discriminator (type) mappings for the account-identification subtypes (ukLocal → UKLocalMandateAccountIdentification).
  • PaymentInstrumentAdditionalBankAccountIdentificationsInner — Added discriminator (type) mappings for the additional bank account identification subtypes (iban → IbanAccountIdentification).
  • Mandate.createdAt / Mandate.updatedAt — documentation expanded ("The date when the mandate was created/updated").
  • Added BalancePlatformWebhooksTest cases covering the OffsetDateTime mandate dates and the account-identification discriminator (happy path plus invalid-date and unknown-type failure paths).

@AdyenAutomationBot
AdyenAutomationBot requested a review from a team as a code owner June 17, 2026 09:05

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

Copy link
Copy Markdown
Contributor

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 the SDK generation metadata and registers discriminator mappings for MandateBankAccountAccountIdentification and PaymentInstrumentAdditionalBankAccountIdentificationsInner. The review feedback points out redundant self-mappings in the discriminator maps that should be removed to keep the code clean. Additionally, it highlights a potential concurrency vulnerability in the underlying JSON registration utility, recommending the use of ConcurrentHashMap to ensure thread safety during class loading.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +155 to +161
// Initialize and register the discriminator mappings.
Map<String, Class<?>> mappings = new HashMap<>();
mappings.put("ukLocal", UKLocalMandateAccountIdentification.class);
mappings.put("UKLocalMandateAccountIdentification", UKLocalMandateAccountIdentification.class);
mappings.put(
"MandateBankAccount_accountIdentification", MandateBankAccountAccountIdentification.class);
JSON.registerDiscriminator(MandateBankAccountAccountIdentification.class, "type", mappings);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

1. Redundant Self-Mapping in Discriminator (Medium)

The mapping mappings.put("MandateBankAccount_accountIdentification", MandateBankAccountAccountIdentification.class); maps the parent/composed class to itself. A discriminator should only map to concrete subtype classes (like UKLocalMandateAccountIdentification). If this mapping is ever matched, the custom deserializer MandateBankAccountAccountIdentificationDeserializer will fail anyway because "MandateBankAccount_accountIdentification" is not a valid enum value for any of the subtypes. Removing this self-mapping keeps the code clean and avoids confusion.

2. Concurrency Vulnerability in JSON.registerDiscriminator (High)

The static block calls JSON.registerDiscriminator(...). Under the hood, JSON.java stores these mappings in a plain HashMap (modelDiscriminators). Since different model classes can be loaded concurrently on different threads (especially in a multi-threaded webhook processing environment), concurrent writes to this HashMap can cause race conditions, data corruption, or infinite loops.

Recommendation:
Although JSON.java is not modified in this PR, it should be updated to use ConcurrentHashMap for both modelDiscriminators and modelDescendants to ensure thread safety during class loading:

private static final Map<Class<?>, ClassDiscriminatorMapping> modelDiscriminators =
    new ConcurrentHashMap<>();
private static final Map<Class<?>, Map<String, GenericType>> modelDescendants =
    new ConcurrentHashMap<>();
    // Initialize and register the discriminator mappings.
    Map<String, Class<?>> mappings = new HashMap<>();
    mappings.put("ukLocal", UKLocalMandateAccountIdentification.class);
    mappings.put("UKLocalMandateAccountIdentification", UKLocalMandateAccountIdentification.class);
    JSON.registerDiscriminator(MandateBankAccountAccountIdentification.class, "type", mappings);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Needs to be checked closely (cc @poojah-adyen)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  1. Low impact fix as it would never match
  2. Will be fixed in follow-up PR

Comment on lines +154 to +162
// Initialize and register the discriminator mappings.
Map<String, Class<?>> mappings = new HashMap<>();
mappings.put("iban", IbanAccountIdentification.class);
mappings.put("IbanAccountIdentification", IbanAccountIdentification.class);
mappings.put(
"PaymentInstrument_additionalBankAccountIdentifications_inner",
PaymentInstrumentAdditionalBankAccountIdentificationsInner.class);
JSON.registerDiscriminator(
PaymentInstrumentAdditionalBankAccountIdentificationsInner.class, "type", mappings);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

1. Redundant Self-Mapping in Discriminator (Medium)

The mapping mappings.put("PaymentInstrument_additionalBankAccountIdentifications_inner", PaymentInstrumentAdditionalBankAccountIdentificationsInner.class); maps the parent/composed class to itself. A discriminator should only map to concrete subtype classes (like IbanAccountIdentification). If this mapping is ever matched, the custom deserializer PaymentInstrumentAdditionalBankAccountIdentificationsInnerDeserializer will fail anyway because "PaymentInstrument_additionalBankAccountIdentifications_inner" is not a valid enum value for any of the subtypes. Removing this self-mapping keeps the code clean and avoids confusion.

2. Concurrency Vulnerability in JSON.registerDiscriminator (High)

The static block calls JSON.registerDiscriminator(...). Under the hood, JSON.java stores these mappings in a plain HashMap (modelDiscriminators). Since different model classes can be loaded concurrently on different threads (especially in a multi-threaded webhook processing environment), concurrent writes to this HashMap can cause race conditions, data corruption, or infinite loops.

Recommendation:
Although JSON.java is not modified in this PR, it should be updated to use ConcurrentHashMap for both modelDiscriminators and modelDescendants to ensure thread safety during class loading:

private static final Map<Class<?>, ClassDiscriminatorMapping> modelDiscriminators =
    new ConcurrentHashMap<>();
private static final Map<Class<?>, Map<String, GenericType>> modelDescendants =
    new ConcurrentHashMap<>();
    // Initialize and register the discriminator mappings.
    Map<String, Class<?>> mappings = new HashMap<>();
    mappings.put("iban", IbanAccountIdentification.class);
    mappings.put("IbanAccountIdentification", IbanAccountIdentification.class);
    JSON.registerDiscriminator(
        PaymentInstrumentAdditionalBankAccountIdentificationsInner.class, "type", mappings);

@AdyenAutomationBot
AdyenAutomationBot force-pushed the sdk-automation/configurationwebhooks branch 7 times, most recently from a886b65 to 4bf3089 Compare June 24, 2026 08:32
@AdyenAutomationBot
AdyenAutomationBot force-pushed the sdk-automation/configurationwebhooks branch 3 times, most recently from cf230fd to d86dd5a Compare July 7, 2026 09:21
@AdyenAutomationBot
AdyenAutomationBot force-pushed the sdk-automation/configurationwebhooks branch 3 times, most recently from 9ed24da to e63cec7 Compare July 13, 2026 14:23
@gcatanese gcatanese added Fix Indicates a bug fix Feature Indicates a new feature addition Breaking change Indicates a change that has caused a major version update and removed Fix Indicates a bug fix Feature Indicates a new feature addition Breaking change Indicates a change that has caused a major version update labels Jul 14, 2026
@AdyenAutomationBot
AdyenAutomationBot force-pushed the sdk-automation/configurationwebhooks branch 8 times, most recently from 41d13ca to d859172 Compare July 21, 2026 09:54
private MandateBankAccount counterparty;

public static final String JSON_PROPERTY_CREATED_AT = "createdAt";
private Object createdAt;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

breaking change

@jeandersonbc jeandersonbc added the Breaking change Indicates a change that has caused a major version update label Jul 21, 2026
@AdyenAutomationBot
AdyenAutomationBot force-pushed the sdk-automation/configurationwebhooks branch 2 times, most recently from 5a862a6 to 472f011 Compare July 23, 2026 11:56
@AdyenAutomationBot
AdyenAutomationBot force-pushed the sdk-automation/configurationwebhooks branch from 1581a37 to d31b881 Compare July 23, 2026 13:25
@sonarqubecloud

Copy link
Copy Markdown

@poojah-adyen poojah-adyen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Comment on lines +155 to +161
// Initialize and register the discriminator mappings.
Map<String, Class<?>> mappings = new HashMap<>();
mappings.put("ukLocal", UKLocalMandateAccountIdentification.class);
mappings.put("UKLocalMandateAccountIdentification", UKLocalMandateAccountIdentification.class);
mappings.put(
"MandateBankAccount_accountIdentification", MandateBankAccountAccountIdentification.class);
JSON.registerDiscriminator(MandateBankAccountAccountIdentification.class, "type", mappings);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  1. Low impact fix as it would never match
  2. Will be fixed in follow-up PR

@poojah-adyen
poojah-adyen added this pull request to the merge queue Jul 23, 2026
Merged via the queue into main with commit a2d39c6 Jul 23, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking change Indicates a change that has caused a major version update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants