Skip to content
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

Invalid type in PHPDoc block for AddressEditable::setAddressCountry #170

Open
alies-dev opened this issue Apr 7, 2023 · 0 comments
Open

Comments

@alies-dev
Copy link

Summary

\OpenAPI\Client\Model\AddressEditable::setAddressCountry declared to accept @param \OpenAPI\Client\Model\CountryExtended|null $address_country address_country (where CountryExtended is enum), but it doesn't work with enums: it failed with Invalid address. Code: address_country must be a string RequestException on calling \OpenAPI\Client\Api\AddressesApi::create.

Stacktrace:

/var/www/vendor/lob/lob-php/lib/Api/AddressesApi.php:197
/var/www/vendor/lob/lob-php/lib/Api/AddressesApi.php:166

Snippet to test:

$addressApi = new AddressesApi($config);

$editableAddress = new AddressEditable();
$editableAddress->setAddressCountry(\OpenAPI\Client\Model\CountryExtended::AE);

$createdAddress = $addressApi->create($editableAddress);

Workaround solution:

-$editableAddress->setAddressCountry(\OpenAPI\Client\Model\CountryExtended::AE);
+$editableAddress->setAddressCountry(\OpenAPI\Client\Model\CountryExtended::AE->value);

PS: I have not tested other cases where this enum used in PHPDoc, there are few:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant