Skip to content

[sessionauthentication] Code generation: update services and models#1711

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

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

Conversation

@AdyenAutomationBot
Copy link
Copy Markdown
Collaborator

This PR contains the automated changes for the sessionauthentication 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 refactors ProductType and ResourceType from standard enums to class-based enums to improve round-trip safety for unknown values. The changes include updating JSON converters and serialization logic across multiple models. Feedback identifies a significant logic error in the Resource constructor where this.GetType().Name results in a string mismatch with defined ResourceType constants. Additionally, several instances of dead code were found in the Read methods of various resource models where the type variable is assigned but not used.

public Resource()
{
Type = (ResourceType)Enum.Parse(typeof(ResourceType), this.GetType().Name);
Type = (ResourceType)this.GetType().Name;
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 initialization of Type using this.GetType().Name sets the value to the class name (e.g., "AccountHolderResource"). However, the static constants in ResourceType use different values (e.g., "accountHolder"). Even with the case-insensitive equality operator defined in ResourceType, "AccountHolderResource" will not match "accountHolder". This mismatch breaks logic that compares resource.Type with these constants and may lead to incorrect serialization if the API expects the enum values.

string? typeRawValue = utf8JsonReader.GetString();
if (typeRawValue != null)
type = new Option<ResourceType?>(ResourceTypeValueConverter.FromStringOrDefault(typeRawValue));
type = new Option<ResourceType?>(ResourceType.FromStringOrDefault(typeRawValue) ?? (ResourceType)typeRawValue);
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.

medium

The variable type is assigned here but never used within the Read method. This appears to be dead code and can be removed to improve efficiency.

string? typeRawValue = utf8JsonReader.GetString();
if (typeRawValue != null)
type = new Option<ResourceType?>(ResourceTypeValueConverter.FromStringOrDefault(typeRawValue));
type = new Option<ResourceType?>(ResourceType.FromStringOrDefault(typeRawValue) ?? (ResourceType)typeRawValue);
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.

medium

The variable type is assigned here but never used within the Read method. This appears to be dead code.

string? typeRawValue = utf8JsonReader.GetString();
if (typeRawValue != null)
type = new Option<ResourceType?>(ResourceTypeValueConverter.FromStringOrDefault(typeRawValue));
type = new Option<ResourceType?>(ResourceType.FromStringOrDefault(typeRawValue) ?? (ResourceType)typeRawValue);
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.

medium

The variable type is assigned here but never used within the Read method. This appears to be dead code.

string? typeRawValue = utf8JsonReader.GetString();
if (typeRawValue != null)
type = new Option<ResourceType?>(ResourceTypeValueConverter.FromStringOrDefault(typeRawValue));
type = new Option<ResourceType?>(ResourceType.FromStringOrDefault(typeRawValue) ?? (ResourceType)typeRawValue);
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.

medium

The variable type is assigned here but never used within the Read method. This appears to be dead code.

@gcatanese gcatanese added this pull request to the merge queue May 21, 2026
Merged via the queue into main with commit 0abed25 May 21, 2026
2 checks passed
@gcatanese gcatanese deleted the sdk-automation/sessionauthentication branch May 21, 2026 13:11
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