-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix nullable problems
- Loading branch information
Erik Räni
authored
Jul 29, 2019
1 parent
f9987c2
commit 01d7874
Showing
48 changed files
with
2,960 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
4.0.0 | ||
4.0.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
* The version of the OpenAPI document: 1.0.2 | ||
* Contact: [email protected] | ||
* Generated by: https://openapi-generator.tech | ||
* OpenAPI Generator version: 4.0.0 | ||
* OpenAPI Generator version: 4.0.3 | ||
*/ | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
* The version of the OpenAPI document: 1.0.2 | ||
* Contact: [email protected] | ||
* Generated by: https://openapi-generator.tech | ||
* OpenAPI Generator version: 4.0.0 | ||
* OpenAPI Generator version: 4.0.3 | ||
*/ | ||
|
||
/** | ||
|
@@ -2048,7 +2048,6 @@ protected function fetchContactsRequest($groupIds = null) | |
// query params | ||
$queryParams['groupIds'] = $groupIds; | ||
|
||
|
||
// body params | ||
$_tempBody = null; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
* The version of the OpenAPI document: 1.0.2 | ||
* Contact: [email protected] | ||
* Generated by: https://openapi-generator.tech | ||
* OpenAPI Generator version: 4.0.0 | ||
* OpenAPI Generator version: 4.0.3 | ||
*/ | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
* The version of the OpenAPI document: 1.0.2 | ||
* Contact: [email protected] | ||
* Generated by: https://openapi-generator.tech | ||
* OpenAPI Generator version: 4.0.0 | ||
* OpenAPI Generator version: 4.0.3 | ||
*/ | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
* The version of the OpenAPI document: 1.0.2 | ||
* Contact: [email protected] | ||
* Generated by: https://openapi-generator.tech | ||
* OpenAPI Generator version: 4.0.0 | ||
* OpenAPI Generator version: 4.0.3 | ||
*/ | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
* The version of the OpenAPI document: 1.0.2 | ||
* Contact: [email protected] | ||
* Generated by: https://openapi-generator.tech | ||
* OpenAPI Generator version: 4.0.0 | ||
* OpenAPI Generator version: 4.0.3 | ||
*/ | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
* The version of the OpenAPI document: 1.0.2 | ||
* Contact: [email protected] | ||
* Generated by: https://openapi-generator.tech | ||
* OpenAPI Generator version: 4.0.0 | ||
* OpenAPI Generator version: 4.0.3 | ||
*/ | ||
|
||
/** | ||
|
@@ -88,7 +88,7 @@ class Configuration | |
* | ||
* @var string | ||
*/ | ||
protected $userAgent = 'OpenAPI-Generator/1.0.3/PHP'; | ||
protected $userAgent = 'OpenAPI-Generator/1.0.4/PHP'; | ||
|
||
/** | ||
* Debug switch (default set to false) | ||
|
@@ -397,7 +397,7 @@ public static function toDebugReport() | |
$report .= ' OS: ' . php_uname() . PHP_EOL; | ||
$report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; | ||
$report .= ' The version of the OpenAPI document: 1.0.2' . PHP_EOL; | ||
$report .= ' SDK Package Version: 1.0.3' . PHP_EOL; | ||
$report .= ' SDK Package Version: 1.0.4' . PHP_EOL; | ||
$report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; | ||
|
||
return $report; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
* The version of the OpenAPI document: 1.0.2 | ||
* Contact: [email protected] | ||
* Generated by: https://openapi-generator.tech | ||
* OpenAPI Generator version: 4.0.0 | ||
* OpenAPI Generator version: 4.0.3 | ||
*/ | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
* The version of the OpenAPI document: 1.0.2 | ||
* Contact: [email protected] | ||
* Generated by: https://openapi-generator.tech | ||
* OpenAPI Generator version: 4.0.0 | ||
* OpenAPI Generator version: 4.0.3 | ||
*/ | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
* The version of the OpenAPI document: 1.0.2 | ||
* Contact: [email protected] | ||
* Generated by: https://openapi-generator.tech | ||
* OpenAPI Generator version: 4.0.0 | ||
* OpenAPI Generator version: 4.0.3 | ||
*/ | ||
|
||
/** | ||
|
@@ -70,6 +70,22 @@ class ContactEnvelope implements ModelInterface, ArrayAccess | |
'contact' => null | ||
]; | ||
|
||
/** | ||
* Array of nullable properties. Used for (de)serialization | ||
* | ||
* @var boolean[] | ||
*/ | ||
protected static $openAPINullables = [ | ||
'contact' => false | ||
]; | ||
|
||
/** | ||
* If a nullable field gets set to null, insert it here | ||
* | ||
* @var boolean[] | ||
*/ | ||
protected $openAPINullablesSetToNull = []; | ||
|
||
/** | ||
* Array of property to type mappings. Used for (de)serialization | ||
* | ||
|
@@ -90,6 +106,60 @@ public static function openAPIFormats() | |
return self::$openAPIFormats; | ||
} | ||
|
||
/** | ||
* Array of property to nullable mappings. Used for (de)serialization | ||
* | ||
* @return array | ||
*/ | ||
public static function openAPINullables() | ||
{ | ||
return self::$openAPINullables; | ||
} | ||
|
||
/** | ||
* Array of nullable field names deliberately set to null | ||
* | ||
* @return array | ||
*/ | ||
public function getOpenAPINullablesSetToNull() | ||
{ | ||
return $this->openAPINullablesSetToNull; | ||
} | ||
|
||
public function setOpenAPINullablesSetToNull($nullablesSetToNull) | ||
{ | ||
$this->openAPINullablesSetToNull=$nullablesSetToNull; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Checks if a property is nullable | ||
* | ||
* @return bool | ||
*/ | ||
public static function isNullable(string $property): bool | ||
{ | ||
if (isset(self::$openAPINullables[$property])) { | ||
return self::$openAPINullables[$property]; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
/** | ||
* Checks if a nullable property is set to null. | ||
* | ||
* @return bool | ||
*/ | ||
public function isNullableSetToNull(string $property): bool | ||
{ | ||
if (in_array($property, $this->getOpenAPINullablesSetToNull())) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
/** | ||
* Array of attributes where the key is the local name, | ||
* and the value is the original name | ||
|
@@ -178,7 +248,18 @@ public function getModelName() | |
*/ | ||
public function __construct(array $data = null) | ||
{ | ||
$this->container['contact'] = isset($data['contact']) ? $data['contact'] : null; | ||
$this->setIfExists('contact', $data, null); | ||
} | ||
|
||
public function setIfExists(string $variableName, $fields, $defaultValue) | ||
{ | ||
if (is_array($fields) && array_key_exists($variableName, $fields) && is_null($fields[$variableName]) && self::isNullable($variableName)) { | ||
array_push($this->openAPINullablesSetToNull, $variableName); | ||
} | ||
|
||
$this->container[$variableName] = isset($fields[$variableName]) ? $fields[$variableName] : $defaultValue; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
|
@@ -224,6 +305,12 @@ public function getContact() | |
*/ | ||
public function setContact($contact) | ||
{ | ||
|
||
|
||
if (is_null($contact)) { | ||
throw new \InvalidArgumentException('non-nullable contact cannot be null'); | ||
} | ||
|
||
$this->container['contact'] = $contact; | ||
|
||
return $this; | ||
|
Oops, something went wrong.