diff --git a/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache b/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache index 99b992ed5dd..cb56402db1a 100644 --- a/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache +++ b/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache @@ -209,23 +209,26 @@ class ObjectSerializer * * @return string */ - public static function serializeCollection(array $collection, $collectionFormat, $allowCollectionFormatMulti = false) + public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false) { if ($allowCollectionFormatMulti && ('multi' === $collectionFormat)) { // http_build_query() almost does the job for us. We just // need to fix the result of multidimensional arrays. return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); } - switch ($collectionFormat) { + switch ($style) { + case 'pipeDelimited': case 'pipes': return implode('|', $collection); case 'tsv': return implode("\t", $collection); + case 'spaceDelimited': case 'ssv': return implode(' ', $collection); + case 'simple': case 'csv': // Deliberate fall through. CSV is default format. default: diff --git a/modules/openapi-generator/src/main/resources/php/api.mustache b/modules/openapi-generator/src/main/resources/php/api.mustache index 2e3fa819ce7..537cf815951 100644 --- a/modules/openapi-generator/src/main/resources/php/api.mustache +++ b/modules/openapi-generator/src/main/resources/php/api.mustache @@ -472,16 +472,24 @@ use {{invokerPackage}}\ObjectSerializer; $multipart = false; {{#queryParams}} + // query params - {{#collectionFormat}} - if (is_array(${{paramName}})) { - ${{paramName}} = ObjectSerializer::serializeCollection(${{paramName}}, '{{collectionFormat}}', true); - } - {{/collectionFormat}} + {{#isExplode}} if (${{paramName}} !== null) { - $queryParams['{{baseName}}'] = ObjectSerializer::toQueryValue(${{paramName}}); + $queryParams['{{baseName}}'] = ${{paramName}}; } + {{/isExplode}} + {{^isExplode}} + if (is_array(${{paramName}})) { + ${{paramName}} = ObjectSerializer::serializeCollection(${{paramName}}, '{{#style}}{{style}}{{/style}}{{^style}}{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}{{/style}}', true); + } + if (${{paramName}} !== null) { + $queryParams['{{baseName}}'] = ${{paramName}}; + } + {{/isExplode}} + {{/queryParams}} + {{#headerParams}} // header params {{#collectionFormat}} 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 53cf17bd905..e007829cc03 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php @@ -315,6 +315,7 @@ class AnotherFakeApi + // body params $_tempBody = null; if (isset($body)) { 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 4f4eab37ae5..e8be7d98afa 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php @@ -267,6 +267,7 @@ class FakeApi + // body params $_tempBody = null; if (isset($xml_item)) { @@ -524,6 +525,7 @@ class FakeApi + // body params $_tempBody = null; if (isset($body)) { @@ -781,6 +783,7 @@ class FakeApi + // body params $_tempBody = null; if (isset($body)) { @@ -1038,6 +1041,7 @@ class FakeApi + // body params $_tempBody = null; if (isset($body)) { @@ -1295,6 +1299,7 @@ class FakeApi + // body params $_tempBody = null; if (isset($body)) { @@ -1510,6 +1515,7 @@ class FakeApi + // body params $_tempBody = null; if (isset($body)) { @@ -1734,10 +1740,16 @@ class FakeApi $httpBody = ''; $multipart = false; + // query params - if ($query !== null) { - $queryParams['query'] = ObjectSerializer::toQueryValue($query); + if (is_array($query)) { + $query = ObjectSerializer::serializeCollection($query, '', true); } + if ($query !== null) { + $queryParams['query'] = $query; + } + + // body params @@ -2007,6 +2019,7 @@ class FakeApi + // body params $_tempBody = null; if (isset($body)) { @@ -2356,6 +2369,7 @@ class FakeApi + // form params if ($integer !== null) { $formParams['integer'] = ObjectSerializer::toFormValue($integer); @@ -2660,25 +2674,43 @@ class FakeApi $httpBody = ''; $multipart = false; + // query params if (is_array($enum_query_string_array)) { $enum_query_string_array = ObjectSerializer::serializeCollection($enum_query_string_array, 'csv', true); } if ($enum_query_string_array !== null) { - $queryParams['enum_query_string_array'] = ObjectSerializer::toQueryValue($enum_query_string_array); + $queryParams['enum_query_string_array'] = $enum_query_string_array; } + + // query params + if (is_array($enum_query_string)) { + $enum_query_string = ObjectSerializer::serializeCollection($enum_query_string, '', true); + } if ($enum_query_string !== null) { - $queryParams['enum_query_string'] = ObjectSerializer::toQueryValue($enum_query_string); + $queryParams['enum_query_string'] = $enum_query_string; } + + // query params + if (is_array($enum_query_integer)) { + $enum_query_integer = ObjectSerializer::serializeCollection($enum_query_integer, '', true); + } if ($enum_query_integer !== null) { - $queryParams['enum_query_integer'] = ObjectSerializer::toQueryValue($enum_query_integer); + $queryParams['enum_query_integer'] = $enum_query_integer; } + + // query params - if ($enum_query_double !== null) { - $queryParams['enum_query_double'] = ObjectSerializer::toQueryValue($enum_query_double); + if (is_array($enum_query_double)) { + $enum_query_double = ObjectSerializer::serializeCollection($enum_query_double, '', true); } + if ($enum_query_double !== null) { + $queryParams['enum_query_double'] = $enum_query_double; + } + + // header params if (is_array($enum_header_string_array)) { $enum_header_string_array = ObjectSerializer::serializeCollection($enum_header_string_array, 'csv'); @@ -2969,22 +3001,43 @@ class FakeApi $httpBody = ''; $multipart = false; + // query params + if (is_array($required_string_group)) { + $required_string_group = ObjectSerializer::serializeCollection($required_string_group, '', true); + } if ($required_string_group !== null) { - $queryParams['required_string_group'] = ObjectSerializer::toQueryValue($required_string_group); + $queryParams['required_string_group'] = $required_string_group; } + + // query params + if (is_array($required_int64_group)) { + $required_int64_group = ObjectSerializer::serializeCollection($required_int64_group, '', true); + } if ($required_int64_group !== null) { - $queryParams['required_int64_group'] = ObjectSerializer::toQueryValue($required_int64_group); + $queryParams['required_int64_group'] = $required_int64_group; } + + // query params + if (is_array($string_group)) { + $string_group = ObjectSerializer::serializeCollection($string_group, '', true); + } if ($string_group !== null) { - $queryParams['string_group'] = ObjectSerializer::toQueryValue($string_group); + $queryParams['string_group'] = $string_group; } + + // query params - if ($int64_group !== null) { - $queryParams['int64_group'] = ObjectSerializer::toQueryValue($int64_group); + if (is_array($int64_group)) { + $int64_group = ObjectSerializer::serializeCollection($int64_group, '', true); } + if ($int64_group !== null) { + $queryParams['int64_group'] = $int64_group; + } + + // header params if ($required_boolean_group !== null) { $headerParams['required_boolean_group'] = ObjectSerializer::toHeaderValue($required_boolean_group); @@ -3211,6 +3264,7 @@ class FakeApi + // body params $_tempBody = null; if (isset($param)) { @@ -3441,6 +3495,7 @@ class FakeApi + // form params if ($param !== null) { $formParams['param'] = ObjectSerializer::toFormValue($param); @@ -3703,43 +3758,51 @@ class FakeApi $httpBody = ''; $multipart = false; + // query params if (is_array($pipe)) { $pipe = ObjectSerializer::serializeCollection($pipe, 'csv', true); } if ($pipe !== null) { - $queryParams['pipe'] = ObjectSerializer::toQueryValue($pipe); + $queryParams['pipe'] = $pipe; } + + // query params if (is_array($ioutil)) { $ioutil = ObjectSerializer::serializeCollection($ioutil, 'csv', true); } if ($ioutil !== null) { - $queryParams['ioutil'] = ObjectSerializer::toQueryValue($ioutil); + $queryParams['ioutil'] = $ioutil; } + + // query params if (is_array($http)) { $http = ObjectSerializer::serializeCollection($http, 'space', true); } if ($http !== null) { - $queryParams['http'] = ObjectSerializer::toQueryValue($http); + $queryParams['http'] = $http; } + + // query params if (is_array($url)) { $url = ObjectSerializer::serializeCollection($url, 'csv', true); } if ($url !== null) { - $queryParams['url'] = ObjectSerializer::toQueryValue($url); + $queryParams['url'] = $url; } + + // query params - if (is_array($context)) { - $context = ObjectSerializer::serializeCollection($context, 'multi', true); - } if ($context !== null) { - $queryParams['context'] = ObjectSerializer::toQueryValue($context); + $queryParams['context'] = $context; } + + // body params $_tempBody = null; 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 75a5720ebb1..f24b2135b01 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php @@ -315,6 +315,7 @@ class FakeClassnameTags123Api + // body params $_tempBody = null; if (isset($body)) { 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 5757418a405..2038687c457 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php @@ -267,6 +267,7 @@ class PetApi + // body params $_tempBody = null; if (isset($body)) { @@ -493,6 +494,7 @@ class PetApi $httpBody = ''; $multipart = false; + // header params if ($api_key !== null) { $headerParams['api_key'] = ObjectSerializer::toHeaderValue($api_key); @@ -773,15 +775,18 @@ class PetApi $httpBody = ''; $multipart = false; + // query params if (is_array($status)) { $status = ObjectSerializer::serializeCollection($status, 'csv', true); } if ($status !== null) { - $queryParams['status'] = ObjectSerializer::toQueryValue($status); + $queryParams['status'] = $status; } + + // body params $_tempBody = null; @@ -1048,15 +1053,18 @@ class PetApi $httpBody = ''; $multipart = false; + // query params if (is_array($tags)) { $tags = ObjectSerializer::serializeCollection($tags, 'csv', true); } if ($tags !== null) { - $queryParams['tags'] = ObjectSerializer::toQueryValue($tags); + $queryParams['tags'] = $tags; } + + // body params $_tempBody = null; @@ -1324,6 +1332,7 @@ class PetApi $multipart = false; + // path params if ($pet_id !== null) { $resourcePath = str_replace( @@ -1554,6 +1563,7 @@ class PetApi + // body params $_tempBody = null; if (isset($body)) { @@ -1786,6 +1796,7 @@ class PetApi $multipart = false; + // path params if ($pet_id !== null) { $resourcePath = str_replace( @@ -2080,6 +2091,7 @@ class PetApi $multipart = false; + // path params if ($pet_id !== null) { $resourcePath = str_replace( @@ -2381,6 +2393,7 @@ class PetApi $multipart = false; + // path params if ($pet_id !== null) { $resourcePath = str_replace( 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 a5feaf119ea..e4ef46ca918 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php @@ -266,6 +266,7 @@ class StoreApi $multipart = false; + // path params if ($order_id !== null) { $resourcePath = str_replace( @@ -528,6 +529,7 @@ class StoreApi + // body params $_tempBody = null; @@ -803,6 +805,7 @@ class StoreApi $multipart = false; + // path params if ($order_id !== null) { $resourcePath = str_replace( @@ -1076,6 +1079,7 @@ class StoreApi + // body params $_tempBody = null; if (isset($body)) { 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 952dbb64f4e..9345f4b155b 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php @@ -267,6 +267,7 @@ class UserApi + // body params $_tempBody = null; if (isset($body)) { @@ -486,6 +487,7 @@ class UserApi + // body params $_tempBody = null; if (isset($body)) { @@ -705,6 +707,7 @@ class UserApi + // body params $_tempBody = null; if (isset($body)) { @@ -923,6 +926,7 @@ class UserApi $multipart = false; + // path params if ($username !== null) { $resourcePath = str_replace( @@ -1195,6 +1199,7 @@ class UserApi $multipart = false; + // path params if ($username !== null) { $resourcePath = str_replace( @@ -1477,14 +1482,25 @@ class UserApi $httpBody = ''; $multipart = false; + // query params + if (is_array($username)) { + $username = ObjectSerializer::serializeCollection($username, '', true); + } if ($username !== null) { - $queryParams['username'] = ObjectSerializer::toQueryValue($username); + $queryParams['username'] = $username; } + + // query params - if ($password !== null) { - $queryParams['password'] = ObjectSerializer::toQueryValue($password); + if (is_array($password)) { + $password = ObjectSerializer::serializeCollection($password, '', true); } + if ($password !== null) { + $queryParams['password'] = $password; + } + + // body params @@ -1692,6 +1708,7 @@ class UserApi + // body params $_tempBody = null; @@ -1918,6 +1935,7 @@ class UserApi $multipart = false; + // path params if ($username !== null) { $resourcePath = str_replace( diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php b/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php index d1a79c952b8..00cd2bbb70a 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php @@ -219,23 +219,26 @@ class ObjectSerializer * * @return string */ - public static function serializeCollection(array $collection, $collectionFormat, $allowCollectionFormatMulti = false) + public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false) { if ($allowCollectionFormatMulti && ('multi' === $collectionFormat)) { // http_build_query() almost does the job for us. We just // need to fix the result of multidimensional arrays. return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); } - switch ($collectionFormat) { + switch ($style) { + case 'pipeDelimited': case 'pipes': return implode('|', $collection); case 'tsv': return implode("\t", $collection); + case 'spaceDelimited': case 'ssv': return implode(' ', $collection); + case 'simple': case 'csv': // Deliberate fall through. CSV is default format. default: diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php index 29e01e280a1..52db238b685 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php @@ -315,6 +315,7 @@ class AnotherFakeApi + // body params $_tempBody = null; if (isset($client)) { diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php index a85b19dec81..ac819eb63d1 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php @@ -300,6 +300,7 @@ class DefaultApi + // body params $_tempBody = null; diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php index 524c044f578..fa9305cfbb4 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php @@ -304,6 +304,7 @@ class FakeApi + // body params $_tempBody = null; @@ -558,6 +559,7 @@ class FakeApi + // body params $_tempBody = null; if (isset($body)) { @@ -815,6 +817,7 @@ class FakeApi + // body params $_tempBody = null; if (isset($outer_composite)) { @@ -1072,6 +1075,7 @@ class FakeApi + // body params $_tempBody = null; if (isset($body)) { @@ -1329,6 +1333,7 @@ class FakeApi + // body params $_tempBody = null; if (isset($body)) { @@ -1544,6 +1549,7 @@ class FakeApi + // body params $_tempBody = null; if (isset($file_schema_test_class)) { @@ -1768,12 +1774,15 @@ class FakeApi $httpBody = ''; $multipart = false; + // query params if ($query !== null) { - $queryParams['query'] = ObjectSerializer::toQueryValue($query); + $queryParams['query'] = $query; } + + // body params $_tempBody = null; if (isset($user)) { @@ -2041,6 +2050,7 @@ class FakeApi + // body params $_tempBody = null; if (isset($client)) { @@ -2390,6 +2400,7 @@ class FakeApi + // form params if ($integer !== null) { $formParams['integer'] = ObjectSerializer::toFormValue($integer); @@ -2694,25 +2705,31 @@ class FakeApi $httpBody = ''; $multipart = false; + // query params - if (is_array($enum_query_string_array)) { - $enum_query_string_array = ObjectSerializer::serializeCollection($enum_query_string_array, 'multi', true); - } if ($enum_query_string_array !== null) { - $queryParams['enum_query_string_array'] = ObjectSerializer::toQueryValue($enum_query_string_array); + $queryParams['enum_query_string_array'] = $enum_query_string_array; } + + // query params if ($enum_query_string !== null) { - $queryParams['enum_query_string'] = ObjectSerializer::toQueryValue($enum_query_string); + $queryParams['enum_query_string'] = $enum_query_string; } + + // query params if ($enum_query_integer !== null) { - $queryParams['enum_query_integer'] = ObjectSerializer::toQueryValue($enum_query_integer); + $queryParams['enum_query_integer'] = $enum_query_integer; } + + // query params if ($enum_query_double !== null) { - $queryParams['enum_query_double'] = ObjectSerializer::toQueryValue($enum_query_double); + $queryParams['enum_query_double'] = $enum_query_double; } + + // header params if (is_array($enum_header_string_array)) { $enum_header_string_array = ObjectSerializer::serializeCollection($enum_header_string_array, 'csv'); @@ -3003,22 +3020,31 @@ class FakeApi $httpBody = ''; $multipart = false; + // query params if ($required_string_group !== null) { - $queryParams['required_string_group'] = ObjectSerializer::toQueryValue($required_string_group); + $queryParams['required_string_group'] = $required_string_group; } + + // query params if ($required_int64_group !== null) { - $queryParams['required_int64_group'] = ObjectSerializer::toQueryValue($required_int64_group); + $queryParams['required_int64_group'] = $required_int64_group; } + + // query params if ($string_group !== null) { - $queryParams['string_group'] = ObjectSerializer::toQueryValue($string_group); + $queryParams['string_group'] = $string_group; } + + // query params if ($int64_group !== null) { - $queryParams['int64_group'] = ObjectSerializer::toQueryValue($int64_group); + $queryParams['int64_group'] = $int64_group; } + + // header params if ($required_boolean_group !== null) { $headerParams['required_boolean_group'] = ObjectSerializer::toHeaderValue($required_boolean_group); @@ -3249,6 +3275,7 @@ class FakeApi + // body params $_tempBody = null; if (isset($request_body)) { @@ -3479,6 +3506,7 @@ class FakeApi + // form params if ($param !== null) { $formParams['param'] = ObjectSerializer::toFormValue($param); @@ -3741,43 +3769,48 @@ class FakeApi $httpBody = ''; $multipart = false; + // query params - if (is_array($pipe)) { - $pipe = ObjectSerializer::serializeCollection($pipe, 'multi', true); - } if ($pipe !== null) { - $queryParams['pipe'] = ObjectSerializer::toQueryValue($pipe); + $queryParams['pipe'] = $pipe; } + + // query params if (is_array($ioutil)) { $ioutil = ObjectSerializer::serializeCollection($ioutil, 'csv', true); } if ($ioutil !== null) { - $queryParams['ioutil'] = ObjectSerializer::toQueryValue($ioutil); + $queryParams['ioutil'] = $ioutil; } + + // query params if (is_array($http)) { $http = ObjectSerializer::serializeCollection($http, 'space', true); } if ($http !== null) { - $queryParams['http'] = ObjectSerializer::toQueryValue($http); + $queryParams['http'] = $http; } + + // query params if (is_array($url)) { $url = ObjectSerializer::serializeCollection($url, 'csv', true); } if ($url !== null) { - $queryParams['url'] = ObjectSerializer::toQueryValue($url); + $queryParams['url'] = $url; } + + // query params - if (is_array($context)) { - $context = ObjectSerializer::serializeCollection($context, 'multi', true); - } if ($context !== null) { - $queryParams['context'] = ObjectSerializer::toQueryValue($context); + $queryParams['context'] = $context; } + + // body params $_tempBody = null; diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php index a7ec94a0804..cf63e7162ce 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php @@ -315,6 +315,7 @@ class FakeClassnameTags123Api + // body params $_tempBody = null; if (isset($client)) { diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php index 7c0918c4133..37b798c0417 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php @@ -287,6 +287,7 @@ class PetApi + // body params $_tempBody = null; if (isset($pet)) { @@ -519,6 +520,7 @@ class PetApi $httpBody = ''; $multipart = false; + // header params if ($api_key !== null) { $headerParams['api_key'] = ObjectSerializer::toHeaderValue($api_key); @@ -799,15 +801,18 @@ class PetApi $httpBody = ''; $multipart = false; + // query params if (is_array($status)) { $status = ObjectSerializer::serializeCollection($status, 'csv', true); } if ($status !== null) { - $queryParams['status'] = ObjectSerializer::toQueryValue($status); + $queryParams['status'] = $status; } + + // body params $_tempBody = null; @@ -1074,15 +1079,18 @@ class PetApi $httpBody = ''; $multipart = false; + // query params if (is_array($tags)) { $tags = ObjectSerializer::serializeCollection($tags, 'csv', true); } if ($tags !== null) { - $queryParams['tags'] = ObjectSerializer::toQueryValue($tags); + $queryParams['tags'] = $tags; } + + // body params $_tempBody = null; @@ -1350,6 +1358,7 @@ class PetApi $multipart = false; + // path params if ($pet_id !== null) { $resourcePath = str_replace( @@ -1600,6 +1609,7 @@ class PetApi + // body params $_tempBody = null; if (isset($pet)) { @@ -1838,6 +1848,7 @@ class PetApi $multipart = false; + // path params if ($pet_id !== null) { $resourcePath = str_replace( @@ -2132,6 +2143,7 @@ class PetApi $multipart = false; + // path params if ($pet_id !== null) { $resourcePath = str_replace( @@ -2433,6 +2445,7 @@ class PetApi $multipart = false; + // path params if ($pet_id !== null) { $resourcePath = str_replace( diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php index 3c9d49d312f..d6e1c8dbf37 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php @@ -266,6 +266,7 @@ class StoreApi $multipart = false; + // path params if ($order_id !== null) { $resourcePath = str_replace( @@ -528,6 +529,7 @@ class StoreApi + // body params $_tempBody = null; @@ -803,6 +805,7 @@ class StoreApi $multipart = false; + // path params if ($order_id !== null) { $resourcePath = str_replace( @@ -1076,6 +1079,7 @@ class StoreApi + // body params $_tempBody = null; if (isset($order)) { diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php index 44179de08c4..4da3fa6fe20 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php @@ -267,6 +267,7 @@ class UserApi + // body params $_tempBody = null; if (isset($user)) { @@ -486,6 +487,7 @@ class UserApi + // body params $_tempBody = null; if (isset($user)) { @@ -705,6 +707,7 @@ class UserApi + // body params $_tempBody = null; if (isset($user)) { @@ -923,6 +926,7 @@ class UserApi $multipart = false; + // path params if ($username !== null) { $resourcePath = str_replace( @@ -1195,6 +1199,7 @@ class UserApi $multipart = false; + // path params if ($username !== null) { $resourcePath = str_replace( @@ -1477,16 +1482,21 @@ class UserApi $httpBody = ''; $multipart = false; + // query params if ($username !== null) { - $queryParams['username'] = ObjectSerializer::toQueryValue($username); + $queryParams['username'] = $username; } + + // query params if ($password !== null) { - $queryParams['password'] = ObjectSerializer::toQueryValue($password); + $queryParams['password'] = $password; } + + // body params $_tempBody = null; @@ -1692,6 +1702,7 @@ class UserApi + // body params $_tempBody = null; @@ -1918,6 +1929,7 @@ class UserApi $multipart = false; + // path params if ($username !== null) { $resourcePath = str_replace( diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php index d1a79c952b8..00cd2bbb70a 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php @@ -219,23 +219,26 @@ class ObjectSerializer * * @return string */ - public static function serializeCollection(array $collection, $collectionFormat, $allowCollectionFormatMulti = false) + public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false) { if ($allowCollectionFormatMulti && ('multi' === $collectionFormat)) { // http_build_query() almost does the job for us. We just // need to fix the result of multidimensional arrays. return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); } - switch ($collectionFormat) { + switch ($style) { + case 'pipeDelimited': case 'pipes': return implode('|', $collection); case 'tsv': return implode("\t", $collection); + case 'spaceDelimited': case 'ssv': return implode(' ', $collection); + case 'simple': case 'csv': // Deliberate fall through. CSV is default format. default: