diff --git a/modules/openapi-generator/src/main/resources/php/api.mustache b/modules/openapi-generator/src/main/resources/php/api.mustache index 8d875d393782..5d7f7ae88d71 100644 --- a/modules/openapi-generator/src/main/resources/php/api.mustache +++ b/modules/openapi-generator/src/main/resources/php/api.mustache @@ -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 [ 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 3d647a96a1ee..43a4ab653e74 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php @@ -188,6 +188,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 [ @@ -202,6 +205,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 [ @@ -268,6 +274,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 df185c316e08..6dc035e21888 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php @@ -182,6 +182,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 [ @@ -196,6 +199,9 @@ public function fooGetWithHttpInfo() $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -256,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 [ 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 027fc1335a60..4bbcc72ddcab 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php @@ -186,6 +186,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 [ @@ -200,6 +203,9 @@ public function fakeHealthGetWithHttpInfo() $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -264,6 +270,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 [ @@ -682,6 +691,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 [ @@ -696,6 +708,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 [ @@ -758,6 +773,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 [ @@ -937,6 +955,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 [ @@ -951,6 +972,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 [ @@ -1013,6 +1037,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 [ @@ -1192,6 +1219,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 [ @@ -1206,6 +1236,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 [ @@ -1268,6 +1301,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 [ @@ -1447,6 +1483,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 [ @@ -1461,6 +1500,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 [ @@ -1523,6 +1565,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 [ @@ -1702,6 +1747,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 [ @@ -1716,6 +1764,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 [ @@ -1778,6 +1829,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 [ @@ -2634,6 +2688,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 [ @@ -2648,6 +2705,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 [ @@ -2714,6 +2774,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 fb19ef71181e..c76f9bca35fd 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php @@ -188,6 +188,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 [ @@ -202,6 +205,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 [ @@ -268,6 +274,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 9d0b8a8d5fdc..56ae41225ac8 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php @@ -681,6 +681,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 [ @@ -695,6 +698,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 [ @@ -761,6 +767,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 [ @@ -958,6 +967,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 [ @@ -972,6 +984,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 [ @@ -1040,6 +1055,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 [ @@ -1237,6 +1255,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 [ @@ -1251,6 +1272,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 [ @@ -1317,6 +1341,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 [ @@ -2019,6 +2046,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 [ @@ -2033,6 +2063,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 [ @@ -2103,6 +2136,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 [ @@ -2320,6 +2356,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 [ @@ -2334,6 +2373,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 [ @@ -2404,6 +2446,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 e66104dfe6b3..8f10507e35fa 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php @@ -412,6 +412,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 [ @@ -426,6 +429,9 @@ public function getInventoryWithHttpInfo() $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -490,6 +496,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 [ @@ -671,6 +680,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 [ @@ -685,6 +697,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 [ @@ -751,6 +766,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 [ @@ -949,6 +967,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 [ @@ -963,6 +984,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 [ @@ -1029,6 +1053,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 7fc72214ecef..0ce53c64f511 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php @@ -1086,6 +1086,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 [ @@ -1100,6 +1103,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 [ @@ -1166,6 +1172,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 [ @@ -1359,6 +1368,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 [ @@ -1373,6 +1385,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 [ @@ -1441,6 +1456,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 [