From af0bc1811003c8b15ce603c58a952bb3cc9b84e1 Mon Sep 17 00:00:00 2001 From: iamgergo Date: Mon, 31 Aug 2026 11:02:04 +0000 Subject: [PATCH] Upgrade client --- .openapi-generator/FILES | 2 + .openapi-generator/VERSION | 2 +- src/Api/PublicApi.php | 73 +++----- src/ApiException.php | 2 +- src/Configuration.php | 32 +++- src/FormDataProcessor.php | 2 +- src/HeaderSelector.php | 2 +- src/Model/AnyOfInterface.php | 65 +++++++ src/Model/CheckVatRequest.php | 54 ++---- src/Model/CheckVatResponse.php | 54 ++---- src/Model/CommonResponse.php | 54 ++---- src/Model/CountryStatus.php | 54 ++---- src/Model/ErrorWrapper.php | 54 ++---- src/Model/ModelInterface.php | 19 ++- src/Model/OneOfInterface.php | 65 +++++++ src/Model/Status.php | 2 +- src/Model/StatusInformationResponse.php | 54 ++---- src/Model/StatusInformationResponseVow.php | 54 ++---- src/ObjectSerializer.php | 186 ++++++++++++++++++++- 19 files changed, 490 insertions(+), 340 deletions(-) create mode 100644 src/Model/AnyOfInterface.php create mode 100644 src/Model/OneOfInterface.php diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 3508e2a..1800957 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -4,12 +4,14 @@ src/ApiException.php src/Configuration.php src/FormDataProcessor.php src/HeaderSelector.php +src/Model/AnyOfInterface.php src/Model/CheckVatRequest.php src/Model/CheckVatResponse.php src/Model/CommonResponse.php src/Model/CountryStatus.php src/Model/ErrorWrapper.php src/Model/ModelInterface.php +src/Model/OneOfInterface.php src/Model/Status.php src/Model/StatusInformationResponse.php src/Model/StatusInformationResponseVow.php diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index 2540a3a..bc34d81 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -7.20.0 +7.25.0 diff --git a/src/Api/PublicApi.php b/src/Api/PublicApi.php index 36144f5..d2ee6d9 100644 --- a/src/Api/PublicApi.php +++ b/src/Api/PublicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: 1.0.0 * @generated Generated by: https://openapi-generator.tech - * Generator version: 7.20.0 + * Generator version: 7.25.0 */ /** @@ -32,7 +32,6 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use GuzzleHttp\Promise\PromiseInterface; @@ -41,7 +40,6 @@ use Cone\Vies\ApiException; use Cone\Vies\Configuration; use Cone\Vies\HeaderSelector; -use Cone\Vies\FormDataProcessor; use Cone\Vies\ObjectSerializer; /** @@ -72,7 +70,7 @@ class PublicApi */ protected int $hostIndex; - /** @var string[] $contentTypes **/ + /** @var array $contentTypes **/ public const contentTypes = [ 'checkStatus' => [ 'application/json', @@ -158,7 +156,7 @@ public function checkStatus( * * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return array of \Cone\Vies\Model\StatusInformationResponse|\Cone\Vies\Model\CommonResponse|\Cone\Vies\Model\CommonResponse, HTTP status code, HTTP response headers (array of strings) + * @return array{0: \Cone\Vies\Model\StatusInformationResponse|\Cone\Vies\Model\CommonResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] */ public function checkStatusWithHttpInfo( string $contentType = self::contentTypes['checkStatus'][0] @@ -208,7 +206,6 @@ public function checkStatusWithHttpInfo( ); } - if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -344,9 +341,7 @@ public function checkStatusRequest( string $contentType = self::contentTypes['checkStatus'][0] ): Request { - $resourcePath = '/check-status'; - $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; @@ -362,30 +357,6 @@ public function checkStatusRequest( $multipart ); - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem, - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - // if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } $defaultHeaders = []; if ($this->config->getUserAgent()) { @@ -438,7 +409,7 @@ public function checkVatNumber( * * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return array of \Cone\Vies\Model\CheckVatResponse|\Cone\Vies\Model\CommonResponse|\Cone\Vies\Model\CommonResponse, HTTP status code, HTTP response headers (array of strings) + * @return array{0: \Cone\Vies\Model\CheckVatResponse|\Cone\Vies\Model\CommonResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] */ public function checkVatNumberWithHttpInfo( \Cone\Vies\Model\CheckVatRequest $body, @@ -489,7 +460,6 @@ public function checkVatNumberWithHttpInfo( ); } - if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -630,7 +600,6 @@ public function checkVatNumberRequest( \Cone\Vies\Model\CheckVatRequest $body, string $contentType = self::contentTypes['checkVatNumber'][0] ): Request { - // verify the required parameter 'body' is set if ($body === null || (is_array($body) && count($body) === 0)) { throw new InvalidArgumentException( @@ -638,7 +607,6 @@ public function checkVatNumberRequest( ); } - $resourcePath = '/check-vat-number'; $formParams = []; $queryParams = []; @@ -660,7 +628,11 @@ public function checkVatNumberRequest( if (isset($body)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($body), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $body; } @@ -677,11 +649,15 @@ public function checkVatNumberRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -739,7 +715,7 @@ public function checkVatTestService( * * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return array of \Cone\Vies\Model\CheckVatResponse|\Cone\Vies\Model\CommonResponse|\Cone\Vies\Model\CommonResponse, HTTP status code, HTTP response headers (array of strings) + * @return array{0: \Cone\Vies\Model\CheckVatResponse|\Cone\Vies\Model\CommonResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] */ public function checkVatTestServiceWithHttpInfo( \Cone\Vies\Model\CheckVatRequest $body, @@ -790,7 +766,6 @@ public function checkVatTestServiceWithHttpInfo( ); } - if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -931,7 +906,6 @@ public function checkVatTestServiceRequest( \Cone\Vies\Model\CheckVatRequest $body, string $contentType = self::contentTypes['checkVatTestService'][0] ): Request { - // verify the required parameter 'body' is set if ($body === null || (is_array($body) && count($body) === 0)) { throw new InvalidArgumentException( @@ -939,7 +913,6 @@ public function checkVatTestServiceRequest( ); } - $resourcePath = '/check-vat-test-service'; $formParams = []; $queryParams = []; @@ -961,7 +934,11 @@ public function checkVatTestServiceRequest( if (isset($body)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($body), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $body; } @@ -978,11 +955,15 @@ public function checkVatTestServiceRequest( } } // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); diff --git a/src/ApiException.php b/src/ApiException.php index 7d0199a..1aa6219 100644 --- a/src/ApiException.php +++ b/src/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: 1.0.0 * @generated Generated by: https://openapi-generator.tech - * Generator version: 7.20.0 + * Generator version: 7.25.0 */ /** diff --git a/src/Configuration.php b/src/Configuration.php index 780a20f..9eb34cc 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: 1.0.0 * @generated Generated by: https://openapi-generator.tech - * Generator version: 7.20.0 + * Generator version: 7.25.0 */ /** @@ -122,6 +122,13 @@ class Configuration */ protected string $tempFolderPath; + /** + * Ignore operation specific hosts + * + * @var bool + */ + protected bool $ignoreOperationHosts = false; + /** * Constructor */ @@ -391,6 +398,29 @@ public function getTempFolderPath(): string return $this->tempFolderPath; } + /** + * Sets the ignore operation specific hosts flag + * + * @param bool $ignoreOperationHosts Ignore operation specific hosts flag + * + * @return $this + */ + public function setIgnoreOperationHosts(bool $ignoreOperationHosts): static + { + $this->ignoreOperationHosts = $ignoreOperationHosts; + return $this; + } + + /** + * Gets the ignore operation specific hosts flag + * + * @return bool Ignore operation specific hosts flag + */ + public function getIgnoreOperationHosts(): bool + { + return $this->ignoreOperationHosts; + } + /** * Gets the default configuration instance * diff --git a/src/FormDataProcessor.php b/src/FormDataProcessor.php index 49e8221..7e506fb 100644 --- a/src/FormDataProcessor.php +++ b/src/FormDataProcessor.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: 1.0.0 * @generated Generated by: https://openapi-generator.tech - * Generator version: 7.20.0 + * Generator version: 7.25.0 */ /** diff --git a/src/HeaderSelector.php b/src/HeaderSelector.php index 58d537d..7007dfb 100644 --- a/src/HeaderSelector.php +++ b/src/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: 1.0.0 * @generated Generated by: https://openapi-generator.tech - * Generator version: 7.20.0 + * Generator version: 7.25.0 */ /** diff --git a/src/Model/AnyOfInterface.php b/src/Model/AnyOfInterface.php new file mode 100644 index 0000000..c40ddff --- /dev/null +++ b/src/Model/AnyOfInterface.php @@ -0,0 +1,65 @@ + + */ + public static function getAnyOfDiscriminatorMappings(): array; +} diff --git a/src/Model/CheckVatRequest.php b/src/Model/CheckVatRequest.php index 449697c..bf57b6a 100644 --- a/src/Model/CheckVatRequest.php +++ b/src/Model/CheckVatRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: 1.0.0 * @generated Generated by: https://openapi-generator.tech - * Generator version: 7.20.0 + * Generator version: 7.25.0 */ /** @@ -111,9 +111,7 @@ class CheckVatRequest implements ModelInterface, ArrayAccess, JsonSerializable protected array $openAPINullablesSetToNull = []; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array + * {@inheritdoc} */ public static function openAPITypes(): array { @@ -121,9 +119,7 @@ public static function openAPITypes(): array } /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array + * {@inheritdoc} */ public static function openAPIFormats(): array { @@ -161,10 +157,7 @@ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): } /** - * Checks if a property is nullable - * - * @param string $property - * @return bool + * {@inheritdoc} */ public static function isNullable(string $property): bool { @@ -172,10 +165,7 @@ public static function isNullable(string $property): bool } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool + * {@inheritdoc} */ public function isNullableSetToNull(string $property): bool { @@ -235,10 +225,7 @@ public function isNullableSetToNull(string $property): bool ]; /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array + * {@inheritdoc} */ public static function attributeMap(): array { @@ -246,9 +233,7 @@ public static function attributeMap(): array } /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array + * {@inheritdoc} */ public static function setters(): array { @@ -256,9 +241,7 @@ public static function setters(): array } /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array + * {@inheritdoc} */ public static function getters(): array { @@ -266,9 +249,7 @@ public static function getters(): array } /** - * The original name of the model. - * - * @return string + * {@inheritdoc} */ public function getModelName(): string { @@ -320,9 +301,7 @@ private function setIfExists(string $variableName, array $fields, mixed $default } /** - * Show all the invalid properties with reasons. - * - * @return string[] invalid properties with reasons + * {@inheritdoc} */ public function listInvalidProperties(): array { @@ -332,10 +311,7 @@ public function listInvalidProperties(): array } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid + * {@inheritdoc} */ public function valid(): bool { @@ -588,7 +564,7 @@ public function setTraderCompanyType(?string $traderCompanyType): static /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param int|string $offset Offset * * @return bool */ @@ -600,7 +576,7 @@ public function offsetExists(mixed $offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param int|string $offset Offset * * @return mixed|null */ @@ -613,7 +589,7 @@ public function offsetGet(mixed $offset): mixed /** * Sets value based on offset. * - * @param int|null $offset Offset + * @param int|string|null $offset Offset * @param mixed $value Value to be set * * @return void @@ -630,7 +606,7 @@ public function offsetSet(mixed $offset, mixed $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param int|string $offset Offset * * @return void */ diff --git a/src/Model/CheckVatResponse.php b/src/Model/CheckVatResponse.php index 3648cf8..5cfb2ea 100644 --- a/src/Model/CheckVatResponse.php +++ b/src/Model/CheckVatResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: 1.0.0 * @generated Generated by: https://openapi-generator.tech - * Generator version: 7.20.0 + * Generator version: 7.25.0 */ /** @@ -135,9 +135,7 @@ class CheckVatResponse implements ModelInterface, ArrayAccess, JsonSerializable protected array $openAPINullablesSetToNull = []; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array + * {@inheritdoc} */ public static function openAPITypes(): array { @@ -145,9 +143,7 @@ public static function openAPITypes(): array } /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array + * {@inheritdoc} */ public static function openAPIFormats(): array { @@ -185,10 +181,7 @@ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): } /** - * Checks if a property is nullable - * - * @param string $property - * @return bool + * {@inheritdoc} */ public static function isNullable(string $property): bool { @@ -196,10 +189,7 @@ public static function isNullable(string $property): bool } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool + * {@inheritdoc} */ public function isNullableSetToNull(string $property): bool { @@ -283,10 +273,7 @@ public function isNullableSetToNull(string $property): bool ]; /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array + * {@inheritdoc} */ public static function attributeMap(): array { @@ -294,9 +281,7 @@ public static function attributeMap(): array } /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array + * {@inheritdoc} */ public static function setters(): array { @@ -304,9 +289,7 @@ public static function setters(): array } /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array + * {@inheritdoc} */ public static function getters(): array { @@ -314,9 +297,7 @@ public static function getters(): array } /** - * The original name of the model. - * - * @return string + * {@inheritdoc} */ public function getModelName(): string { @@ -376,9 +357,7 @@ private function setIfExists(string $variableName, array $fields, mixed $default } /** - * Show all the invalid properties with reasons. - * - * @return string[] invalid properties with reasons + * {@inheritdoc} */ public function listInvalidProperties(): array { @@ -388,10 +367,7 @@ public function listInvalidProperties(): array } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid + * {@inheritdoc} */ public function valid(): bool { @@ -860,7 +836,7 @@ public function setTraderCompanyTypeMatch(?\Cone\Vies\Model\Status $traderCompan /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param int|string $offset Offset * * @return bool */ @@ -872,7 +848,7 @@ public function offsetExists(mixed $offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param int|string $offset Offset * * @return mixed|null */ @@ -885,7 +861,7 @@ public function offsetGet(mixed $offset): mixed /** * Sets value based on offset. * - * @param int|null $offset Offset + * @param int|string|null $offset Offset * @param mixed $value Value to be set * * @return void @@ -902,7 +878,7 @@ public function offsetSet(mixed $offset, mixed $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param int|string $offset Offset * * @return void */ diff --git a/src/Model/CommonResponse.php b/src/Model/CommonResponse.php index 1d4c965..b787731 100644 --- a/src/Model/CommonResponse.php +++ b/src/Model/CommonResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: 1.0.0 * @generated Generated by: https://openapi-generator.tech - * Generator version: 7.20.0 + * Generator version: 7.25.0 */ /** @@ -90,9 +90,7 @@ class CommonResponse implements ModelInterface, ArrayAccess, JsonSerializable protected array $openAPINullablesSetToNull = []; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array + * {@inheritdoc} */ public static function openAPITypes(): array { @@ -100,9 +98,7 @@ public static function openAPITypes(): array } /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array + * {@inheritdoc} */ public static function openAPIFormats(): array { @@ -140,10 +136,7 @@ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): } /** - * Checks if a property is nullable - * - * @param string $property - * @return bool + * {@inheritdoc} */ public static function isNullable(string $property): bool { @@ -151,10 +144,7 @@ public static function isNullable(string $property): bool } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool + * {@inheritdoc} */ public function isNullableSetToNull(string $property): bool { @@ -193,10 +183,7 @@ public function isNullableSetToNull(string $property): bool ]; /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array + * {@inheritdoc} */ public static function attributeMap(): array { @@ -204,9 +191,7 @@ public static function attributeMap(): array } /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array + * {@inheritdoc} */ public static function setters(): array { @@ -214,9 +199,7 @@ public static function setters(): array } /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array + * {@inheritdoc} */ public static function getters(): array { @@ -224,9 +207,7 @@ public static function getters(): array } /** - * The original name of the model. - * - * @return string + * {@inheritdoc} */ public function getModelName(): string { @@ -271,9 +252,7 @@ private function setIfExists(string $variableName, array $fields, mixed $default } /** - * Show all the invalid properties with reasons. - * - * @return string[] invalid properties with reasons + * {@inheritdoc} */ public function listInvalidProperties(): array { @@ -283,10 +262,7 @@ public function listInvalidProperties(): array } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid + * {@inheritdoc} */ public function valid(): bool { @@ -350,7 +326,7 @@ public function setErrorWrappers(?array $errorWrappers): static /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param int|string $offset Offset * * @return bool */ @@ -362,7 +338,7 @@ public function offsetExists(mixed $offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param int|string $offset Offset * * @return mixed|null */ @@ -375,7 +351,7 @@ public function offsetGet(mixed $offset): mixed /** * Sets value based on offset. * - * @param int|null $offset Offset + * @param int|string|null $offset Offset * @param mixed $value Value to be set * * @return void @@ -392,7 +368,7 @@ public function offsetSet(mixed $offset, mixed $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param int|string $offset Offset * * @return void */ diff --git a/src/Model/CountryStatus.php b/src/Model/CountryStatus.php index 059fa2a..add0c4b 100644 --- a/src/Model/CountryStatus.php +++ b/src/Model/CountryStatus.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: 1.0.0 * @generated Generated by: https://openapi-generator.tech - * Generator version: 7.20.0 + * Generator version: 7.25.0 */ /** @@ -90,9 +90,7 @@ class CountryStatus implements ModelInterface, ArrayAccess, JsonSerializable protected array $openAPINullablesSetToNull = []; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array + * {@inheritdoc} */ public static function openAPITypes(): array { @@ -100,9 +98,7 @@ public static function openAPITypes(): array } /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array + * {@inheritdoc} */ public static function openAPIFormats(): array { @@ -140,10 +136,7 @@ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): } /** - * Checks if a property is nullable - * - * @param string $property - * @return bool + * {@inheritdoc} */ public static function isNullable(string $property): bool { @@ -151,10 +144,7 @@ public static function isNullable(string $property): bool } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool + * {@inheritdoc} */ public function isNullableSetToNull(string $property): bool { @@ -193,10 +183,7 @@ public function isNullableSetToNull(string $property): bool ]; /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array + * {@inheritdoc} */ public static function attributeMap(): array { @@ -204,9 +191,7 @@ public static function attributeMap(): array } /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array + * {@inheritdoc} */ public static function setters(): array { @@ -214,9 +199,7 @@ public static function setters(): array } /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array + * {@inheritdoc} */ public static function getters(): array { @@ -224,9 +207,7 @@ public static function getters(): array } /** - * The original name of the model. - * - * @return string + * {@inheritdoc} */ public function getModelName(): string { @@ -288,9 +269,7 @@ private function setIfExists(string $variableName, array $fields, mixed $default } /** - * Show all the invalid properties with reasons. - * - * @return string[] invalid properties with reasons + * {@inheritdoc} */ public function listInvalidProperties(): array { @@ -309,10 +288,7 @@ public function listInvalidProperties(): array } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid + * {@inheritdoc} */ public function valid(): bool { @@ -386,7 +362,7 @@ public function setAvailability(?string $availability): static /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param int|string $offset Offset * * @return bool */ @@ -398,7 +374,7 @@ public function offsetExists(mixed $offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param int|string $offset Offset * * @return mixed|null */ @@ -411,7 +387,7 @@ public function offsetGet(mixed $offset): mixed /** * Sets value based on offset. * - * @param int|null $offset Offset + * @param int|string|null $offset Offset * @param mixed $value Value to be set * * @return void @@ -428,7 +404,7 @@ public function offsetSet(mixed $offset, mixed $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param int|string $offset Offset * * @return void */ diff --git a/src/Model/ErrorWrapper.php b/src/Model/ErrorWrapper.php index 28b17ea..e2c3040 100644 --- a/src/Model/ErrorWrapper.php +++ b/src/Model/ErrorWrapper.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: 1.0.0 * @generated Generated by: https://openapi-generator.tech - * Generator version: 7.20.0 + * Generator version: 7.25.0 */ /** @@ -91,9 +91,7 @@ class ErrorWrapper implements ModelInterface, ArrayAccess, JsonSerializable protected array $openAPINullablesSetToNull = []; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array + * {@inheritdoc} */ public static function openAPITypes(): array { @@ -101,9 +99,7 @@ public static function openAPITypes(): array } /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array + * {@inheritdoc} */ public static function openAPIFormats(): array { @@ -141,10 +137,7 @@ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): } /** - * Checks if a property is nullable - * - * @param string $property - * @return bool + * {@inheritdoc} */ public static function isNullable(string $property): bool { @@ -152,10 +145,7 @@ public static function isNullable(string $property): bool } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool + * {@inheritdoc} */ public function isNullableSetToNull(string $property): bool { @@ -194,10 +184,7 @@ public function isNullableSetToNull(string $property): bool ]; /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array + * {@inheritdoc} */ public static function attributeMap(): array { @@ -205,9 +192,7 @@ public static function attributeMap(): array } /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array + * {@inheritdoc} */ public static function setters(): array { @@ -215,9 +200,7 @@ public static function setters(): array } /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array + * {@inheritdoc} */ public static function getters(): array { @@ -225,9 +208,7 @@ public static function getters(): array } /** - * The original name of the model. - * - * @return string + * {@inheritdoc} */ public function getModelName(): string { @@ -272,9 +253,7 @@ private function setIfExists(string $variableName, array $fields, mixed $default } /** - * Show all the invalid properties with reasons. - * - * @return string[] invalid properties with reasons + * {@inheritdoc} */ public function listInvalidProperties(): array { @@ -284,10 +263,7 @@ public function listInvalidProperties(): array } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid + * {@inheritdoc} */ public function valid(): bool { @@ -351,7 +327,7 @@ public function setMessage(?string $message): static /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param int|string $offset Offset * * @return bool */ @@ -363,7 +339,7 @@ public function offsetExists(mixed $offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param int|string $offset Offset * * @return mixed|null */ @@ -376,7 +352,7 @@ public function offsetGet(mixed $offset): mixed /** * Sets value based on offset. * - * @param int|null $offset Offset + * @param int|string|null $offset Offset * @param mixed $value Value to be set * * @return void @@ -393,7 +369,7 @@ public function offsetSet(mixed $offset, mixed $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param int|string $offset Offset * * @return void */ diff --git a/src/Model/ModelInterface.php b/src/Model/ModelInterface.php index f3dc4b3..2a8859b 100644 --- a/src/Model/ModelInterface.php +++ b/src/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: 1.0.0 * @generated Generated by: https://openapi-generator.tech - * Generator version: 7.20.0 + * Generator version: 7.25.0 */ /** @@ -45,42 +45,43 @@ public function getModelName(): string; /** * Array of property to type mappings. Used for (de)serialization * - * @return array + * @return array */ public static function openAPITypes(): array; /** * Array of property to format mappings. Used for (de)serialization * - * @return array + * @return array */ public static function openAPIFormats(): array; /** - * Array of attributes where the key is the local name, and the value is the original name + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @return array */ public static function attributeMap(): array; /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ public static function setters(): array; /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ public static function getters(): array; /** * Show all the invalid properties with reasons. * - * @return array + * @return string[] invalid properties with reasons */ public function listInvalidProperties(): array; @@ -88,7 +89,7 @@ public function listInvalidProperties(): array; * Validate all the properties in the model * return true if all passed * - * @return bool + * @return bool True if all properties are valid */ public function valid(): bool; diff --git a/src/Model/OneOfInterface.php b/src/Model/OneOfInterface.php new file mode 100644 index 0000000..6047757 --- /dev/null +++ b/src/Model/OneOfInterface.php @@ -0,0 +1,65 @@ + + */ + public static function getOneOfDiscriminatorMappings(): array; +} diff --git a/src/Model/Status.php b/src/Model/Status.php index d228906..701b556 100644 --- a/src/Model/Status.php +++ b/src/Model/Status.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: 1.0.0 * @generated Generated by: https://openapi-generator.tech - * Generator version: 7.20.0 + * Generator version: 7.25.0 */ /** diff --git a/src/Model/StatusInformationResponse.php b/src/Model/StatusInformationResponse.php index 76138c6..4ef7d39 100644 --- a/src/Model/StatusInformationResponse.php +++ b/src/Model/StatusInformationResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: 1.0.0 * @generated Generated by: https://openapi-generator.tech - * Generator version: 7.20.0 + * Generator version: 7.25.0 */ /** @@ -90,9 +90,7 @@ class StatusInformationResponse implements ModelInterface, ArrayAccess, JsonSeri protected array $openAPINullablesSetToNull = []; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array + * {@inheritdoc} */ public static function openAPITypes(): array { @@ -100,9 +98,7 @@ public static function openAPITypes(): array } /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array + * {@inheritdoc} */ public static function openAPIFormats(): array { @@ -140,10 +136,7 @@ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): } /** - * Checks if a property is nullable - * - * @param string $property - * @return bool + * {@inheritdoc} */ public static function isNullable(string $property): bool { @@ -151,10 +144,7 @@ public static function isNullable(string $property): bool } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool + * {@inheritdoc} */ public function isNullableSetToNull(string $property): bool { @@ -193,10 +183,7 @@ public function isNullableSetToNull(string $property): bool ]; /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array + * {@inheritdoc} */ public static function attributeMap(): array { @@ -204,9 +191,7 @@ public static function attributeMap(): array } /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array + * {@inheritdoc} */ public static function setters(): array { @@ -214,9 +199,7 @@ public static function setters(): array } /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array + * {@inheritdoc} */ public static function getters(): array { @@ -224,9 +207,7 @@ public static function getters(): array } /** - * The original name of the model. - * - * @return string + * {@inheritdoc} */ public function getModelName(): string { @@ -271,9 +252,7 @@ private function setIfExists(string $variableName, array $fields, mixed $default } /** - * Show all the invalid properties with reasons. - * - * @return string[] invalid properties with reasons + * {@inheritdoc} */ public function listInvalidProperties(): array { @@ -283,10 +262,7 @@ public function listInvalidProperties(): array } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid + * {@inheritdoc} */ public function valid(): bool { @@ -350,7 +326,7 @@ public function setCountries(?array $countries): static /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param int|string $offset Offset * * @return bool */ @@ -362,7 +338,7 @@ public function offsetExists(mixed $offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param int|string $offset Offset * * @return mixed|null */ @@ -375,7 +351,7 @@ public function offsetGet(mixed $offset): mixed /** * Sets value based on offset. * - * @param int|null $offset Offset + * @param int|string|null $offset Offset * @param mixed $value Value to be set * * @return void @@ -392,7 +368,7 @@ public function offsetSet(mixed $offset, mixed $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param int|string $offset Offset * * @return void */ diff --git a/src/Model/StatusInformationResponseVow.php b/src/Model/StatusInformationResponseVow.php index d258233..b934267 100644 --- a/src/Model/StatusInformationResponseVow.php +++ b/src/Model/StatusInformationResponseVow.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: 1.0.0 * @generated Generated by: https://openapi-generator.tech - * Generator version: 7.20.0 + * Generator version: 7.25.0 */ /** @@ -87,9 +87,7 @@ class StatusInformationResponseVow implements ModelInterface, ArrayAccess, JsonS protected array $openAPINullablesSetToNull = []; /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array + * {@inheritdoc} */ public static function openAPITypes(): array { @@ -97,9 +95,7 @@ public static function openAPITypes(): array } /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array + * {@inheritdoc} */ public static function openAPIFormats(): array { @@ -137,10 +133,7 @@ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): } /** - * Checks if a property is nullable - * - * @param string $property - * @return bool + * {@inheritdoc} */ public static function isNullable(string $property): bool { @@ -148,10 +141,7 @@ public static function isNullable(string $property): bool } /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool + * {@inheritdoc} */ public function isNullableSetToNull(string $property): bool { @@ -187,10 +177,7 @@ public function isNullableSetToNull(string $property): bool ]; /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array + * {@inheritdoc} */ public static function attributeMap(): array { @@ -198,9 +185,7 @@ public static function attributeMap(): array } /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array + * {@inheritdoc} */ public static function setters(): array { @@ -208,9 +193,7 @@ public static function setters(): array } /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array + * {@inheritdoc} */ public static function getters(): array { @@ -218,9 +201,7 @@ public static function getters(): array } /** - * The original name of the model. - * - * @return string + * {@inheritdoc} */ public function getModelName(): string { @@ -264,9 +245,7 @@ private function setIfExists(string $variableName, array $fields, mixed $default } /** - * Show all the invalid properties with reasons. - * - * @return string[] invalid properties with reasons + * {@inheritdoc} */ public function listInvalidProperties(): array { @@ -276,10 +255,7 @@ public function listInvalidProperties(): array } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid + * {@inheritdoc} */ public function valid(): bool { @@ -316,7 +292,7 @@ public function setAvailable(?bool $available): static /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param int|string $offset Offset * * @return bool */ @@ -328,7 +304,7 @@ public function offsetExists(mixed $offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param int|string $offset Offset * * @return mixed|null */ @@ -341,7 +317,7 @@ public function offsetGet(mixed $offset): mixed /** * Sets value based on offset. * - * @param int|null $offset Offset + * @param int|string|null $offset Offset * @param mixed $value Value to be set * * @return void @@ -358,7 +334,7 @@ public function offsetSet(mixed $offset, mixed $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param int|string $offset Offset * * @return void */ diff --git a/src/ObjectSerializer.php b/src/ObjectSerializer.php index 1f61e69..4a9b144 100644 --- a/src/ObjectSerializer.php +++ b/src/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: 1.0.0 * @generated Generated by: https://openapi-generator.tech - * Generator version: 7.20.0 + * Generator version: 7.25.0 */ /** @@ -120,7 +120,7 @@ public static function sanitizeForSerialization(mixed $data, ?string $type = nul $values[$property] = self::sanitizeForSerialization($value); } } - return (object)$values; + return (object) $values; } else { return (string)$data; } @@ -206,6 +206,31 @@ private static function isEmptyValue(mixed $value, string $openApiType): bool }; } + /** + * Convert objects into arrays, recursively. + * + * sanitizeForSerialization() returns an object per model, but query parameters + * are flattened from arrays. + * + * @param mixed $data + * + * @return mixed the data with every object converted to an array + */ + private static function toArrayRecursive(mixed $data): mixed + { + if (is_array($data) || is_object($data)) { + $result = []; + + foreach ($data as $key => $value) { + $result[$key] = self::toArrayRecursive($value); + } + + return $result; + } + + return $data; + } + /** * Take query parameter properties and turn it into an array suitable for * native http_build_query or GuzzleHttp\Psr7\Query::build. @@ -241,12 +266,23 @@ public static function toQueryValue( } // Handle DateTime objects in query - if ($openApiType === "\DateTime" && $value instanceof DateTime) { + if ($openApiType === "string" && $value instanceof DateTime) { return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; } + // A model is typed with its class name rather than "object", but serializes as one. + if ($value instanceof ModelInterface) { + $openApiType = 'object'; + } + $query = []; - $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; + if ($openApiType === 'object' && is_object($value)) { + // Read the model's values through its getters; a plain (array) cast + // would expose only the protected $container holding them. + $value = self::toArrayRecursive(self::sanitizeForSerialization($value)); + } elseif (in_array($openApiType, ['object', 'array'], true)) { + $value = (array) $value; + } // since \GuzzleHttp\Psr7\Query::build fails with nested arrays // need to flatten array first @@ -498,10 +534,23 @@ public static function deserialize(mixed $data, string $class, ?array $httpHeade } return $data; } else { - $data = is_string($data) ? json_decode($data) : $data; + if (is_string($data)) { + $decoded = json_decode($data); + // Keep the original string if decode fails (nested values are already PHP strings). + $data = ($decoded !== null || $data === 'null') ? $decoded : $data; + } + + // A oneOf/anyOf schema is not a value object: dispatch here, after json_decode (so + // members get the decoded value) but before the array-to-object cast (which breaks arrays). + if (is_subclass_of($class, '\Cone\Vies\Model\OneOfInterface')) { + return self::deserializeOneOf($data, $class, $httpHeaders); + } + if (is_subclass_of($class, '\Cone\Vies\Model\AnyOfInterface')) { + return self::deserializeAnyOf($data, $class, $httpHeaders); + } if (is_array($data)) { - $data = (object)$data; + $data = (object) $data; } // If a discriminator is defined and points to a valid subclass, use it. @@ -539,6 +588,131 @@ public static function deserialize(mixed $data, string $class, ?array $httpHeade } } + /** + * Returns true when $data's PHP type is compatible with the OpenAPI primitive $type. + * Prevents settype() coercion (e.g. "abc" → 0 for integer) from producing a false match + * when iterating over oneOf/anyOf candidate types. + * Non-primitive types always return true and are validated downstream by ModelInterface::valid(). + */ + private static function isPrimitiveTypeCompatible(mixed $data, string $type): bool + { + return match($type) { + 'int', 'integer' => is_int($data), + 'float', 'double', 'number' => is_int($data) || is_float($data), + 'bool', 'boolean' => is_bool($data), + 'string' => is_string($data), + 'array' => is_array($data), + 'object' => is_object($data), + default => true, + }; + } + + /** + * Deserialize data into one of the member types of a `oneOf` schema. + * + * When the schema declares a discriminator, its value selects the member type directly. + * Otherwise each member type is tried in turn and the first one that yields a valid model + * (or a non-null primitive) is returned. + * + * @param mixed $data the decoded data to resolve to a member type + * @param string $class a class name implementing OneOfInterface + * @param string[]|null $httpHeaders HTTP headers + * + * @return mixed an instance of one of the `oneOf` member types + */ + private static function deserializeOneOf(mixed $data, string $class, ?array $httpHeaders): mixed + { + // $data is already decoded (see deserialize()). Read the discriminator from an object view + // of it, but deserialize each member from the original $data so array and scalar members + // keep their own type handling instead of being coerced to an object here. + $probe = is_array($data) ? (object) $data : $data; + + $discriminator = $class::getOneOfDiscriminator(); + if ($discriminator !== null && is_object($probe) && isset($probe->{$discriminator}) && is_string($probe->{$discriminator})) { + $mappings = $class::getOneOfDiscriminatorMappings(); + if (isset($mappings[$probe->{$discriminator}])) { + return self::deserialize($data, $mappings[$probe->{$discriminator}], $httpHeaders); + } + } + + foreach ($class::getOneOfTypes() as $type) { + if (!self::isPrimitiveTypeCompatible($data, $type)) { + continue; + } + try { + $instance = self::deserialize($data, $type, $httpHeaders); + } catch (\Throwable $e) { + // Any failure means the data does not match this member type; try the next one. + // The broad catch is intentional: a real failure is not hidden, since the loop + // throws below when no member type matches. + continue; + } + + if ($instance instanceof ModelInterface) { + if ($instance->valid()) { + return $instance; + } + } elseif ($instance !== null) { + return $instance; + } + } + + throw new \InvalidArgumentException(sprintf('No matching schema in oneOf %s for the given data', $class)); + } + + /** + * Deserialize data into one of the member types of an `anyOf` schema. + * + * When the schema declares a discriminator, its value selects the member type directly. + * Otherwise each member type is tried in turn and the first one that yields a valid model + * (or a non-null primitive) is returned. + * + * @param mixed $data the decoded data to resolve to a member type + * @param string $class a class name implementing AnyOfInterface + * @param string[]|null $httpHeaders HTTP headers + * + * @return mixed an instance of one of the `anyOf` member types + */ + private static function deserializeAnyOf(mixed $data, string $class, ?array $httpHeaders): mixed + { + // $data is already decoded (see deserialize()). Read the discriminator from an object view + // of it, but deserialize each member from the original $data so array and scalar members + // keep their own type handling instead of being coerced to an object here. + $probe = is_array($data) ? (object) $data : $data; + + $discriminator = $class::getAnyOfDiscriminator(); + if ($discriminator !== null && is_object($probe) && isset($probe->{$discriminator}) && is_string($probe->{$discriminator})) { + $mappings = $class::getAnyOfDiscriminatorMappings(); + if (isset($mappings[$probe->{$discriminator}])) { + return self::deserialize($data, $mappings[$probe->{$discriminator}], $httpHeaders); + } + } + + foreach ($class::getAnyOfTypes() as $type) { + if (!self::isPrimitiveTypeCompatible($data, $type)) { + continue; + } + try { + $instance = self::deserialize($data, $type, $httpHeaders); + } catch (\Throwable $e) { + // Any failure means the data does not match this member type; try the next one. + // The broad catch is intentional: a real failure is not hidden, since the loop + // throws below when no member type matches. + continue; + } + + if ($instance instanceof ModelInterface) { + if ($instance->valid()) { + return $instance; + } + } elseif ($instance !== null) { + return $instance; + } + } + + throw new \InvalidArgumentException(sprintf('No matching schema in anyOf %s for the given data', $class)); + } + /** * Build a query string from an array of key value pairs. *