[PHP] Add support to nullable (based on #3493) (#12794)

* [PHP] Add support to nullable (based on PR 3493)

* [AUTOGENERATED] update samples
This commit is contained in:
Thomas Hansen 2022-07-11 18:00:39 +02:00 committed by GitHub
parent 20420e5e14
commit cd48db43b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 4258 additions and 129 deletions

View File

@ -83,4 +83,20 @@ interface ModelInterface
* @return bool * @return bool
*/ */
public function valid(); public function valid();
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool;
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool;
} }

View File

@ -89,7 +89,7 @@ class ObjectSerializer
} }
} }
} }
if ($value !== null) { if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) {
$values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]);
} }
} }
@ -460,7 +460,15 @@ class ObjectSerializer
foreach ($instance::openAPITypes() as $property => $type) { foreach ($instance::openAPITypes() as $property => $type) {
$propertySetter = $instance::setters()[$property]; $propertySetter = $instance::setters()[$property];
if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) { if (!isset($propertySetter)) {
continue;
}
if (!isset($data->{$instance::attributeMap()[$property]})) {
if ($instance::isNullable($property)) {
$instance->$propertySetter(null);
}
continue; continue;
} }

View File

@ -31,6 +31,23 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
{{/-last}}{{/vars}} {{/-last}}{{/vars}}
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
{{#vars}}'{{name}}' => {{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{^-last}},
{{/-last}}{{/vars}}
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -51,6 +68,48 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
return self::$openAPIFormats{{#parentSchema}} + parent::openAPIFormats(){{/parentSchema}}; return self::$openAPIFormats{{#parentSchema}} + parent::openAPIFormats(){{/parentSchema}};
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables{{#parentSchema}} + parent::openAPINullables(){{/parentSchema}};
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -172,7 +231,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
{{/parentSchema}} {{/parentSchema}}
{{#vars}} {{#vars}}
$this->container['{{name}}'] = $data['{{name}}'] ?? {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}}; $this->setIfExists('{{name}}', $data ?? [], {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}});
{{/vars}} {{/vars}}
{{#discriminator}} {{#discriminator}}
@ -181,6 +240,24 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
{{/discriminator}} {{/discriminator}}
} }
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/** /**
* Show all the invalid properties with reasons. * Show all the invalid properties with reasons.
* *
@ -359,6 +436,25 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
} }
{{/minItems}} {{/minItems}}
{{/hasValidation}} {{/hasValidation}}
{{#isNullable}}
if (is_null(${{name}})) {
array_push($this->openAPINullablesSetToNull, '{{name}}');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('{{name}}', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
{{/isNullable}}
{{^isNullable}}
if (is_null(${{name}})) {
throw new \InvalidArgumentException('non-nullable {{name}} cannot be null');
}
{{/isNullable}}
$this->container['{{name}}'] = ${{name}}; $this->container['{{name}}'] = ${{name}};
return $this; return $this;

View File

@ -73,6 +73,23 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
'map_of_map_property' => null 'map_of_map_property' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'map_property' => false,
'map_of_map_property' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -93,6 +110,48 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -181,8 +240,26 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['map_property'] = $data['map_property'] ?? null; $this->setIfExists('map_property', $data ?? [], null);
$this->container['map_of_map_property'] = $data['map_of_map_property'] ?? null; $this->setIfExists('map_of_map_property', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -228,6 +305,11 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
*/ */
public function setMapProperty($map_property) public function setMapProperty($map_property)
{ {
if (is_null($map_property)) {
throw new \InvalidArgumentException('non-nullable map_property cannot be null');
}
$this->container['map_property'] = $map_property; $this->container['map_property'] = $map_property;
return $this; return $this;
@ -252,6 +334,11 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
*/ */
public function setMapOfMapProperty($map_of_map_property) public function setMapOfMapProperty($map_of_map_property)
{ {
if (is_null($map_of_map_property)) {
throw new \InvalidArgumentException('non-nullable map_of_map_property cannot be null');
}
$this->container['map_of_map_property'] = $map_of_map_property; $this->container['map_of_map_property'] = $map_of_map_property;
return $this; return $this;

View File

@ -73,6 +73,23 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
'single_ref_type' => null 'single_ref_type' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'username' => false,
'single_ref_type' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -93,6 +110,48 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -181,8 +240,26 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['username'] = $data['username'] ?? null; $this->setIfExists('username', $data ?? [], null);
$this->container['single_ref_type'] = $data['single_ref_type'] ?? null; $this->setIfExists('single_ref_type', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -228,6 +305,11 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
*/ */
public function setUsername($username) public function setUsername($username)
{ {
if (is_null($username)) {
throw new \InvalidArgumentException('non-nullable username cannot be null');
}
$this->container['username'] = $username; $this->container['username'] = $username;
return $this; return $this;
@ -252,6 +334,18 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
*/ */
public function setSingleRefType($single_ref_type) public function setSingleRefType($single_ref_type)
{ {
if (is_null($single_ref_type)) {
array_push($this->openAPINullablesSetToNull, 'single_ref_type');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('single_ref_type', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['single_ref_type'] = $single_ref_type; $this->container['single_ref_type'] = $single_ref_type;
return $this; return $this;

View File

@ -73,6 +73,23 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
'color' => null 'color' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'class_name' => false,
'color' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -93,6 +110,48 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -181,13 +240,31 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['class_name'] = $data['class_name'] ?? null; $this->setIfExists('class_name', $data ?? [], null);
$this->container['color'] = $data['color'] ?? 'red'; $this->setIfExists('color', $data ?? [], 'red');
// Initialize discriminator property with the model name. // Initialize discriminator property with the model name.
$this->container['class_name'] = static::$openAPIModelName; $this->container['class_name'] = static::$openAPIModelName;
} }
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/** /**
* Show all the invalid properties with reasons. * Show all the invalid properties with reasons.
* *
@ -234,6 +311,11 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setClassName($class_name) public function setClassName($class_name)
{ {
if (is_null($class_name)) {
throw new \InvalidArgumentException('non-nullable class_name cannot be null');
}
$this->container['class_name'] = $class_name; $this->container['class_name'] = $class_name;
return $this; return $this;
@ -258,6 +340,11 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setColor($color) public function setColor($color)
{ {
if (is_null($color)) {
throw new \InvalidArgumentException('non-nullable color cannot be null');
}
$this->container['color'] = $color; $this->container['color'] = $color;
return $this; return $this;

View File

@ -75,6 +75,24 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
'message' => null 'message' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'code' => false,
'type' => false,
'message' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -95,6 +113,48 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -186,9 +246,27 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['code'] = $data['code'] ?? null; $this->setIfExists('code', $data ?? [], null);
$this->container['type'] = $data['type'] ?? null; $this->setIfExists('type', $data ?? [], null);
$this->container['message'] = $data['message'] ?? null; $this->setIfExists('message', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -234,6 +312,11 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setCode($code) public function setCode($code)
{ {
if (is_null($code)) {
throw new \InvalidArgumentException('non-nullable code cannot be null');
}
$this->container['code'] = $code; $this->container['code'] = $code;
return $this; return $this;
@ -258,6 +341,11 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setType($type) public function setType($type)
{ {
if (is_null($type)) {
throw new \InvalidArgumentException('non-nullable type cannot be null');
}
$this->container['type'] = $type; $this->container['type'] = $type;
return $this; return $this;
@ -282,6 +370,11 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setMessage($message) public function setMessage($message)
{ {
if (is_null($message)) {
throw new \InvalidArgumentException('non-nullable message cannot be null');
}
$this->container['message'] = $message; $this->container['message'] = $message;
return $this; return $this;

View File

@ -71,6 +71,22 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSeri
'array_array_number' => null 'array_array_number' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'array_array_number' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -91,6 +107,48 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSeri
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -176,7 +234,25 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSeri
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['array_array_number'] = $data['array_array_number'] ?? null; $this->setIfExists('array_array_number', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -222,6 +298,11 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSeri
*/ */
public function setArrayArrayNumber($array_array_number) public function setArrayArrayNumber($array_array_number)
{ {
if (is_null($array_array_number)) {
throw new \InvalidArgumentException('non-nullable array_array_number cannot be null');
}
$this->container['array_array_number'] = $array_array_number; $this->container['array_array_number'] = $array_array_number;
return $this; return $this;

View File

@ -71,6 +71,22 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializabl
'array_number' => null 'array_number' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'array_number' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -91,6 +107,48 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializabl
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -176,7 +234,25 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializabl
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['array_number'] = $data['array_number'] ?? null; $this->setIfExists('array_number', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -222,6 +298,11 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializabl
*/ */
public function setArrayNumber($array_number) public function setArrayNumber($array_number)
{ {
if (is_null($array_number)) {
throw new \InvalidArgumentException('non-nullable array_number cannot be null');
}
$this->container['array_number'] = $array_number; $this->container['array_number'] = $array_number;
return $this; return $this;

View File

@ -75,6 +75,24 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
'array_array_of_model' => null 'array_array_of_model' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'array_of_string' => false,
'array_array_of_integer' => false,
'array_array_of_model' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -95,6 +113,48 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -186,9 +246,27 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['array_of_string'] = $data['array_of_string'] ?? null; $this->setIfExists('array_of_string', $data ?? [], null);
$this->container['array_array_of_integer'] = $data['array_array_of_integer'] ?? null; $this->setIfExists('array_array_of_integer', $data ?? [], null);
$this->container['array_array_of_model'] = $data['array_array_of_model'] ?? null; $this->setIfExists('array_array_of_model', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -249,6 +327,11 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
if (!is_null($array_of_string) && (count($array_of_string) < 0)) { if (!is_null($array_of_string) && (count($array_of_string) < 0)) {
throw new \InvalidArgumentException('invalid length for $array_of_string when calling ArrayTest., number of items must be greater than or equal to 0.'); throw new \InvalidArgumentException('invalid length for $array_of_string when calling ArrayTest., number of items must be greater than or equal to 0.');
} }
if (is_null($array_of_string)) {
throw new \InvalidArgumentException('non-nullable array_of_string cannot be null');
}
$this->container['array_of_string'] = $array_of_string; $this->container['array_of_string'] = $array_of_string;
return $this; return $this;
@ -273,6 +356,11 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setArrayArrayOfInteger($array_array_of_integer) public function setArrayArrayOfInteger($array_array_of_integer)
{ {
if (is_null($array_array_of_integer)) {
throw new \InvalidArgumentException('non-nullable array_array_of_integer cannot be null');
}
$this->container['array_array_of_integer'] = $array_array_of_integer; $this->container['array_array_of_integer'] = $array_array_of_integer;
return $this; return $this;
@ -297,6 +385,11 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setArrayArrayOfModel($array_array_of_model) public function setArrayArrayOfModel($array_array_of_model)
{ {
if (is_null($array_array_of_model)) {
throw new \InvalidArgumentException('non-nullable array_array_of_model cannot be null');
}
$this->container['array_array_of_model'] = $array_array_of_model; $this->container['array_array_of_model'] = $array_array_of_model;
return $this; return $this;

View File

@ -81,6 +81,27 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
'att_name' => null 'att_name' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'small_camel' => false,
'capital_camel' => false,
'small_snake' => false,
'capital_snake' => false,
'sca_eth_flow_points' => false,
'att_name' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -101,6 +122,48 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -201,12 +264,30 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['small_camel'] = $data['small_camel'] ?? null; $this->setIfExists('small_camel', $data ?? [], null);
$this->container['capital_camel'] = $data['capital_camel'] ?? null; $this->setIfExists('capital_camel', $data ?? [], null);
$this->container['small_snake'] = $data['small_snake'] ?? null; $this->setIfExists('small_snake', $data ?? [], null);
$this->container['capital_snake'] = $data['capital_snake'] ?? null; $this->setIfExists('capital_snake', $data ?? [], null);
$this->container['sca_eth_flow_points'] = $data['sca_eth_flow_points'] ?? null; $this->setIfExists('sca_eth_flow_points', $data ?? [], null);
$this->container['att_name'] = $data['att_name'] ?? null; $this->setIfExists('att_name', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -252,6 +333,11 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setSmallCamel($small_camel) public function setSmallCamel($small_camel)
{ {
if (is_null($small_camel)) {
throw new \InvalidArgumentException('non-nullable small_camel cannot be null');
}
$this->container['small_camel'] = $small_camel; $this->container['small_camel'] = $small_camel;
return $this; return $this;
@ -276,6 +362,11 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setCapitalCamel($capital_camel) public function setCapitalCamel($capital_camel)
{ {
if (is_null($capital_camel)) {
throw new \InvalidArgumentException('non-nullable capital_camel cannot be null');
}
$this->container['capital_camel'] = $capital_camel; $this->container['capital_camel'] = $capital_camel;
return $this; return $this;
@ -300,6 +391,11 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setSmallSnake($small_snake) public function setSmallSnake($small_snake)
{ {
if (is_null($small_snake)) {
throw new \InvalidArgumentException('non-nullable small_snake cannot be null');
}
$this->container['small_snake'] = $small_snake; $this->container['small_snake'] = $small_snake;
return $this; return $this;
@ -324,6 +420,11 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setCapitalSnake($capital_snake) public function setCapitalSnake($capital_snake)
{ {
if (is_null($capital_snake)) {
throw new \InvalidArgumentException('non-nullable capital_snake cannot be null');
}
$this->container['capital_snake'] = $capital_snake; $this->container['capital_snake'] = $capital_snake;
return $this; return $this;
@ -348,6 +449,11 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setScaEthFlowPoints($sca_eth_flow_points) public function setScaEthFlowPoints($sca_eth_flow_points)
{ {
if (is_null($sca_eth_flow_points)) {
throw new \InvalidArgumentException('non-nullable sca_eth_flow_points cannot be null');
}
$this->container['sca_eth_flow_points'] = $sca_eth_flow_points; $this->container['sca_eth_flow_points'] = $sca_eth_flow_points;
return $this; return $this;
@ -372,6 +478,11 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setAttName($att_name) public function setAttName($att_name)
{ {
if (is_null($att_name)) {
throw new \InvalidArgumentException('non-nullable att_name cannot be null');
}
$this->container['att_name'] = $att_name; $this->container['att_name'] = $att_name;
return $this; return $this;

View File

@ -69,6 +69,22 @@ class Cat extends Animal
'declawed' => null 'declawed' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'declawed' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -89,6 +105,48 @@ class Cat extends Animal
return self::$openAPIFormats + parent::openAPIFormats(); return self::$openAPIFormats + parent::openAPIFormats();
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables + parent::openAPINullables();
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -170,7 +228,25 @@ class Cat extends Animal
{ {
parent::__construct($data); parent::__construct($data);
$this->container['declawed'] = $data['declawed'] ?? null; $this->setIfExists('declawed', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -216,6 +292,11 @@ class Cat extends Animal
*/ */
public function setDeclawed($declawed) public function setDeclawed($declawed)
{ {
if (is_null($declawed)) {
throw new \InvalidArgumentException('non-nullable declawed cannot be null');
}
$this->container['declawed'] = $declawed; $this->container['declawed'] = $declawed;
return $this; return $this;

View File

@ -71,6 +71,22 @@ class CatAllOf implements ModelInterface, ArrayAccess, \JsonSerializable
'declawed' => null 'declawed' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'declawed' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -91,6 +107,48 @@ class CatAllOf implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -176,7 +234,25 @@ class CatAllOf implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['declawed'] = $data['declawed'] ?? null; $this->setIfExists('declawed', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -222,6 +298,11 @@ class CatAllOf implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setDeclawed($declawed) public function setDeclawed($declawed)
{ {
if (is_null($declawed)) {
throw new \InvalidArgumentException('non-nullable declawed cannot be null');
}
$this->container['declawed'] = $declawed; $this->container['declawed'] = $declawed;
return $this; return $this;

View File

@ -73,6 +73,23 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
'name' => null 'name' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'name' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -93,6 +110,48 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -181,8 +240,26 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['id'] = $data['id'] ?? null; $this->setIfExists('id', $data ?? [], null);
$this->container['name'] = $data['name'] ?? 'default-name'; $this->setIfExists('name', $data ?? [], 'default-name');
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -231,6 +308,11 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setId($id) public function setId($id)
{ {
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id; $this->container['id'] = $id;
return $this; return $this;
@ -255,6 +337,11 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setName($name) public function setName($name)
{ {
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name; $this->container['name'] = $name;
return $this; return $this;

View File

@ -72,6 +72,22 @@ class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
'_class' => null '_class' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'_class' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -92,6 +108,48 @@ class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -177,7 +235,25 @@ class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['_class'] = $data['_class'] ?? null; $this->setIfExists('_class', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -223,6 +299,11 @@ class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setClass($_class) public function setClass($_class)
{ {
if (is_null($_class)) {
throw new \InvalidArgumentException('non-nullable _class cannot be null');
}
$this->container['_class'] = $_class; $this->container['_class'] = $_class;
return $this; return $this;

View File

@ -71,6 +71,22 @@ class Client implements ModelInterface, ArrayAccess, \JsonSerializable
'client' => null 'client' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'client' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -91,6 +107,48 @@ class Client implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -176,7 +234,25 @@ class Client implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['client'] = $data['client'] ?? null; $this->setIfExists('client', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -222,6 +298,11 @@ class Client implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setClient($client) public function setClient($client)
{ {
if (is_null($client)) {
throw new \InvalidArgumentException('non-nullable client cannot be null');
}
$this->container['client'] = $client; $this->container['client'] = $client;
return $this; return $this;

View File

@ -71,6 +71,22 @@ class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
'name' => null 'name' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'name' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -91,6 +107,48 @@ class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -176,7 +234,25 @@ class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['name'] = $data['name'] ?? null; $this->setIfExists('name', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -222,6 +298,11 @@ class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setName($name) public function setName($name)
{ {
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name; $this->container['name'] = $name;
return $this; return $this;

View File

@ -69,6 +69,22 @@ class Dog extends Animal
'breed' => null 'breed' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'breed' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -89,6 +105,48 @@ class Dog extends Animal
return self::$openAPIFormats + parent::openAPIFormats(); return self::$openAPIFormats + parent::openAPIFormats();
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables + parent::openAPINullables();
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -170,7 +228,25 @@ class Dog extends Animal
{ {
parent::__construct($data); parent::__construct($data);
$this->container['breed'] = $data['breed'] ?? null; $this->setIfExists('breed', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -216,6 +292,11 @@ class Dog extends Animal
*/ */
public function setBreed($breed) public function setBreed($breed)
{ {
if (is_null($breed)) {
throw new \InvalidArgumentException('non-nullable breed cannot be null');
}
$this->container['breed'] = $breed; $this->container['breed'] = $breed;
return $this; return $this;

View File

@ -71,6 +71,22 @@ class DogAllOf implements ModelInterface, ArrayAccess, \JsonSerializable
'breed' => null 'breed' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'breed' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -91,6 +107,48 @@ class DogAllOf implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -176,7 +234,25 @@ class DogAllOf implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['breed'] = $data['breed'] ?? null; $this->setIfExists('breed', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -222,6 +298,11 @@ class DogAllOf implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setBreed($breed) public function setBreed($breed)
{ {
if (is_null($breed)) {
throw new \InvalidArgumentException('non-nullable breed cannot be null');
}
$this->container['breed'] = $breed; $this->container['breed'] = $breed;
return $this; return $this;

View File

@ -73,6 +73,23 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
'array_enum' => null 'array_enum' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'just_symbol' => false,
'array_enum' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -93,6 +110,48 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -211,8 +270,26 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['just_symbol'] = $data['just_symbol'] ?? null; $this->setIfExists('just_symbol', $data ?? [], null);
$this->container['array_enum'] = $data['array_enum'] ?? null; $this->setIfExists('array_enum', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -277,6 +354,11 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
) )
); );
} }
if (is_null($just_symbol)) {
throw new \InvalidArgumentException('non-nullable just_symbol cannot be null');
}
$this->container['just_symbol'] = $just_symbol; $this->container['just_symbol'] = $just_symbol;
return $this; return $this;
@ -310,6 +392,11 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
) )
); );
} }
if (is_null($array_enum)) {
throw new \InvalidArgumentException('non-nullable array_enum cannot be null');
}
$this->container['array_enum'] = $array_enum; $this->container['array_enum'] = $array_enum;
return $this; return $this;

View File

@ -85,6 +85,29 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
'outer_enum_integer_default_value' => null 'outer_enum_integer_default_value' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'enum_string' => false,
'enum_string_required' => false,
'enum_integer' => false,
'enum_number' => false,
'outer_enum' => true,
'outer_enum_integer' => false,
'outer_enum_default_value' => false,
'outer_enum_integer_default_value' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -105,6 +128,48 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -275,14 +340,32 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['enum_string'] = $data['enum_string'] ?? null; $this->setIfExists('enum_string', $data ?? [], null);
$this->container['enum_string_required'] = $data['enum_string_required'] ?? null; $this->setIfExists('enum_string_required', $data ?? [], null);
$this->container['enum_integer'] = $data['enum_integer'] ?? null; $this->setIfExists('enum_integer', $data ?? [], null);
$this->container['enum_number'] = $data['enum_number'] ?? null; $this->setIfExists('enum_number', $data ?? [], null);
$this->container['outer_enum'] = $data['outer_enum'] ?? null; $this->setIfExists('outer_enum', $data ?? [], null);
$this->container['outer_enum_integer'] = $data['outer_enum_integer'] ?? null; $this->setIfExists('outer_enum_integer', $data ?? [], null);
$this->container['outer_enum_default_value'] = $data['outer_enum_default_value'] ?? null; $this->setIfExists('outer_enum_default_value', $data ?? [], null);
$this->container['outer_enum_integer_default_value'] = $data['outer_enum_integer_default_value'] ?? null; $this->setIfExists('outer_enum_integer_default_value', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -377,6 +460,11 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
) )
); );
} }
if (is_null($enum_string)) {
throw new \InvalidArgumentException('non-nullable enum_string cannot be null');
}
$this->container['enum_string'] = $enum_string; $this->container['enum_string'] = $enum_string;
return $this; return $this;
@ -411,6 +499,11 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
) )
); );
} }
if (is_null($enum_string_required)) {
throw new \InvalidArgumentException('non-nullable enum_string_required cannot be null');
}
$this->container['enum_string_required'] = $enum_string_required; $this->container['enum_string_required'] = $enum_string_required;
return $this; return $this;
@ -445,6 +538,11 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
) )
); );
} }
if (is_null($enum_integer)) {
throw new \InvalidArgumentException('non-nullable enum_integer cannot be null');
}
$this->container['enum_integer'] = $enum_integer; $this->container['enum_integer'] = $enum_integer;
return $this; return $this;
@ -479,6 +577,11 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
) )
); );
} }
if (is_null($enum_number)) {
throw new \InvalidArgumentException('non-nullable enum_number cannot be null');
}
$this->container['enum_number'] = $enum_number; $this->container['enum_number'] = $enum_number;
return $this; return $this;
@ -503,6 +606,18 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setOuterEnum($outer_enum) public function setOuterEnum($outer_enum)
{ {
if (is_null($outer_enum)) {
array_push($this->openAPINullablesSetToNull, 'outer_enum');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('outer_enum', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['outer_enum'] = $outer_enum; $this->container['outer_enum'] = $outer_enum;
return $this; return $this;
@ -527,6 +642,11 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setOuterEnumInteger($outer_enum_integer) public function setOuterEnumInteger($outer_enum_integer)
{ {
if (is_null($outer_enum_integer)) {
throw new \InvalidArgumentException('non-nullable outer_enum_integer cannot be null');
}
$this->container['outer_enum_integer'] = $outer_enum_integer; $this->container['outer_enum_integer'] = $outer_enum_integer;
return $this; return $this;
@ -551,6 +671,11 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setOuterEnumDefaultValue($outer_enum_default_value) public function setOuterEnumDefaultValue($outer_enum_default_value)
{ {
if (is_null($outer_enum_default_value)) {
throw new \InvalidArgumentException('non-nullable outer_enum_default_value cannot be null');
}
$this->container['outer_enum_default_value'] = $outer_enum_default_value; $this->container['outer_enum_default_value'] = $outer_enum_default_value;
return $this; return $this;
@ -575,6 +700,11 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setOuterEnumIntegerDefaultValue($outer_enum_integer_default_value) public function setOuterEnumIntegerDefaultValue($outer_enum_integer_default_value)
{ {
if (is_null($outer_enum_integer_default_value)) {
throw new \InvalidArgumentException('non-nullable outer_enum_integer_default_value cannot be null');
}
$this->container['outer_enum_integer_default_value'] = $outer_enum_integer_default_value; $this->container['outer_enum_integer_default_value'] = $outer_enum_integer_default_value;
return $this; return $this;

View File

@ -72,6 +72,22 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable
'source_uri' => null 'source_uri' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'source_uri' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -92,6 +108,48 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -177,7 +235,25 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['source_uri'] = $data['source_uri'] ?? null; $this->setIfExists('source_uri', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -223,6 +299,11 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setSourceUri($source_uri) public function setSourceUri($source_uri)
{ {
if (is_null($source_uri)) {
throw new \InvalidArgumentException('non-nullable source_uri cannot be null');
}
$this->container['source_uri'] = $source_uri; $this->container['source_uri'] = $source_uri;
return $this; return $this;

View File

@ -73,6 +73,23 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
'files' => null 'files' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'file' => false,
'files' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -93,6 +110,48 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -181,8 +240,26 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['file'] = $data['file'] ?? null; $this->setIfExists('file', $data ?? [], null);
$this->container['files'] = $data['files'] ?? null; $this->setIfExists('files', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -228,6 +305,11 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
*/ */
public function setFile($file) public function setFile($file)
{ {
if (is_null($file)) {
throw new \InvalidArgumentException('non-nullable file cannot be null');
}
$this->container['file'] = $file; $this->container['file'] = $file;
return $this; return $this;
@ -252,6 +334,11 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
*/ */
public function setFiles($files) public function setFiles($files)
{ {
if (is_null($files)) {
throw new \InvalidArgumentException('non-nullable files cannot be null');
}
$this->container['files'] = $files; $this->container['files'] = $files;
return $this; return $this;

View File

@ -71,6 +71,22 @@ class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
'bar' => null 'bar' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'bar' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -91,6 +107,48 @@ class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -176,7 +234,25 @@ class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['bar'] = $data['bar'] ?? 'bar'; $this->setIfExists('bar', $data ?? [], 'bar');
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -222,6 +298,11 @@ class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setBar($bar) public function setBar($bar)
{ {
if (is_null($bar)) {
throw new \InvalidArgumentException('non-nullable bar cannot be null');
}
$this->container['bar'] = $bar; $this->container['bar'] = $bar;
return $this; return $this;

View File

@ -71,6 +71,22 @@ class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSeriali
'string' => null 'string' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'string' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -91,6 +107,48 @@ class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSeriali
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -176,7 +234,25 @@ class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSeriali
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['string'] = $data['string'] ?? null; $this->setIfExists('string', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -222,6 +298,11 @@ class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSeriali
*/ */
public function setString($string) public function setString($string)
{ {
if (is_null($string)) {
throw new \InvalidArgumentException('non-nullable string cannot be null');
}
$this->container['string'] = $string; $this->container['string'] = $string;
return $this; return $this;

View File

@ -101,6 +101,37 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
'pattern_with_digits_and_delimiter' => null 'pattern_with_digits_and_delimiter' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'integer' => false,
'int32' => false,
'int64' => false,
'number' => false,
'float' => false,
'double' => false,
'decimal' => false,
'string' => false,
'byte' => false,
'binary' => false,
'date' => false,
'date_time' => false,
'uuid' => false,
'password' => false,
'pattern_with_digits' => false,
'pattern_with_digits_and_delimiter' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -121,6 +152,48 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -251,22 +324,40 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['integer'] = $data['integer'] ?? null; $this->setIfExists('integer', $data ?? [], null);
$this->container['int32'] = $data['int32'] ?? null; $this->setIfExists('int32', $data ?? [], null);
$this->container['int64'] = $data['int64'] ?? null; $this->setIfExists('int64', $data ?? [], null);
$this->container['number'] = $data['number'] ?? null; $this->setIfExists('number', $data ?? [], null);
$this->container['float'] = $data['float'] ?? null; $this->setIfExists('float', $data ?? [], null);
$this->container['double'] = $data['double'] ?? null; $this->setIfExists('double', $data ?? [], null);
$this->container['decimal'] = $data['decimal'] ?? null; $this->setIfExists('decimal', $data ?? [], null);
$this->container['string'] = $data['string'] ?? null; $this->setIfExists('string', $data ?? [], null);
$this->container['byte'] = $data['byte'] ?? null; $this->setIfExists('byte', $data ?? [], null);
$this->container['binary'] = $data['binary'] ?? null; $this->setIfExists('binary', $data ?? [], null);
$this->container['date'] = $data['date'] ?? null; $this->setIfExists('date', $data ?? [], null);
$this->container['date_time'] = $data['date_time'] ?? null; $this->setIfExists('date_time', $data ?? [], null);
$this->container['uuid'] = $data['uuid'] ?? null; $this->setIfExists('uuid', $data ?? [], null);
$this->container['password'] = $data['password'] ?? null; $this->setIfExists('password', $data ?? [], null);
$this->container['pattern_with_digits'] = $data['pattern_with_digits'] ?? null; $this->setIfExists('pattern_with_digits', $data ?? [], null);
$this->container['pattern_with_digits_and_delimiter'] = $data['pattern_with_digits_and_delimiter'] ?? null; $this->setIfExists('pattern_with_digits_and_delimiter', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -392,6 +483,11 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
throw new \InvalidArgumentException('invalid value for $integer when calling FormatTest., must be bigger than or equal to 10.'); throw new \InvalidArgumentException('invalid value for $integer when calling FormatTest., must be bigger than or equal to 10.');
} }
if (is_null($integer)) {
throw new \InvalidArgumentException('non-nullable integer cannot be null');
}
$this->container['integer'] = $integer; $this->container['integer'] = $integer;
return $this; return $this;
@ -424,6 +520,11 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
throw new \InvalidArgumentException('invalid value for $int32 when calling FormatTest., must be bigger than or equal to 20.'); throw new \InvalidArgumentException('invalid value for $int32 when calling FormatTest., must be bigger than or equal to 20.');
} }
if (is_null($int32)) {
throw new \InvalidArgumentException('non-nullable int32 cannot be null');
}
$this->container['int32'] = $int32; $this->container['int32'] = $int32;
return $this; return $this;
@ -448,6 +549,11 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setInt64($int64) public function setInt64($int64)
{ {
if (is_null($int64)) {
throw new \InvalidArgumentException('non-nullable int64 cannot be null');
}
$this->container['int64'] = $int64; $this->container['int64'] = $int64;
return $this; return $this;
@ -480,6 +586,11 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
throw new \InvalidArgumentException('invalid value for $number when calling FormatTest., must be bigger than or equal to 32.1.'); throw new \InvalidArgumentException('invalid value for $number when calling FormatTest., must be bigger than or equal to 32.1.');
} }
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number; $this->container['number'] = $number;
return $this; return $this;
@ -512,6 +623,11 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
throw new \InvalidArgumentException('invalid value for $float when calling FormatTest., must be bigger than or equal to 54.3.'); throw new \InvalidArgumentException('invalid value for $float when calling FormatTest., must be bigger than or equal to 54.3.');
} }
if (is_null($float)) {
throw new \InvalidArgumentException('non-nullable float cannot be null');
}
$this->container['float'] = $float; $this->container['float'] = $float;
return $this; return $this;
@ -544,6 +660,11 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
throw new \InvalidArgumentException('invalid value for $double when calling FormatTest., must be bigger than or equal to 67.8.'); throw new \InvalidArgumentException('invalid value for $double when calling FormatTest., must be bigger than or equal to 67.8.');
} }
if (is_null($double)) {
throw new \InvalidArgumentException('non-nullable double cannot be null');
}
$this->container['double'] = $double; $this->container['double'] = $double;
return $this; return $this;
@ -568,6 +689,11 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setDecimal($decimal) public function setDecimal($decimal)
{ {
if (is_null($decimal)) {
throw new \InvalidArgumentException('non-nullable decimal cannot be null');
}
$this->container['decimal'] = $decimal; $this->container['decimal'] = $decimal;
return $this; return $this;
@ -597,6 +723,11 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
throw new \InvalidArgumentException("invalid value for \$string when calling FormatTest., must conform to the pattern /[a-z]/i."); throw new \InvalidArgumentException("invalid value for \$string when calling FormatTest., must conform to the pattern /[a-z]/i.");
} }
if (is_null($string)) {
throw new \InvalidArgumentException('non-nullable string cannot be null');
}
$this->container['string'] = $string; $this->container['string'] = $string;
return $this; return $this;
@ -621,6 +752,11 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setByte($byte) public function setByte($byte)
{ {
if (is_null($byte)) {
throw new \InvalidArgumentException('non-nullable byte cannot be null');
}
$this->container['byte'] = $byte; $this->container['byte'] = $byte;
return $this; return $this;
@ -645,6 +781,11 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setBinary($binary) public function setBinary($binary)
{ {
if (is_null($binary)) {
throw new \InvalidArgumentException('non-nullable binary cannot be null');
}
$this->container['binary'] = $binary; $this->container['binary'] = $binary;
return $this; return $this;
@ -669,6 +810,11 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setDate($date) public function setDate($date)
{ {
if (is_null($date)) {
throw new \InvalidArgumentException('non-nullable date cannot be null');
}
$this->container['date'] = $date; $this->container['date'] = $date;
return $this; return $this;
@ -693,6 +839,11 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setDateTime($date_time) public function setDateTime($date_time)
{ {
if (is_null($date_time)) {
throw new \InvalidArgumentException('non-nullable date_time cannot be null');
}
$this->container['date_time'] = $date_time; $this->container['date_time'] = $date_time;
return $this; return $this;
@ -717,6 +868,11 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setUuid($uuid) public function setUuid($uuid)
{ {
if (is_null($uuid)) {
throw new \InvalidArgumentException('non-nullable uuid cannot be null');
}
$this->container['uuid'] = $uuid; $this->container['uuid'] = $uuid;
return $this; return $this;
@ -748,6 +904,11 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
throw new \InvalidArgumentException('invalid length for $password when calling FormatTest., must be bigger than or equal to 10.'); throw new \InvalidArgumentException('invalid length for $password when calling FormatTest., must be bigger than or equal to 10.');
} }
if (is_null($password)) {
throw new \InvalidArgumentException('non-nullable password cannot be null');
}
$this->container['password'] = $password; $this->container['password'] = $password;
return $this; return $this;
@ -777,6 +938,11 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
throw new \InvalidArgumentException("invalid value for \$pattern_with_digits when calling FormatTest., must conform to the pattern /^\\d{10}$/."); throw new \InvalidArgumentException("invalid value for \$pattern_with_digits when calling FormatTest., must conform to the pattern /^\\d{10}$/.");
} }
if (is_null($pattern_with_digits)) {
throw new \InvalidArgumentException('non-nullable pattern_with_digits cannot be null');
}
$this->container['pattern_with_digits'] = $pattern_with_digits; $this->container['pattern_with_digits'] = $pattern_with_digits;
return $this; return $this;
@ -806,6 +972,11 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
throw new \InvalidArgumentException("invalid value for \$pattern_with_digits_and_delimiter when calling FormatTest., must conform to the pattern /^image_\\d{1,3}$/i."); throw new \InvalidArgumentException("invalid value for \$pattern_with_digits_and_delimiter when calling FormatTest., must conform to the pattern /^image_\\d{1,3}$/i.");
} }
if (is_null($pattern_with_digits_and_delimiter)) {
throw new \InvalidArgumentException('non-nullable pattern_with_digits_and_delimiter cannot be null');
}
$this->container['pattern_with_digits_and_delimiter'] = $pattern_with_digits_and_delimiter; $this->container['pattern_with_digits_and_delimiter'] = $pattern_with_digits_and_delimiter;
return $this; return $this;

View File

@ -73,6 +73,23 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
'foo' => null 'foo' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'bar' => false,
'foo' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -93,6 +110,48 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -181,8 +240,26 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['bar'] = $data['bar'] ?? null; $this->setIfExists('bar', $data ?? [], null);
$this->container['foo'] = $data['foo'] ?? null; $this->setIfExists('foo', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -228,6 +305,11 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setBar($bar) public function setBar($bar)
{ {
if (is_null($bar)) {
throw new \InvalidArgumentException('non-nullable bar cannot be null');
}
$this->container['bar'] = $bar; $this->container['bar'] = $bar;
return $this; return $this;
@ -252,6 +334,11 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setFoo($foo) public function setFoo($foo)
{ {
if (is_null($foo)) {
throw new \InvalidArgumentException('non-nullable foo cannot be null');
}
$this->container['foo'] = $foo; $this->container['foo'] = $foo;
return $this; return $this;

View File

@ -72,6 +72,22 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
'nullable_message' => null 'nullable_message' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'nullable_message' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -92,6 +108,48 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -177,7 +235,25 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['nullable_message'] = $data['nullable_message'] ?? null; $this->setIfExists('nullable_message', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -223,6 +299,18 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
*/ */
public function setNullableMessage($nullable_message) public function setNullableMessage($nullable_message)
{ {
if (is_null($nullable_message)) {
array_push($this->openAPINullablesSetToNull, 'nullable_message');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('nullable_message', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['nullable_message'] = $nullable_message; $this->container['nullable_message'] = $nullable_message;
return $this; return $this;

View File

@ -77,6 +77,25 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
'indirect_map' => null 'indirect_map' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'map_map_of_string' => false,
'map_of_enum_string' => false,
'direct_map' => false,
'indirect_map' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -97,6 +116,48 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -206,10 +267,28 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['map_map_of_string'] = $data['map_map_of_string'] ?? null; $this->setIfExists('map_map_of_string', $data ?? [], null);
$this->container['map_of_enum_string'] = $data['map_of_enum_string'] ?? null; $this->setIfExists('map_of_enum_string', $data ?? [], null);
$this->container['direct_map'] = $data['direct_map'] ?? null; $this->setIfExists('direct_map', $data ?? [], null);
$this->container['indirect_map'] = $data['indirect_map'] ?? null; $this->setIfExists('indirect_map', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -255,6 +334,11 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setMapMapOfString($map_map_of_string) public function setMapMapOfString($map_map_of_string)
{ {
if (is_null($map_map_of_string)) {
throw new \InvalidArgumentException('non-nullable map_map_of_string cannot be null');
}
$this->container['map_map_of_string'] = $map_map_of_string; $this->container['map_map_of_string'] = $map_map_of_string;
return $this; return $this;
@ -288,6 +372,11 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
) )
); );
} }
if (is_null($map_of_enum_string)) {
throw new \InvalidArgumentException('non-nullable map_of_enum_string cannot be null');
}
$this->container['map_of_enum_string'] = $map_of_enum_string; $this->container['map_of_enum_string'] = $map_of_enum_string;
return $this; return $this;
@ -312,6 +401,11 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setDirectMap($direct_map) public function setDirectMap($direct_map)
{ {
if (is_null($direct_map)) {
throw new \InvalidArgumentException('non-nullable direct_map cannot be null');
}
$this->container['direct_map'] = $direct_map; $this->container['direct_map'] = $direct_map;
return $this; return $this;
@ -336,6 +430,11 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setIndirectMap($indirect_map) public function setIndirectMap($indirect_map)
{ {
if (is_null($indirect_map)) {
throw new \InvalidArgumentException('non-nullable indirect_map cannot be null');
}
$this->container['indirect_map'] = $indirect_map; $this->container['indirect_map'] = $indirect_map;
return $this; return $this;

View File

@ -75,6 +75,24 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
'map' => null 'map' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'uuid' => false,
'date_time' => false,
'map' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -95,6 +113,48 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -186,9 +246,27 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['uuid'] = $data['uuid'] ?? null; $this->setIfExists('uuid', $data ?? [], null);
$this->container['date_time'] = $data['date_time'] ?? null; $this->setIfExists('date_time', $data ?? [], null);
$this->container['map'] = $data['map'] ?? null; $this->setIfExists('map', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -234,6 +312,11 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
*/ */
public function setUuid($uuid) public function setUuid($uuid)
{ {
if (is_null($uuid)) {
throw new \InvalidArgumentException('non-nullable uuid cannot be null');
}
$this->container['uuid'] = $uuid; $this->container['uuid'] = $uuid;
return $this; return $this;
@ -258,6 +341,11 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
*/ */
public function setDateTime($date_time) public function setDateTime($date_time)
{ {
if (is_null($date_time)) {
throw new \InvalidArgumentException('non-nullable date_time cannot be null');
}
$this->container['date_time'] = $date_time; $this->container['date_time'] = $date_time;
return $this; return $this;
@ -282,6 +370,11 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
*/ */
public function setMap($map) public function setMap($map)
{ {
if (is_null($map)) {
throw new \InvalidArgumentException('non-nullable map cannot be null');
}
$this->container['map'] = $map; $this->container['map'] = $map;
return $this; return $this;

View File

@ -74,6 +74,23 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
'class' => null 'class' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'name' => false,
'class' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -94,6 +111,48 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -182,8 +241,26 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['name'] = $data['name'] ?? null; $this->setIfExists('name', $data ?? [], null);
$this->container['class'] = $data['class'] ?? null; $this->setIfExists('class', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -229,6 +306,11 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setName($name) public function setName($name)
{ {
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name; $this->container['name'] = $name;
return $this; return $this;
@ -253,6 +335,11 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setClass($class) public function setClass($class)
{ {
if (is_null($class)) {
throw new \InvalidArgumentException('non-nullable class cannot be null');
}
$this->container['class'] = $class; $this->container['class'] = $class;
return $this; return $this;

View File

@ -92,4 +92,20 @@ interface ModelInterface
* @return bool * @return bool
*/ */
public function valid(); public function valid();
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool;
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool;
} }

View File

@ -71,6 +71,22 @@ class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
'_123_list' => null '_123_list' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'_123_list' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -91,6 +107,48 @@ class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -176,7 +234,25 @@ class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['_123_list'] = $data['_123_list'] ?? null; $this->setIfExists('_123_list', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -222,6 +298,11 @@ class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function set123List($_123_list) public function set123List($_123_list)
{ {
if (is_null($_123_list)) {
throw new \InvalidArgumentException('non-nullable _123_list cannot be null');
}
$this->container['_123_list'] = $_123_list; $this->container['_123_list'] = $_123_list;
return $this; return $this;

View File

@ -72,6 +72,22 @@ class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
'return' => 'int32' 'return' => 'int32'
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'return' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -92,6 +108,48 @@ class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -177,7 +235,25 @@ class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['return'] = $data['return'] ?? null; $this->setIfExists('return', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -223,6 +299,11 @@ class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setReturn($return) public function setReturn($return)
{ {
if (is_null($return)) {
throw new \InvalidArgumentException('non-nullable return cannot be null');
}
$this->container['return'] = $return; $this->container['return'] = $return;
return $this; return $this;

View File

@ -78,6 +78,25 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
'_123_number' => null '_123_number' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'name' => false,
'snake_case' => false,
'property' => false,
'_123_number' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -98,6 +117,48 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -192,10 +253,28 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['name'] = $data['name'] ?? null; $this->setIfExists('name', $data ?? [], null);
$this->container['snake_case'] = $data['snake_case'] ?? null; $this->setIfExists('snake_case', $data ?? [], null);
$this->container['property'] = $data['property'] ?? null; $this->setIfExists('property', $data ?? [], null);
$this->container['_123_number'] = $data['_123_number'] ?? null; $this->setIfExists('_123_number', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -244,6 +323,11 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setName($name) public function setName($name)
{ {
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name; $this->container['name'] = $name;
return $this; return $this;
@ -268,6 +352,11 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setSnakeCase($snake_case) public function setSnakeCase($snake_case)
{ {
if (is_null($snake_case)) {
throw new \InvalidArgumentException('non-nullable snake_case cannot be null');
}
$this->container['snake_case'] = $snake_case; $this->container['snake_case'] = $snake_case;
return $this; return $this;
@ -292,6 +381,11 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setProperty($property) public function setProperty($property)
{ {
if (is_null($property)) {
throw new \InvalidArgumentException('non-nullable property cannot be null');
}
$this->container['property'] = $property; $this->container['property'] = $property;
return $this; return $this;
@ -316,6 +410,11 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function set123Number($_123_number) public function set123Number($_123_number)
{ {
if (is_null($_123_number)) {
throw new \InvalidArgumentException('non-nullable _123_number cannot be null');
}
$this->container['_123_number'] = $_123_number; $this->container['_123_number'] = $_123_number;
return $this; return $this;

View File

@ -93,6 +93,33 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
'object_items_nullable' => null 'object_items_nullable' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'integer_prop' => true,
'number_prop' => true,
'boolean_prop' => true,
'string_prop' => true,
'date_prop' => true,
'datetime_prop' => true,
'array_nullable_prop' => true,
'array_and_items_nullable_prop' => true,
'array_items_nullable' => false,
'object_nullable_prop' => true,
'object_and_items_nullable_prop' => true,
'object_items_nullable' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -113,6 +140,48 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -231,18 +300,36 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['integer_prop'] = $data['integer_prop'] ?? null; $this->setIfExists('integer_prop', $data ?? [], null);
$this->container['number_prop'] = $data['number_prop'] ?? null; $this->setIfExists('number_prop', $data ?? [], null);
$this->container['boolean_prop'] = $data['boolean_prop'] ?? null; $this->setIfExists('boolean_prop', $data ?? [], null);
$this->container['string_prop'] = $data['string_prop'] ?? null; $this->setIfExists('string_prop', $data ?? [], null);
$this->container['date_prop'] = $data['date_prop'] ?? null; $this->setIfExists('date_prop', $data ?? [], null);
$this->container['datetime_prop'] = $data['datetime_prop'] ?? null; $this->setIfExists('datetime_prop', $data ?? [], null);
$this->container['array_nullable_prop'] = $data['array_nullable_prop'] ?? null; $this->setIfExists('array_nullable_prop', $data ?? [], null);
$this->container['array_and_items_nullable_prop'] = $data['array_and_items_nullable_prop'] ?? null; $this->setIfExists('array_and_items_nullable_prop', $data ?? [], null);
$this->container['array_items_nullable'] = $data['array_items_nullable'] ?? null; $this->setIfExists('array_items_nullable', $data ?? [], null);
$this->container['object_nullable_prop'] = $data['object_nullable_prop'] ?? null; $this->setIfExists('object_nullable_prop', $data ?? [], null);
$this->container['object_and_items_nullable_prop'] = $data['object_and_items_nullable_prop'] ?? null; $this->setIfExists('object_and_items_nullable_prop', $data ?? [], null);
$this->container['object_items_nullable'] = $data['object_items_nullable'] ?? null; $this->setIfExists('object_items_nullable', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -288,6 +375,18 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setIntegerProp($integer_prop) public function setIntegerProp($integer_prop)
{ {
if (is_null($integer_prop)) {
array_push($this->openAPINullablesSetToNull, 'integer_prop');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('integer_prop', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['integer_prop'] = $integer_prop; $this->container['integer_prop'] = $integer_prop;
return $this; return $this;
@ -312,6 +411,18 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setNumberProp($number_prop) public function setNumberProp($number_prop)
{ {
if (is_null($number_prop)) {
array_push($this->openAPINullablesSetToNull, 'number_prop');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('number_prop', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['number_prop'] = $number_prop; $this->container['number_prop'] = $number_prop;
return $this; return $this;
@ -336,6 +447,18 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setBooleanProp($boolean_prop) public function setBooleanProp($boolean_prop)
{ {
if (is_null($boolean_prop)) {
array_push($this->openAPINullablesSetToNull, 'boolean_prop');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('boolean_prop', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['boolean_prop'] = $boolean_prop; $this->container['boolean_prop'] = $boolean_prop;
return $this; return $this;
@ -360,6 +483,18 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setStringProp($string_prop) public function setStringProp($string_prop)
{ {
if (is_null($string_prop)) {
array_push($this->openAPINullablesSetToNull, 'string_prop');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('string_prop', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['string_prop'] = $string_prop; $this->container['string_prop'] = $string_prop;
return $this; return $this;
@ -384,6 +519,18 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setDateProp($date_prop) public function setDateProp($date_prop)
{ {
if (is_null($date_prop)) {
array_push($this->openAPINullablesSetToNull, 'date_prop');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('date_prop', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['date_prop'] = $date_prop; $this->container['date_prop'] = $date_prop;
return $this; return $this;
@ -408,6 +555,18 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setDatetimeProp($datetime_prop) public function setDatetimeProp($datetime_prop)
{ {
if (is_null($datetime_prop)) {
array_push($this->openAPINullablesSetToNull, 'datetime_prop');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('datetime_prop', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['datetime_prop'] = $datetime_prop; $this->container['datetime_prop'] = $datetime_prop;
return $this; return $this;
@ -432,6 +591,18 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setArrayNullableProp($array_nullable_prop) public function setArrayNullableProp($array_nullable_prop)
{ {
if (is_null($array_nullable_prop)) {
array_push($this->openAPINullablesSetToNull, 'array_nullable_prop');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('array_nullable_prop', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['array_nullable_prop'] = $array_nullable_prop; $this->container['array_nullable_prop'] = $array_nullable_prop;
return $this; return $this;
@ -456,6 +627,18 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setArrayAndItemsNullableProp($array_and_items_nullable_prop) public function setArrayAndItemsNullableProp($array_and_items_nullable_prop)
{ {
if (is_null($array_and_items_nullable_prop)) {
array_push($this->openAPINullablesSetToNull, 'array_and_items_nullable_prop');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('array_and_items_nullable_prop', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['array_and_items_nullable_prop'] = $array_and_items_nullable_prop; $this->container['array_and_items_nullable_prop'] = $array_and_items_nullable_prop;
return $this; return $this;
@ -480,6 +663,11 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setArrayItemsNullable($array_items_nullable) public function setArrayItemsNullable($array_items_nullable)
{ {
if (is_null($array_items_nullable)) {
throw new \InvalidArgumentException('non-nullable array_items_nullable cannot be null');
}
$this->container['array_items_nullable'] = $array_items_nullable; $this->container['array_items_nullable'] = $array_items_nullable;
return $this; return $this;
@ -504,6 +692,18 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setObjectNullableProp($object_nullable_prop) public function setObjectNullableProp($object_nullable_prop)
{ {
if (is_null($object_nullable_prop)) {
array_push($this->openAPINullablesSetToNull, 'object_nullable_prop');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('object_nullable_prop', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['object_nullable_prop'] = $object_nullable_prop; $this->container['object_nullable_prop'] = $object_nullable_prop;
return $this; return $this;
@ -528,6 +728,18 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setObjectAndItemsNullableProp($object_and_items_nullable_prop) public function setObjectAndItemsNullableProp($object_and_items_nullable_prop)
{ {
if (is_null($object_and_items_nullable_prop)) {
array_push($this->openAPINullablesSetToNull, 'object_and_items_nullable_prop');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('object_and_items_nullable_prop', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['object_and_items_nullable_prop'] = $object_and_items_nullable_prop; $this->container['object_and_items_nullable_prop'] = $object_and_items_nullable_prop;
return $this; return $this;
@ -552,6 +764,11 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setObjectItemsNullable($object_items_nullable) public function setObjectItemsNullable($object_items_nullable)
{ {
if (is_null($object_items_nullable)) {
throw new \InvalidArgumentException('non-nullable object_items_nullable cannot be null');
}
$this->container['object_items_nullable'] = $object_items_nullable; $this->container['object_items_nullable'] = $object_items_nullable;
return $this; return $this;

View File

@ -71,6 +71,22 @@ class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
'just_number' => null 'just_number' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'just_number' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -91,6 +107,48 @@ class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -176,7 +234,25 @@ class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['just_number'] = $data['just_number'] ?? null; $this->setIfExists('just_number', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -222,6 +298,11 @@ class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setJustNumber($just_number) public function setJustNumber($just_number)
{ {
if (is_null($just_number)) {
throw new \InvalidArgumentException('non-nullable just_number cannot be null');
}
$this->container['just_number'] = $just_number; $this->container['just_number'] = $just_number;
return $this; return $this;

View File

@ -77,6 +77,25 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
'bars' => null 'bars' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'uuid' => false,
'id' => false,
'deprecated_ref' => false,
'bars' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -97,6 +116,48 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -191,10 +252,28 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['uuid'] = $data['uuid'] ?? null; $this->setIfExists('uuid', $data ?? [], null);
$this->container['id'] = $data['id'] ?? null; $this->setIfExists('id', $data ?? [], null);
$this->container['deprecated_ref'] = $data['deprecated_ref'] ?? null; $this->setIfExists('deprecated_ref', $data ?? [], null);
$this->container['bars'] = $data['bars'] ?? null; $this->setIfExists('bars', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -240,6 +319,11 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
*/ */
public function setUuid($uuid) public function setUuid($uuid)
{ {
if (is_null($uuid)) {
throw new \InvalidArgumentException('non-nullable uuid cannot be null');
}
$this->container['uuid'] = $uuid; $this->container['uuid'] = $uuid;
return $this; return $this;
@ -266,6 +350,11 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
*/ */
public function setId($id) public function setId($id)
{ {
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id; $this->container['id'] = $id;
return $this; return $this;
@ -292,6 +381,11 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
*/ */
public function setDeprecatedRef($deprecated_ref) public function setDeprecatedRef($deprecated_ref)
{ {
if (is_null($deprecated_ref)) {
throw new \InvalidArgumentException('non-nullable deprecated_ref cannot be null');
}
$this->container['deprecated_ref'] = $deprecated_ref; $this->container['deprecated_ref'] = $deprecated_ref;
return $this; return $this;
@ -318,6 +412,11 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
*/ */
public function setBars($bars) public function setBars($bars)
{ {
if (is_null($bars)) {
throw new \InvalidArgumentException('non-nullable bars cannot be null');
}
$this->container['bars'] = $bars; $this->container['bars'] = $bars;
return $this; return $this;

View File

@ -81,6 +81,27 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
'complete' => null 'complete' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'pet_id' => false,
'quantity' => false,
'ship_date' => false,
'status' => false,
'complete' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -101,6 +122,48 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -218,12 +281,30 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['id'] = $data['id'] ?? null; $this->setIfExists('id', $data ?? [], null);
$this->container['pet_id'] = $data['pet_id'] ?? null; $this->setIfExists('pet_id', $data ?? [], null);
$this->container['quantity'] = $data['quantity'] ?? null; $this->setIfExists('quantity', $data ?? [], null);
$this->container['ship_date'] = $data['ship_date'] ?? null; $this->setIfExists('ship_date', $data ?? [], null);
$this->container['status'] = $data['status'] ?? null; $this->setIfExists('status', $data ?? [], null);
$this->container['complete'] = $data['complete'] ?? false; $this->setIfExists('complete', $data ?? [], false);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -278,6 +359,11 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setId($id) public function setId($id)
{ {
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id; $this->container['id'] = $id;
return $this; return $this;
@ -302,6 +388,11 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setPetId($pet_id) public function setPetId($pet_id)
{ {
if (is_null($pet_id)) {
throw new \InvalidArgumentException('non-nullable pet_id cannot be null');
}
$this->container['pet_id'] = $pet_id; $this->container['pet_id'] = $pet_id;
return $this; return $this;
@ -326,6 +417,11 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setQuantity($quantity) public function setQuantity($quantity)
{ {
if (is_null($quantity)) {
throw new \InvalidArgumentException('non-nullable quantity cannot be null');
}
$this->container['quantity'] = $quantity; $this->container['quantity'] = $quantity;
return $this; return $this;
@ -350,6 +446,11 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setShipDate($ship_date) public function setShipDate($ship_date)
{ {
if (is_null($ship_date)) {
throw new \InvalidArgumentException('non-nullable ship_date cannot be null');
}
$this->container['ship_date'] = $ship_date; $this->container['ship_date'] = $ship_date;
return $this; return $this;
@ -384,6 +485,11 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
) )
); );
} }
if (is_null($status)) {
throw new \InvalidArgumentException('non-nullable status cannot be null');
}
$this->container['status'] = $status; $this->container['status'] = $status;
return $this; return $this;
@ -408,6 +514,11 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setComplete($complete) public function setComplete($complete)
{ {
if (is_null($complete)) {
throw new \InvalidArgumentException('non-nullable complete cannot be null');
}
$this->container['complete'] = $complete; $this->container['complete'] = $complete;
return $this; return $this;

View File

@ -75,6 +75,24 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
'my_boolean' => null 'my_boolean' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'my_number' => false,
'my_string' => false,
'my_boolean' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -95,6 +113,48 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -186,9 +246,27 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['my_number'] = $data['my_number'] ?? null; $this->setIfExists('my_number', $data ?? [], null);
$this->container['my_string'] = $data['my_string'] ?? null; $this->setIfExists('my_string', $data ?? [], null);
$this->container['my_boolean'] = $data['my_boolean'] ?? null; $this->setIfExists('my_boolean', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -234,6 +312,11 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setMyNumber($my_number) public function setMyNumber($my_number)
{ {
if (is_null($my_number)) {
throw new \InvalidArgumentException('non-nullable my_number cannot be null');
}
$this->container['my_number'] = $my_number; $this->container['my_number'] = $my_number;
return $this; return $this;
@ -258,6 +341,11 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setMyString($my_string) public function setMyString($my_string)
{ {
if (is_null($my_string)) {
throw new \InvalidArgumentException('non-nullable my_string cannot be null');
}
$this->container['my_string'] = $my_string; $this->container['my_string'] = $my_string;
return $this; return $this;
@ -282,6 +370,11 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setMyBoolean($my_boolean) public function setMyBoolean($my_boolean)
{ {
if (is_null($my_boolean)) {
throw new \InvalidArgumentException('non-nullable my_boolean cannot be null');
}
$this->container['my_boolean'] = $my_boolean; $this->container['my_boolean'] = $my_boolean;
return $this; return $this;

View File

@ -71,6 +71,22 @@ class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonS
'value' => null 'value' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'value' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -91,6 +107,48 @@ class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonS
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -176,7 +234,25 @@ class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonS
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['value'] = $data['value'] ?? null; $this->setIfExists('value', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -225,6 +301,11 @@ class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonS
*/ */
public function setValue($value) public function setValue($value)
{ {
if (is_null($value)) {
throw new \InvalidArgumentException('non-nullable value cannot be null');
}
$this->container['value'] = $value; $this->container['value'] = $value;
return $this; return $this;

View File

@ -81,6 +81,27 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
'status' => null 'status' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'category' => false,
'name' => false,
'photo_urls' => false,
'tags' => false,
'status' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -101,6 +122,48 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -218,12 +281,30 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['id'] = $data['id'] ?? null; $this->setIfExists('id', $data ?? [], null);
$this->container['category'] = $data['category'] ?? null; $this->setIfExists('category', $data ?? [], null);
$this->container['name'] = $data['name'] ?? null; $this->setIfExists('name', $data ?? [], null);
$this->container['photo_urls'] = $data['photo_urls'] ?? null; $this->setIfExists('photo_urls', $data ?? [], null);
$this->container['tags'] = $data['tags'] ?? null; $this->setIfExists('tags', $data ?? [], null);
$this->container['status'] = $data['status'] ?? null; $this->setIfExists('status', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -284,6 +365,11 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setId($id) public function setId($id)
{ {
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id; $this->container['id'] = $id;
return $this; return $this;
@ -308,6 +394,11 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setCategory($category) public function setCategory($category)
{ {
if (is_null($category)) {
throw new \InvalidArgumentException('non-nullable category cannot be null');
}
$this->container['category'] = $category; $this->container['category'] = $category;
return $this; return $this;
@ -332,6 +423,11 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setName($name) public function setName($name)
{ {
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name; $this->container['name'] = $name;
return $this; return $this;
@ -358,6 +454,11 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
{ {
if (is_null($photo_urls)) {
throw new \InvalidArgumentException('non-nullable photo_urls cannot be null');
}
$this->container['photo_urls'] = $photo_urls; $this->container['photo_urls'] = $photo_urls;
return $this; return $this;
@ -382,6 +483,11 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setTags($tags) public function setTags($tags)
{ {
if (is_null($tags)) {
throw new \InvalidArgumentException('non-nullable tags cannot be null');
}
$this->container['tags'] = $tags; $this->container['tags'] = $tags;
return $this; return $this;
@ -416,6 +522,11 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
) )
); );
} }
if (is_null($status)) {
throw new \InvalidArgumentException('non-nullable status cannot be null');
}
$this->container['status'] = $status; $this->container['status'] = $status;
return $this; return $this;

View File

@ -73,6 +73,23 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
'baz' => null 'baz' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'bar' => false,
'baz' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -93,6 +110,48 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -181,8 +240,26 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['bar'] = $data['bar'] ?? null; $this->setIfExists('bar', $data ?? [], null);
$this->container['baz'] = $data['baz'] ?? null; $this->setIfExists('baz', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -228,6 +305,11 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setBar($bar) public function setBar($bar)
{ {
if (is_null($bar)) {
throw new \InvalidArgumentException('non-nullable bar cannot be null');
}
$this->container['bar'] = $bar; $this->container['bar'] = $bar;
return $this; return $this;
@ -252,6 +334,11 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setBaz($baz) public function setBaz($baz)
{ {
if (is_null($baz)) {
throw new \InvalidArgumentException('non-nullable baz cannot be null');
}
$this->container['baz'] = $baz; $this->container['baz'] = $baz;
return $this; return $this;

View File

@ -71,6 +71,22 @@ class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
'special_property_name' => 'int64' 'special_property_name' => 'int64'
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'special_property_name' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -91,6 +107,48 @@ class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -176,7 +234,25 @@ class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['special_property_name'] = $data['special_property_name'] ?? null; $this->setIfExists('special_property_name', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -222,6 +298,11 @@ class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setSpecialPropertyName($special_property_name) public function setSpecialPropertyName($special_property_name)
{ {
if (is_null($special_property_name)) {
throw new \InvalidArgumentException('non-nullable special_property_name cannot be null');
}
$this->container['special_property_name'] = $special_property_name; $this->container['special_property_name'] = $special_property_name;
return $this; return $this;

View File

@ -73,6 +73,23 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
'name' => null 'name' => null
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'name' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -93,6 +110,48 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -181,8 +240,26 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['id'] = $data['id'] ?? null; $this->setIfExists('id', $data ?? [], null);
$this->container['name'] = $data['name'] ?? null; $this->setIfExists('name', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -228,6 +305,11 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setId($id) public function setId($id)
{ {
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id; $this->container['id'] = $id;
return $this; return $this;
@ -252,6 +334,11 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setName($name) public function setName($name)
{ {
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name; $this->container['name'] = $name;
return $this; return $this;

View File

@ -85,6 +85,29 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
'user_status' => 'int32' 'user_status' => 'int32'
]; ];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'username' => false,
'first_name' => false,
'last_name' => false,
'email' => false,
'password' => false,
'phone' => false,
'user_status' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/** /**
* Array of property to type mappings. Used for (de)serialization * Array of property to type mappings. Used for (de)serialization
* *
@ -105,6 +128,48 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIFormats; return self::$openAPIFormats;
} }
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/** /**
* Array of attributes where the key is the local name, * Array of attributes where the key is the local name,
* and the value is the original name * and the value is the original name
@ -211,14 +276,32 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
$this->container['id'] = $data['id'] ?? null; $this->setIfExists('id', $data ?? [], null);
$this->container['username'] = $data['username'] ?? null; $this->setIfExists('username', $data ?? [], null);
$this->container['first_name'] = $data['first_name'] ?? null; $this->setIfExists('first_name', $data ?? [], null);
$this->container['last_name'] = $data['last_name'] ?? null; $this->setIfExists('last_name', $data ?? [], null);
$this->container['email'] = $data['email'] ?? null; $this->setIfExists('email', $data ?? [], null);
$this->container['password'] = $data['password'] ?? null; $this->setIfExists('password', $data ?? [], null);
$this->container['phone'] = $data['phone'] ?? null; $this->setIfExists('phone', $data ?? [], null);
$this->container['user_status'] = $data['user_status'] ?? null; $this->setIfExists('user_status', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
} }
/** /**
@ -264,6 +347,11 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setId($id) public function setId($id)
{ {
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id; $this->container['id'] = $id;
return $this; return $this;
@ -288,6 +376,11 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setUsername($username) public function setUsername($username)
{ {
if (is_null($username)) {
throw new \InvalidArgumentException('non-nullable username cannot be null');
}
$this->container['username'] = $username; $this->container['username'] = $username;
return $this; return $this;
@ -312,6 +405,11 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setFirstName($first_name) public function setFirstName($first_name)
{ {
if (is_null($first_name)) {
throw new \InvalidArgumentException('non-nullable first_name cannot be null');
}
$this->container['first_name'] = $first_name; $this->container['first_name'] = $first_name;
return $this; return $this;
@ -336,6 +434,11 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setLastName($last_name) public function setLastName($last_name)
{ {
if (is_null($last_name)) {
throw new \InvalidArgumentException('non-nullable last_name cannot be null');
}
$this->container['last_name'] = $last_name; $this->container['last_name'] = $last_name;
return $this; return $this;
@ -360,6 +463,11 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setEmail($email) public function setEmail($email)
{ {
if (is_null($email)) {
throw new \InvalidArgumentException('non-nullable email cannot be null');
}
$this->container['email'] = $email; $this->container['email'] = $email;
return $this; return $this;
@ -384,6 +492,11 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setPassword($password) public function setPassword($password)
{ {
if (is_null($password)) {
throw new \InvalidArgumentException('non-nullable password cannot be null');
}
$this->container['password'] = $password; $this->container['password'] = $password;
return $this; return $this;
@ -408,6 +521,11 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setPhone($phone) public function setPhone($phone)
{ {
if (is_null($phone)) {
throw new \InvalidArgumentException('non-nullable phone cannot be null');
}
$this->container['phone'] = $phone; $this->container['phone'] = $phone;
return $this; return $this;
@ -432,6 +550,11 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*/ */
public function setUserStatus($user_status) public function setUserStatus($user_status)
{ {
if (is_null($user_status)) {
throw new \InvalidArgumentException('non-nullable user_status cannot be null');
}
$this->container['user_status'] = $user_status; $this->container['user_status'] = $user_status;
return $this; return $this;

View File

@ -98,7 +98,7 @@ class ObjectSerializer
} }
} }
} }
if ($value !== null) { if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) {
$values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]);
} }
} }
@ -469,7 +469,15 @@ class ObjectSerializer
foreach ($instance::openAPITypes() as $property => $type) { foreach ($instance::openAPITypes() as $property => $type) {
$propertySetter = $instance::setters()[$property]; $propertySetter = $instance::setters()[$property];
if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) { if (!isset($propertySetter)) {
continue;
}
if (!isset($data->{$instance::attributeMap()[$property]})) {
if ($instance::isNullable($property)) {
$instance->$propertySetter(null);
}
continue; continue;
} }