From c4725251a79842cf8e7790d9a4a5edc04baf1260 Mon Sep 17 00:00:00 2001 From: Yuriy Belenko Date: Wed, 20 Jan 2021 11:43:22 +0300 Subject: [PATCH 1/4] Fix JSON object deserialization --- .../src/main/resources/php/ObjectSerializer.mustache | 3 +++ .../petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php | 3 +++ 2 files changed, 6 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache b/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache index 0d8490f057ed..62731c026a6e 100644 --- a/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache +++ b/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache @@ -294,6 +294,9 @@ class ObjectSerializer } if ($class === 'object') { + // have no idea why encoded data gets over here + // but at least it's a quick fix + $data = is_string($data) ? json_decode($data) : $data; settype($data, 'array'); return $data; } diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php b/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php index 37cb5423ba95..c98e7e6fe0a1 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php @@ -303,6 +303,9 @@ public static function deserialize($data, $class, $httpHeaders = null) } if ($class === 'object') { + // have no idea why encoded data gets over here + // but at least it's a quick fix + $data = is_string($data) ? json_decode($data) : $data; settype($data, 'array'); return $data; } From d17bcc6a559532085db081f1646e13a2ed7aac90 Mon Sep 17 00:00:00 2001 From: Yuriy Belenko Date: Thu, 22 Apr 2021 13:33:04 +0300 Subject: [PATCH 2/4] Revert "Fix JSON object deserialization" This reverts commit 42a4637e53020d8d3e921f72bc66de9d4ccd8151. --- .../src/main/resources/php/ObjectSerializer.mustache | 3 --- .../petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php | 3 --- 2 files changed, 6 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache b/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache index 62731c026a6e..0d8490f057ed 100644 --- a/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache +++ b/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache @@ -294,9 +294,6 @@ class ObjectSerializer } if ($class === 'object') { - // have no idea why encoded data gets over here - // but at least it's a quick fix - $data = is_string($data) ? json_decode($data) : $data; settype($data, 'array'); return $data; } diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php b/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php index c98e7e6fe0a1..37cb5423ba95 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php @@ -303,9 +303,6 @@ public static function deserialize($data, $class, $httpHeaders = null) } if ($class === 'object') { - // have no idea why encoded data gets over here - // but at least it's a quick fix - $data = is_string($data) ? json_decode($data) : $data; settype($data, 'array'); return $data; } From 5ee86eb8a906261b3d8c64858deb65be240b9838 Mon Sep 17 00:00:00 2001 From: Thomas Hansen Date: Thu, 22 Apr 2021 13:56:11 +0300 Subject: [PATCH 3/4] Add JSON body decoding before deserialize call --- .../src/main/resources/php/api.mustache | 3 +++ .../lib/Api/AnotherFakeApi.php | 3 +++ .../OpenAPIClient-php/lib/Api/DefaultApi.php | 3 +++ .../php/OpenAPIClient-php/lib/Api/FakeApi.php | 21 +++++++++++++++++++ .../lib/Api/FakeClassnameTags123Api.php | 3 +++ .../php/OpenAPIClient-php/lib/Api/PetApi.php | 15 +++++++++++++ .../OpenAPIClient-php/lib/Api/StoreApi.php | 9 ++++++++ .../php/OpenAPIClient-php/lib/Api/UserApi.php | 6 ++++++ 8 files changed, 63 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/php/api.mustache b/modules/openapi-generator/src/main/resources/php/api.mustache index 206c0a25826a..ffa136a44a36 100644 --- a/modules/openapi-generator/src/main/resources/php/api.mustache +++ b/modules/openapi-generator/src/main/resources/php/api.mustache @@ -219,6 +219,9 @@ use {{invokerPackage}}\ObjectSerializer; $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('{{dataType}}' !== 'string') { + $content = json_decode($content); + } } return [ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php index 56d6d46064d8..cd623a495422 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php @@ -180,6 +180,9 @@ public function call123TestSpecialTagsWithHttpInfo($client) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Client' !== 'string') { + $content = json_decode($content); + } } return [ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php index 6bd203664b52..82a7e7d84658 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php @@ -174,6 +174,9 @@ public function fooGetWithHttpInfo() $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\InlineResponseDefault' !== 'string') { + $content = json_decode($content); + } } return [ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php index bbb07a5052e0..31b7cdc79862 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php @@ -178,6 +178,9 @@ public function fakeHealthGetWithHttpInfo() $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\HealthCheckResult' !== 'string') { + $content = json_decode($content); + } } return [ @@ -663,6 +666,9 @@ public function fakeOuterBooleanSerializeWithHttpInfo($body = null) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('bool' !== 'string') { + $content = json_decode($content); + } } return [ @@ -911,6 +917,9 @@ public function fakeOuterCompositeSerializeWithHttpInfo($outer_composite = null) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\OuterComposite' !== 'string') { + $content = json_decode($content); + } } return [ @@ -1159,6 +1168,9 @@ public function fakeOuterNumberSerializeWithHttpInfo($body = null) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('float' !== 'string') { + $content = json_decode($content); + } } return [ @@ -1407,6 +1419,9 @@ public function fakeOuterStringSerializeWithHttpInfo($body = null) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('string' !== 'string') { + $content = json_decode($content); + } } return [ @@ -1655,6 +1670,9 @@ public function fakePropertyEnumIntegerSerializeWithHttpInfo($outer_object_with_ $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\OuterObjectWithEnumProperty' !== 'string') { + $content = json_decode($content); + } } return [ @@ -2353,6 +2371,9 @@ public function testClientModelWithHttpInfo($client) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Client' !== 'string') { + $content = json_decode($content); + } } return [ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php index 54e0401ada01..df95e01495e4 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php @@ -180,6 +180,9 @@ public function testClassnameWithHttpInfo($client) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Client' !== 'string') { + $content = json_decode($content); + } } return [ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php index d6283a8c7527..c3e628267f24 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php @@ -659,6 +659,9 @@ public function findPetsByStatusWithHttpInfo($status) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Pet[]' !== 'string') { + $content = json_decode($content); + } } return [ @@ -926,6 +929,9 @@ public function findPetsByTagsWithHttpInfo($tags) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Pet[]' !== 'string') { + $content = json_decode($content); + } } return [ @@ -1194,6 +1200,9 @@ public function getPetByIdWithHttpInfo($pet_id) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Pet' !== 'string') { + $content = json_decode($content); + } } return [ @@ -1955,6 +1964,9 @@ public function uploadFileWithHttpInfo($pet_id, $additional_metadata = null, $fi $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ApiResponse' !== 'string') { + $content = json_decode($content); + } } return [ @@ -2249,6 +2261,9 @@ public function uploadFileWithRequiredFileWithHttpInfo($pet_id, $required_file, $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ApiResponse' !== 'string') { + $content = json_decode($content); + } } return [ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php index 7d1042ec3b1f..c0debb0d1846 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php @@ -397,6 +397,9 @@ public function getInventoryWithHttpInfo() $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('array<string,int>' !== 'string') { + $content = json_decode($content); + } } return [ @@ -649,6 +652,9 @@ public function getOrderByIdWithHttpInfo($order_id) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Order' !== 'string') { + $content = json_decode($content); + } } return [ @@ -920,6 +926,9 @@ public function placeOrderWithHttpInfo($order) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Order' !== 'string') { + $content = json_decode($content); + } } return [ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php index 6e3fa9a1bbb6..e973af2b416a 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php @@ -1050,6 +1050,9 @@ public function getUserByNameWithHttpInfo($username) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\User' !== 'string') { + $content = json_decode($content); + } } return [ @@ -1316,6 +1319,9 @@ public function loginUserWithHttpInfo($username, $password) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('string' !== 'string') { + $content = json_decode($content); + } } return [ From 423b479ea0e9eae64f1258b7afe9dd1105ed3550 Mon Sep 17 00:00:00 2001 From: Thomas Hansen Date: Fri, 23 Apr 2021 12:03:18 +0300 Subject: [PATCH 4/4] Add two more json_decode calls --- .../src/main/resources/php/api.mustache | 6 +++ .../lib/Api/AnotherFakeApi.php | 6 +++ .../OpenAPIClient-php/lib/Api/DefaultApi.php | 6 +++ .../php/OpenAPIClient-php/lib/Api/FakeApi.php | 42 +++++++++++++++++++ .../lib/Api/FakeClassnameTags123Api.php | 6 +++ .../php/OpenAPIClient-php/lib/Api/PetApi.php | 30 +++++++++++++ .../OpenAPIClient-php/lib/Api/StoreApi.php | 18 ++++++++ .../php/OpenAPIClient-php/lib/Api/UserApi.php | 12 ++++++ 8 files changed, 126 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/php/api.mustache b/modules/openapi-generator/src/main/resources/php/api.mustache index ffa136a44a36..20bd581079dd 100644 --- a/modules/openapi-generator/src/main/resources/php/api.mustache +++ b/modules/openapi-generator/src/main/resources/php/api.mustache @@ -240,6 +240,9 @@ use {{invokerPackage}}\ObjectSerializer; $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -358,6 +361,9 @@ use {{invokerPackage}}\ObjectSerializer; $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php index cd623a495422..af0c8ebfa503 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php @@ -197,6 +197,9 @@ public function call123TestSpecialTagsWithHttpInfo($client) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -263,6 +266,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php index 82a7e7d84658..5e228e9fa738 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php @@ -191,6 +191,9 @@ public function fooGetWithHttpInfo() $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -251,6 +254,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php index 31b7cdc79862..a1f1039c8f62 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php @@ -195,6 +195,9 @@ public function fakeHealthGetWithHttpInfo() $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -259,6 +262,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -683,6 +689,9 @@ public function fakeOuterBooleanSerializeWithHttpInfo($body = null) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -745,6 +754,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -934,6 +946,9 @@ public function fakeOuterCompositeSerializeWithHttpInfo($outer_composite = null) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -996,6 +1011,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1185,6 +1203,9 @@ public function fakeOuterNumberSerializeWithHttpInfo($body = null) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1247,6 +1268,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1436,6 +1460,9 @@ public function fakeOuterStringSerializeWithHttpInfo($body = null) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1498,6 +1525,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1687,6 +1717,9 @@ public function fakePropertyEnumIntegerSerializeWithHttpInfo($outer_object_with_ $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1749,6 +1782,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -2388,6 +2424,9 @@ public function testClientModelWithHttpInfo($client) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -2454,6 +2493,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php index df95e01495e4..203493b4c226 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php @@ -197,6 +197,9 @@ public function testClassnameWithHttpInfo($client) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -263,6 +266,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php index c3e628267f24..2506dc9203f8 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php @@ -676,6 +676,9 @@ public function findPetsByStatusWithHttpInfo($status) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -742,6 +745,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -946,6 +952,9 @@ public function findPetsByTagsWithHttpInfo($tags) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1012,6 +1021,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1217,6 +1229,9 @@ public function getPetByIdWithHttpInfo($pet_id) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1283,6 +1298,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1981,6 +1999,9 @@ public function uploadFileWithHttpInfo($pet_id, $additional_metadata = null, $fi $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -2051,6 +2072,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -2278,6 +2302,9 @@ public function uploadFileWithRequiredFileWithHttpInfo($pet_id, $required_file, $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -2348,6 +2375,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php index c0debb0d1846..9e613308715a 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php @@ -414,6 +414,9 @@ public function getInventoryWithHttpInfo() $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -478,6 +481,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -669,6 +675,9 @@ public function getOrderByIdWithHttpInfo($order_id) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -735,6 +744,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -943,6 +955,9 @@ public function placeOrderWithHttpInfo($order) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1009,6 +1024,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php index e973af2b416a..fb9224803b81 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php @@ -1067,6 +1067,9 @@ public function getUserByNameWithHttpInfo($username) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1133,6 +1136,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1336,6 +1342,9 @@ public function loginUserWithHttpInfo($username, $password) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1404,6 +1413,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [