-
Notifications
You must be signed in to change notification settings - Fork 154
[configurationwebhooks] Code generation: update services and models #1991
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| { | ||
| "service": "configurationwebhooks", | ||
| "project": "java", | ||
| "generatedAt": "2026-06-02T15:30:09Z", | ||
| "openapiCommitSha": "f3894fd6b47d9076841b04852378251de3bba2de", | ||
| "automationCommitSha": "6f06b47d0661f0891defe6b85461d2c367fbd284", | ||
| "libraryCommitSha": "9539e092f2160ca341916c804f01f0f699a64415" | ||
| "generatedAt": "2026-07-08T18:09:51Z", | ||
| "openapiCommitSha": "334900842b135eb9fc1a17afebd46a4f07793aec", | ||
| "automationCommitSha": "5f1d5ab9643886ef722a2626e23afef8db5d52a6", | ||
| "libraryCommitSha": "9272fbb8dc027b507a9e88aca0a36557e80e6e52" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -151,6 +151,15 @@ public PaymentInstrumentAdditionalBankAccountIdentificationsInner(IbanAccountIde | |
| JSON.registerDescendants( | ||
| PaymentInstrumentAdditionalBankAccountIdentificationsInner.class, | ||
| Collections.unmodifiableMap(schemas)); | ||
| // 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); | ||
|
Comment on lines
+154
to
+162
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1. Redundant Self-Mapping in Discriminator (Medium)The mapping 2. Concurrency Vulnerability in
|
||
| } | ||
|
|
||
| @Override | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 (likeUKLocalMandateAccountIdentification). If this mapping is ever matched, the custom deserializerMandateBankAccountAccountIdentificationDeserializerwill 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.javastores these mappings in a plainHashMap(modelDiscriminators). Since different model classes can be loaded concurrently on different threads (especially in a multi-threaded webhook processing environment), concurrent writes to thisHashMapcan cause race conditions, data corruption, or infinite loops.Recommendation:
Although
JSON.javais not modified in this PR, it should be updated to useConcurrentHashMapfor bothmodelDiscriminatorsandmodelDescendantsto ensure thread safety during class loading: