Skip to content

[management] Code generation: update services and models#1716

Merged
gcatanese merged 1 commit into
mainfrom
sdk-automation/management
May 21, 2026
Merged

[management] Code generation: update services and models#1716
gcatanese merged 1 commit into
mainfrom
sdk-automation/management

Conversation

@AdyenAutomationBot
Copy link
Copy Markdown
Collaborator

This PR contains the automated changes for the management service.

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

@AdyenAutomationBot AdyenAutomationBot requested a review from a team as a code owner May 21, 2026 12:55
Copy link
Copy Markdown
Contributor

@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 numerous model classes within the Adyen Management namespace to refine enum handling and JSON deserialization logic. Key changes include implementing a fallback cast for unknown enum values and simplifying property assignments. Feedback from the reviewer identifies several high-severity issues: the modification of enum serialization to return value.Value instead of null creates a risk of NullReferenceException across many files. Furthermore, the updated logic in ScheduleTerminalActionsRequestActionDetails.cs is noted to break forward compatibility by restricting polymorphic deserialization to only predefined action types.

return "pos";

return null;
return value.Value;
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

The change from return null; to return value.Value; introduces a potential NullReferenceException when value is null. This method is used during serialization, and if the corresponding property is null, this will cause a crash. Use the null-conditional operator to safely return the underlying string value or null.

                return value?.Value;

}

if (forceRebootDetails?.Type != null)
if (forceRebootDetails?.Type != null && ForceRebootDetails.TypeEnum.FromStringOrDefault((string?)forceRebootDetails.Type) != null)
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

This change restricts polymorphic deserialization to only known action types. Previously, any non-null Type would allow the action to be returned. With this change, unknown action types (which are now supported by the TypeEnum class via the ?? (TypeEnum)rawValue pattern) will cause this check to fail and eventually lead to a JsonException. This breaks forward compatibility for new action types added to the API. This issue also occurs on lines 238, 241, 244, 247, and 250.

            if (forceRebootDetails?.Type != null)

return "deductFromOneBalanceAccount";

return null;
return value.Value;
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

The change to return value.Value; will throw a NullReferenceException if value is null. Since this is a conversion method used during serialization, it should handle null values gracefully by returning null, as it did previously. This pattern is repeated throughout this file and others in this PR.

                return value?.Value;

return "soap";

return null;
return value.Value;
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

Potential NullReferenceException when value is null. Use value?.Value to maintain null safety during serialization. This applies to all similar enum conversion methods in this file (lines 292, 431, 569).

                return value?.Value;

@gcatanese gcatanese added this pull request to the merge queue May 21, 2026
Merged via the queue into main with commit a6bc0ff May 21, 2026
2 checks passed
@gcatanese gcatanese deleted the sdk-automation/management branch May 21, 2026 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants