diff --git a/modules/openapi-generator/src/main/resources/php/api.mustache b/modules/openapi-generator/src/main/resources/php/api.mustache index 206c0a25826a..20bd581079dd 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 [ @@ -237,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 [ @@ -355,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 56d6d46064d8..af0c8ebfa503 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 [ @@ -194,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 [ @@ -260,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 6bd203664b52..5e228e9fa738 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 [ @@ -188,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 [ @@ -248,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 bbb07a5052e0..a1f1039c8f62 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 [ @@ -192,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 [ @@ -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 [ @@ -663,6 +672,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 [ @@ -677,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 [ @@ -739,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 [ @@ -911,6 +929,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 [ @@ -925,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 [ @@ -987,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 [ @@ -1159,6 +1186,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 [ @@ -1173,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 [ @@ -1235,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 [ @@ -1407,6 +1443,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 [ @@ -1421,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 [ @@ -1483,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 [ @@ -1655,6 +1700,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 [ @@ -1669,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 [ @@ -1731,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 [ @@ -2353,6 +2407,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 [ @@ -2367,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 [ @@ -2433,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 54e0401ada01..203493b4c226 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 [ @@ -194,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 [ @@ -260,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 d6283a8c7527..2506dc9203f8 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 [ @@ -673,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 [ @@ -739,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 [ @@ -926,6 +935,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 [ @@ -940,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 [ @@ -1006,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 [ @@ -1194,6 +1212,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 [ @@ -1208,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 [ @@ -1274,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 [ @@ -1955,6 +1982,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 [ @@ -1969,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 [ @@ -2039,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 [ @@ -2249,6 +2285,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 [ @@ -2263,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 [ @@ -2333,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 7d1042ec3b1f..9e613308715a 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 [ @@ -411,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 [ @@ -475,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 [ @@ -649,6 +658,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 [ @@ -663,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 [ @@ -729,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 [ @@ -920,6 +938,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 [ @@ -934,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 [ @@ -1000,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 6e3fa9a1bbb6..fb9224803b81 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 [ @@ -1064,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 [ @@ -1130,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 [ @@ -1316,6 +1325,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 [ @@ -1330,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 [ @@ -1398,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 [