forked from loafle/openapi-generator-original
[PHP] Use appDescription in composer.mustache (#1485)
* Use appDescription in composer.mustache
* Update petstore files
* More updated php petstore files
* Yet another updated php petstore file
* Use "{{{appDescription}}}" instead of "{{appDescription}}"
This commit is contained in:
committed by
Akihito Nakano
parent
2b58f6737a
commit
792f95eb09
@@ -18,7 +18,7 @@
|
||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Generated by: https://openapi-generator.tech
|
||||
* OpenAPI Generator version: 3.3.0-SNAPSHOT
|
||||
* OpenAPI Generator version: 3.3.4-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -29,6 +29,8 @@
|
||||
|
||||
namespace OpenAPI\Client;
|
||||
|
||||
use OpenAPI\Client\Model\ModelInterface;
|
||||
|
||||
/**
|
||||
* ObjectSerializer Class Doc Comment
|
||||
*
|
||||
@@ -61,19 +63,25 @@ class ObjectSerializer
|
||||
return $data;
|
||||
} elseif (is_object($data)) {
|
||||
$values = [];
|
||||
$formats = $data::openAPIFormats();
|
||||
foreach ($data::openAPITypes() as $property => $openAPIType) {
|
||||
$getter = $data::getters()[$property];
|
||||
$value = $data->$getter();
|
||||
if ($value !== null
|
||||
&& !in_array($openAPIType, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)
|
||||
&& method_exists($openAPIType, 'getAllowableEnumValues')
|
||||
&& !in_array($value, $openAPIType::getAllowableEnumValues(), true)) {
|
||||
$imploded = implode("', '", $openAPIType::getAllowableEnumValues());
|
||||
throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'");
|
||||
if ($data instanceof ModelInterface) {
|
||||
$formats = $data::openAPIFormats();
|
||||
foreach ($data::openAPITypes() as $property => $openAPIType) {
|
||||
$getter = $data::getters()[$property];
|
||||
$value = $data->$getter();
|
||||
if ($value !== null
|
||||
&& !in_array($openAPIType, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)
|
||||
&& method_exists($openAPIType, 'getAllowableEnumValues')
|
||||
&& !in_array($value, $openAPIType::getAllowableEnumValues(), true)) {
|
||||
$imploded = implode("', '", $openAPIType::getAllowableEnumValues());
|
||||
throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'");
|
||||
}
|
||||
if ($value !== null) {
|
||||
$values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]);
|
||||
}
|
||||
}
|
||||
if ($value !== null) {
|
||||
$values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]);
|
||||
} else {
|
||||
foreach($data as $property => $value) {
|
||||
$values[$property] = self::sanitizeForSerialization($value);
|
||||
}
|
||||
}
|
||||
return (object)$values;
|
||||
|
||||
Reference in New Issue
Block a user