forked from loafle/openapi-generator-original
[php] Fix JSON object deserialization (#8481)
* Fix JSON object deserialization * Revert "Fix JSON object deserialization" This reverts commit 42a4637e53020d8d3e921f72bc66de9d4ccd8151. * Add JSON body decoding before deserialize call * Add two more json_decode calls Co-authored-by: Thomas Hansen <thomas@thomasphansen.dk>
This commit is contained in:
parent
081619eebe
commit
956ad2aecc
@ -233,6 +233,9 @@ use {{invokerPackage}}\ObjectSerializer;
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ('{{dataType}}' !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -251,6 +254,9 @@ use {{invokerPackage}}\ObjectSerializer;
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -375,6 +381,9 @@ use {{invokerPackage}}\ObjectSerializer;
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
|
@ -188,6 +188,9 @@ class AnotherFakeApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ('\OpenAPI\Client\Model\Client' !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -202,6 +205,9 @@ class AnotherFakeApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -268,6 +274,9 @@ class AnotherFakeApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
|
@ -182,6 +182,9 @@ class DefaultApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ('\OpenAPI\Client\Model\InlineResponseDefault' !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -196,6 +199,9 @@ class DefaultApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -256,6 +262,9 @@ class DefaultApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
|
@ -186,6 +186,9 @@ class FakeApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ('\OpenAPI\Client\Model\HealthCheckResult' !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -200,6 +203,9 @@ class FakeApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -264,6 +270,9 @@ class FakeApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -682,6 +691,9 @@ class FakeApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ('bool' !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -696,6 +708,9 @@ class FakeApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -758,6 +773,9 @@ class FakeApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -937,6 +955,9 @@ class FakeApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ('\OpenAPI\Client\Model\OuterComposite' !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -951,6 +972,9 @@ class FakeApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -1013,6 +1037,9 @@ class FakeApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -1192,6 +1219,9 @@ class FakeApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ('float' !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -1206,6 +1236,9 @@ class FakeApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -1268,6 +1301,9 @@ class FakeApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -1447,6 +1483,9 @@ class FakeApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ('string' !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -1461,6 +1500,9 @@ class FakeApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -1523,6 +1565,9 @@ class FakeApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -1702,6 +1747,9 @@ class FakeApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ('\OpenAPI\Client\Model\OuterObjectWithEnumProperty' !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -1716,6 +1764,9 @@ class FakeApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -1778,6 +1829,9 @@ class FakeApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -2634,6 +2688,9 @@ class FakeApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ('\OpenAPI\Client\Model\Client' !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -2648,6 +2705,9 @@ class FakeApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -2714,6 +2774,9 @@ class FakeApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
|
@ -188,6 +188,9 @@ class FakeClassnameTags123Api
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ('\OpenAPI\Client\Model\Client' !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -202,6 +205,9 @@ class FakeClassnameTags123Api
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -268,6 +274,9 @@ class FakeClassnameTags123Api
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
|
@ -681,6 +681,9 @@ class PetApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ('\OpenAPI\Client\Model\Pet[]' !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -695,6 +698,9 @@ class PetApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -761,6 +767,9 @@ class PetApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -958,6 +967,9 @@ class PetApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ('\OpenAPI\Client\Model\Pet[]' !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -972,6 +984,9 @@ class PetApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -1040,6 +1055,9 @@ class PetApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -1237,6 +1255,9 @@ class PetApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ('\OpenAPI\Client\Model\Pet' !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -1251,6 +1272,9 @@ class PetApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -1317,6 +1341,9 @@ class PetApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -2019,6 +2046,9 @@ class PetApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ('\OpenAPI\Client\Model\ApiResponse' !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -2033,6 +2063,9 @@ class PetApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -2103,6 +2136,9 @@ class PetApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -2320,6 +2356,9 @@ class PetApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ('\OpenAPI\Client\Model\ApiResponse' !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -2334,6 +2373,9 @@ class PetApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -2404,6 +2446,9 @@ class PetApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
|
@ -412,6 +412,9 @@ class StoreApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ('array<string,int>' !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -426,6 +429,9 @@ class StoreApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -490,6 +496,9 @@ class StoreApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -671,6 +680,9 @@ class StoreApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ('\OpenAPI\Client\Model\Order' !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -685,6 +697,9 @@ class StoreApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -751,6 +766,9 @@ class StoreApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -949,6 +967,9 @@ class StoreApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ('\OpenAPI\Client\Model\Order' !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -963,6 +984,9 @@ class StoreApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -1029,6 +1053,9 @@ class StoreApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
|
@ -1086,6 +1086,9 @@ class UserApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ('\OpenAPI\Client\Model\User' !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -1100,6 +1103,9 @@ class UserApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -1166,6 +1172,9 @@ class UserApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -1359,6 +1368,9 @@ class UserApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ('string' !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -1373,6 +1385,9 @@ class UserApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
@ -1441,6 +1456,9 @@ class UserApi
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
|
Loading…
x
Reference in New Issue
Block a user