diff --git a/modules/openapi-generator/src/main/resources/php/model_generic.mustache b/modules/openapi-generator/src/main/resources/php/model_generic.mustache index ec2140c2a9d..8099e7dc18f 100644 --- a/modules/openapi-generator/src/main/resources/php/model_generic.mustache +++ b/modules/openapi-generator/src/main/resources/php/model_generic.mustache @@ -1,4 +1,4 @@ -class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^parentSchema}}implements ModelInterface, ArrayAccess{{/parentSchema}} +class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^parentSchema}}implements ModelInterface, ArrayAccess, \JsonSerializable{{/parentSchema}} { public const DISCRIMINATOR = {{#discriminator}}'{{discriminatorName}}'{{/discriminator}}{{^discriminator}}null{{/discriminator}}; @@ -400,6 +400,18 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^pa unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/AdditionalPropertiesClass.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/AdditionalPropertiesClass.php index 81a3499d8d7..daf4cd03553 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/AdditionalPropertiesClass.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/AdditionalPropertiesClass.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class AdditionalPropertiesClass implements ModelInterface, ArrayAccess +class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -315,6 +315,18 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Animal.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Animal.php index a271cc089bf..9066533e9b7 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Animal.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Animal.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class Animal implements ModelInterface, ArrayAccess +class Animal implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = 'class_name'; @@ -321,6 +321,18 @@ class Animal implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ApiResponse.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ApiResponse.php index e79cbda775c..a3b83b0cfa4 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ApiResponse.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ApiResponse.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class ApiResponse implements ModelInterface, ArrayAccess +class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -345,6 +345,18 @@ class ApiResponse implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayOfArrayOfNumberOnly.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayOfArrayOfNumberOnly.php index 1678eae2ede..d0fda8d6114 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayOfArrayOfNumberOnly.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayOfArrayOfNumberOnly.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess +class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -285,6 +285,18 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayOfNumberOnly.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayOfNumberOnly.php index be734d3b197..bab8cb3bf6e 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayOfNumberOnly.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayOfNumberOnly.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class ArrayOfNumberOnly implements ModelInterface, ArrayAccess +class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -285,6 +285,18 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayTest.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayTest.php index 7a75b3a8890..dca12a3300b 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayTest.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class ArrayTest implements ModelInterface, ArrayAccess +class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -345,6 +345,18 @@ class ArrayTest implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Capitalization.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Capitalization.php index 87facb63e0c..ae16be4ad11 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Capitalization.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Capitalization.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class Capitalization implements ModelInterface, ArrayAccess +class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -435,6 +435,18 @@ class Capitalization implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Cat.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Cat.php index dec9256e001..d4b42305f5b 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Cat.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Cat.php @@ -279,6 +279,18 @@ class Cat extends Animal unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/CatAllOf.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/CatAllOf.php index cb687fa898e..0762d914d84 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/CatAllOf.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/CatAllOf.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class CatAllOf implements ModelInterface, ArrayAccess +class CatAllOf implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -285,6 +285,18 @@ class CatAllOf implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Category.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Category.php index c3c3602e9f9..e6fdac7f010 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Category.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Category.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class Category implements ModelInterface, ArrayAccess +class Category implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -318,6 +318,18 @@ class Category implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ClassModel.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ClassModel.php index 041b6337be9..fb175d42647 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ClassModel.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ClassModel.php @@ -44,7 +44,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class ClassModel implements ModelInterface, ArrayAccess +class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -286,6 +286,18 @@ class ClassModel implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Client.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Client.php index 5be1902d0a2..a14f1c0b221 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Client.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Client.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class Client implements ModelInterface, ArrayAccess +class Client implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -285,6 +285,18 @@ class Client implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Dog.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Dog.php index d4eb2811544..eba46f532f3 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Dog.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Dog.php @@ -279,6 +279,18 @@ class Dog extends Animal unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/DogAllOf.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/DogAllOf.php index 9696b379476..acc78baf26f 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/DogAllOf.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/DogAllOf.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class DogAllOf implements ModelInterface, ArrayAccess +class DogAllOf implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -285,6 +285,18 @@ class DogAllOf implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/EnumArrays.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/EnumArrays.php index 1b1436fe18f..2275c05aac1 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/EnumArrays.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/EnumArrays.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class EnumArrays implements ModelInterface, ArrayAccess +class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -371,6 +371,18 @@ class EnumArrays implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/EnumTest.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/EnumTest.php index 397dddb1c20..118a0a2ae09 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/EnumTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/EnumTest.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class EnumTest implements ModelInterface, ArrayAccess +class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -630,6 +630,18 @@ class EnumTest implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/File.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/File.php index 071669c48d4..aef77faed22 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/File.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/File.php @@ -44,7 +44,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class File implements ModelInterface, ArrayAccess +class File implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -286,6 +286,18 @@ class File implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FileSchemaTestClass.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FileSchemaTestClass.php index be014cca129..e68c14dcc19 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FileSchemaTestClass.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FileSchemaTestClass.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class FileSchemaTestClass implements ModelInterface, ArrayAccess +class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -315,6 +315,18 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Foo.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Foo.php index 152b602f451..e1321ebb448 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Foo.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Foo.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class Foo implements ModelInterface, ArrayAccess +class Foo implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -285,6 +285,18 @@ class Foo implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FormatTest.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FormatTest.php index 817764f8c37..124db285c26 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FormatTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FormatTest.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class FormatTest implements ModelInterface, ArrayAccess +class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -839,6 +839,18 @@ class FormatTest implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/HasOnlyReadOnly.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/HasOnlyReadOnly.php index 78a8753aca7..65115a0d50d 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/HasOnlyReadOnly.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/HasOnlyReadOnly.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class HasOnlyReadOnly implements ModelInterface, ArrayAccess +class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -315,6 +315,18 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/HealthCheckResult.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/HealthCheckResult.php index 73f41bd67eb..8c4ad1a6376 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/HealthCheckResult.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/HealthCheckResult.php @@ -44,7 +44,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class HealthCheckResult implements ModelInterface, ArrayAccess +class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -286,6 +286,18 @@ class HealthCheckResult implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject.php index 4f621cd478a..7276352b917 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class InlineObject implements ModelInterface, ArrayAccess +class InlineObject implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -315,6 +315,18 @@ class InlineObject implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject1.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject1.php index 5a8e35b8463..6f675c2c744 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject1.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject1.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class InlineObject1 implements ModelInterface, ArrayAccess +class InlineObject1 implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -315,6 +315,18 @@ class InlineObject1 implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject2.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject2.php index 5bc7a4051fb..e932c0923e5 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject2.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject2.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class InlineObject2 implements ModelInterface, ArrayAccess +class InlineObject2 implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -373,6 +373,18 @@ class InlineObject2 implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject3.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject3.php index c578cb156d2..ba3ddd211b4 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject3.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject3.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class InlineObject3 implements ModelInterface, ArrayAccess +class InlineObject3 implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -793,6 +793,18 @@ class InlineObject3 implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject4.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject4.php index 5fd4bc02241..4ec235df1f3 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject4.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject4.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class InlineObject4 implements ModelInterface, ArrayAccess +class InlineObject4 implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -321,6 +321,18 @@ class InlineObject4 implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject5.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject5.php index af2410338d5..eef18f95db2 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject5.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject5.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class InlineObject5 implements ModelInterface, ArrayAccess +class InlineObject5 implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -318,6 +318,18 @@ class InlineObject5 implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineResponseDefault.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineResponseDefault.php index d59fd178654..8ee7005ed47 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineResponseDefault.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineResponseDefault.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class InlineResponseDefault implements ModelInterface, ArrayAccess +class InlineResponseDefault implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -285,6 +285,18 @@ class InlineResponseDefault implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MapTest.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MapTest.php index 055a190f94a..4f90f8bd3c9 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MapTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MapTest.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class MapTest implements ModelInterface, ArrayAccess +class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -399,6 +399,18 @@ class MapTest implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MixedPropertiesAndAdditionalPropertiesClass.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MixedPropertiesAndAdditionalPropertiesClass.php index 92b5bd77972..8da96c23d7b 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MixedPropertiesAndAdditionalPropertiesClass.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MixedPropertiesAndAdditionalPropertiesClass.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, ArrayAccess +class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -345,6 +345,18 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Model200Response.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Model200Response.php index 820f723b075..d3448a08a6c 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Model200Response.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Model200Response.php @@ -44,7 +44,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class Model200Response implements ModelInterface, ArrayAccess +class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -316,6 +316,18 @@ class Model200Response implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelList.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelList.php index 68e72f7babc..597e5637ac3 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelList.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelList.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class ModelList implements ModelInterface, ArrayAccess +class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -285,6 +285,18 @@ class ModelList implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelReturn.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelReturn.php index b36cab5bef2..bfcc6592f09 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelReturn.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelReturn.php @@ -44,7 +44,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class ModelReturn implements ModelInterface, ArrayAccess +class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -286,6 +286,18 @@ class ModelReturn implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Name.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Name.php index 373384beb13..2817922a7f8 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Name.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Name.php @@ -44,7 +44,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class Name implements ModelInterface, ArrayAccess +class Name implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -379,6 +379,18 @@ class Name implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NullableClass.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NullableClass.php index e3882176118..2ae73e01826 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NullableClass.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NullableClass.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class NullableClass implements ModelInterface, ArrayAccess +class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -615,6 +615,18 @@ class NullableClass implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NumberOnly.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NumberOnly.php index e1711295beb..7c0d0a412ce 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NumberOnly.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NumberOnly.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class NumberOnly implements ModelInterface, ArrayAccess +class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -285,6 +285,18 @@ class NumberOnly implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Order.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Order.php index dcecafd9a80..6fce620c942 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Order.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Order.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class Order implements ModelInterface, ArrayAccess +class Order implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -469,6 +469,18 @@ class Order implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/OuterComposite.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/OuterComposite.php index a66e335b1a2..45680560515 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/OuterComposite.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/OuterComposite.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class OuterComposite implements ModelInterface, ArrayAccess +class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -345,6 +345,18 @@ class OuterComposite implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Pet.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Pet.php index ff197d2c3ff..38f84c84ec5 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Pet.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Pet.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class Pet implements ModelInterface, ArrayAccess +class Pet implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -475,6 +475,18 @@ class Pet implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ReadOnlyFirst.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ReadOnlyFirst.php index fe323668361..3c08bcd2990 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ReadOnlyFirst.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ReadOnlyFirst.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class ReadOnlyFirst implements ModelInterface, ArrayAccess +class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -315,6 +315,18 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/SpecialModelName.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/SpecialModelName.php index 967231c35ff..aca6db8790e 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/SpecialModelName.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/SpecialModelName.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class SpecialModelName implements ModelInterface, ArrayAccess +class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -285,6 +285,18 @@ class SpecialModelName implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Tag.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Tag.php index f4f85825e58..60f6c738ab6 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Tag.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Tag.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class Tag implements ModelInterface, ArrayAccess +class Tag implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -315,6 +315,18 @@ class Tag implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/User.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/User.php index f2436c70ad4..555268a5814 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/User.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/User.php @@ -43,7 +43,7 @@ use \OpenAPI\Client\ObjectSerializer; * @template TKey int|null * @template TValue mixed|null */ -class User implements ModelInterface, ArrayAccess +class User implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -495,6 +495,18 @@ class User implements ModelInterface, ArrayAccess unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + /** * Gets the string presentation of the object *