forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin/6.3.x' into 7.0.x
This commit is contained in:
@@ -87,7 +87,7 @@ class ObjectSerializer
|
||||
foreach ($data::openAPITypes() as $property => $openAPIType) {
|
||||
$getter = $data::getters()[$property];
|
||||
$value = $data->$getter();
|
||||
if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) {
|
||||
if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) {
|
||||
$callable = [$openAPIType, 'getAllowableEnumValues'];
|
||||
if (is_callable($callable)) {
|
||||
/** array $callable */
|
||||
@@ -189,6 +189,11 @@ class ObjectSerializer
|
||||
}
|
||||
}
|
||||
|
||||
# Handle DateTime objects in query
|
||||
if($openApiType === "\\DateTime" && $value instanceof \DateTime) {
|
||||
return ["{$paramName}" => $value->format(self::$dateTimeFormat)];
|
||||
}
|
||||
|
||||
$query = [];
|
||||
$value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value;
|
||||
|
||||
@@ -441,7 +446,7 @@ class ObjectSerializer
|
||||
}
|
||||
|
||||
/** @psalm-suppress ParadoxicalCondition */
|
||||
if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) {
|
||||
if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) {
|
||||
settype($data, $class);
|
||||
return $data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user