Skip to content

[documentcollector] Code generation: update services and models - #932

Open
AdyenAutomationBot wants to merge 1 commit into
mainfrom
sdk-automation/documentcollector
Open

[documentcollector] Code generation: update services and models#932
AdyenAutomationBot wants to merge 1 commit into
mainfrom
sdk-automation/documentcollector

Conversation

@AdyenAutomationBot

Copy link
Copy Markdown
Collaborator

This PR contains the automated changes for the documentcollector 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 August 21, 2026 14:04

@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 introduces the PHP SDK generation for the Document Collector service, adding models like DefaultErrorResponseEntity, DocumentUploadResponse, and InvalidField, alongside the DocumentsApi service. The review feedback identifies three key issues in the generated code: the uploadCrossBorderInvoice method is missing its request body parameter, preventing document uploads; the ObjectSerializer uses an incorrect hardcoded namespace for polymorphic discriminator resolution; and calling settype on \SplFileObject will trigger a PHP warning.

Comment on lines +49 to +54
public function uploadCrossBorderInvoice(?array $requestOptions = null): \Adyen\Model\DocumentCollector\DocumentUploadResponse
{
$endpoint = $this->baseURL . "/crossBorderInvoices";
$response = $this->requestHttp($endpoint, strtolower('POST'), null, $requestOptions);
return ObjectSerializer::deserialize($response, \Adyen\Model\DocumentCollector\DocumentUploadResponse::class);
}

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 uploadCrossBorderInvoice method is missing the request body parameter. Currently, it passes null as the third argument to requestHttp, which means no document or payload is sent with the POST request. This makes it impossible to upload any invoice documents.

Please update the OpenAPI generator configuration or the spec to ensure the request body parameter (e.g., $documentUploadRequest or binary/multipart data) is correctly generated and passed to requestHttp.

// If a discriminator is defined and points to a valid subclass, use it.
$discriminator = $class::DISCRIMINATOR;
if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) {
$subclass = '\Adyen\Model\\' . $data->{$discriminator};

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 discriminator subclass resolution is using the hardcoded namespace \Adyen\Model\ instead of the service-specific namespace \Adyen\Model\DocumentCollector\. This will cause subclass resolution to fail for polymorphic models because the classes are located under \Adyen\Model\DocumentCollector\.

                $subclass = '\\Adyen\\Model\\DocumentCollector\\' . $data->{$discriminator};

Comment on lines +241 to +244
if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) {
settype($data, $class);
return $data;
}

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

Calling settype($data, $class) when $class is \SplFileObject will trigger a PHP warning (settype(): Invalid type) because \SplFileObject is not a valid primitive type for settype(). Since \DateTime is already handled above, and \SplFileObject cannot be casted using settype, we should avoid calling settype for these class types.

        if (in_array($class, ['\\DateTime', '\\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) {
            if ($class !== '\\DateTime' && $class !== '\\SplFileObject') {
                settype($data, $class);
            }
            return $data;
        }

@AdyenAutomationBot
AdyenAutomationBot force-pushed the sdk-automation/documentcollector branch 2 times, most recently from 5ff6d47 to b14c4ab Compare August 27, 2026 14:02
@AdyenAutomationBot
AdyenAutomationBot force-pushed the sdk-automation/documentcollector branch from b14c4ab to 976244e Compare September 4, 2026 09:50
@sonarqubecloud

sonarqubecloud Bot commented Sep 4, 2026

Copy link
Copy Markdown

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.

1 participant