diff --git a/modules/openapi-generator/src/main/resources/php/api.mustache b/modules/openapi-generator/src/main/resources/php/api.mustache index 537cf815951b4d4b30e20f3c99c600ee5852a2ef..2014b8ec83bdf8867a93832830d1a483100880d8 100644 --- a/modules/openapi-generator/src/main/resources/php/api.mustache +++ b/modules/openapi-generator/src/main/resources/php/api.mustache @@ -472,11 +472,22 @@ use {{invokerPackage}}\ObjectSerializer; $multipart = false; {{#queryParams}} - // query params {{#isExplode}} if (${{paramName}} !== null) { + {{#style}} + if('form' === '{{style}}' && is_array(${{paramName}})) { + foreach(${{paramName}} as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['{{baseName}}'] = ${{paramName}}; + } + {{/style}} + {{^style}} $queryParams['{{baseName}}'] = ${{paramName}}; + {{/style}} } {{/isExplode}} {{^isExplode}} @@ -487,7 +498,6 @@ use {{invokerPackage}}\ObjectSerializer; $queryParams['{{baseName}}'] = ${{paramName}}; } {{/isExplode}} - {{/queryParams}} {{#headerParams}} 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 e8be7d98afa65fb7fc0a6c5f10b3a93d6c349311..c2508552e1a042f218b08ee5c76f398251b90524 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php @@ -1740,7 +1740,6 @@ class FakeApi $httpBody = ''; $multipart = false; - // query params if (is_array($query)) { $query = ObjectSerializer::serializeCollection($query, '', true); @@ -1751,7 +1750,6 @@ class FakeApi - // body params $_tempBody = null; if (isset($body)) { @@ -2674,16 +2672,13 @@ 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); + $enum_query_string_array = ObjectSerializer::serializeCollection($enum_query_string_array, 'form', true); } if ($enum_query_string_array !== null) { $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); @@ -2691,8 +2686,6 @@ class FakeApi if ($enum_query_string !== null) { $queryParams['enum_query_string'] = $enum_query_string; } - - // query params if (is_array($enum_query_integer)) { $enum_query_integer = ObjectSerializer::serializeCollection($enum_query_integer, '', true); @@ -2700,8 +2693,6 @@ class FakeApi if ($enum_query_integer !== null) { $queryParams['enum_query_integer'] = $enum_query_integer; } - - // query params if (is_array($enum_query_double)) { $enum_query_double = ObjectSerializer::serializeCollection($enum_query_double, '', true); @@ -2710,7 +2701,6 @@ class FakeApi $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'); @@ -3001,7 +2991,6 @@ class FakeApi $httpBody = ''; $multipart = false; - // query params if (is_array($required_string_group)) { $required_string_group = ObjectSerializer::serializeCollection($required_string_group, '', true); @@ -3009,8 +2998,6 @@ class FakeApi if ($required_string_group !== null) { $queryParams['required_string_group'] = $required_string_group; } - - // query params if (is_array($required_int64_group)) { $required_int64_group = ObjectSerializer::serializeCollection($required_int64_group, '', true); @@ -3018,8 +3005,6 @@ class FakeApi if ($required_int64_group !== null) { $queryParams['required_int64_group'] = $required_int64_group; } - - // query params if (is_array($string_group)) { $string_group = ObjectSerializer::serializeCollection($string_group, '', true); @@ -3027,8 +3012,6 @@ class FakeApi if ($string_group !== null) { $queryParams['string_group'] = $string_group; } - - // query params if (is_array($int64_group)) { $int64_group = ObjectSerializer::serializeCollection($int64_group, '', true); @@ -3037,7 +3020,6 @@ class FakeApi $queryParams['int64_group'] = $int64_group; } - // header params if ($required_boolean_group !== null) { $headerParams['required_boolean_group'] = ObjectSerializer::toHeaderValue($required_boolean_group); @@ -3758,16 +3740,13 @@ class FakeApi $httpBody = ''; $multipart = false; - // query params if (is_array($pipe)) { - $pipe = ObjectSerializer::serializeCollection($pipe, 'csv', true); + $pipe = ObjectSerializer::serializeCollection($pipe, 'form', true); } if ($pipe !== null) { $queryParams['pipe'] = $pipe; } - - // query params if (is_array($ioutil)) { $ioutil = ObjectSerializer::serializeCollection($ioutil, 'csv', true); @@ -3775,34 +3754,34 @@ class FakeApi if ($ioutil !== null) { $queryParams['ioutil'] = $ioutil; } - - // query params if (is_array($http)) { - $http = ObjectSerializer::serializeCollection($http, 'space', true); + $http = ObjectSerializer::serializeCollection($http, 'spaceDelimited', true); } if ($http !== null) { $queryParams['http'] = $http; } - - // query params if (is_array($url)) { - $url = ObjectSerializer::serializeCollection($url, 'csv', true); + $url = ObjectSerializer::serializeCollection($url, 'form', true); } if ($url !== null) { $queryParams['url'] = $url; } - - // query params if ($context !== null) { - $queryParams['context'] = $context; + if('form' === 'form' && is_array($context)) { + foreach($context as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['context'] = $context; + } } - // body params $_tempBody = null; 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 2038687c45703fef3e54309e37645d9c56d02708..90c6ef0223192ff0ac4ca4fa3b2416bd39363e8f 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php @@ -775,10 +775,9 @@ class PetApi $httpBody = ''; $multipart = false; - // query params if (is_array($status)) { - $status = ObjectSerializer::serializeCollection($status, 'csv', true); + $status = ObjectSerializer::serializeCollection($status, 'form', true); } if ($status !== null) { $queryParams['status'] = $status; @@ -786,7 +785,6 @@ class PetApi - // body params $_tempBody = null; @@ -1053,10 +1051,9 @@ class PetApi $httpBody = ''; $multipart = false; - // query params if (is_array($tags)) { - $tags = ObjectSerializer::serializeCollection($tags, 'csv', true); + $tags = ObjectSerializer::serializeCollection($tags, 'form', true); } if ($tags !== null) { $queryParams['tags'] = $tags; @@ -1064,7 +1061,6 @@ class PetApi - // body params $_tempBody = null; 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 9345f4b155b5c8e8822c872748662bbe34277d9c..22b217fc4eaa0e3ac241adce45f37207f5c8ae11 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php @@ -1482,7 +1482,6 @@ class UserApi $httpBody = ''; $multipart = false; - // query params if (is_array($username)) { $username = ObjectSerializer::serializeCollection($username, '', true); @@ -1490,8 +1489,6 @@ class UserApi if ($username !== null) { $queryParams['username'] = $username; } - - // query params if (is_array($password)) { $password = ObjectSerializer::serializeCollection($password, '', true); @@ -1502,7 +1499,6 @@ class UserApi - // 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 fa9305cfbb4d17f2c6c03530452057617fa5d58b..6d1a24aa7de8d07c90a7f6f11a83b317922f0f55 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 @@ -1774,15 +1774,20 @@ class FakeApi $httpBody = ''; $multipart = false; - // query params if ($query !== null) { - $queryParams['query'] = $query; + if('form' === 'form' && is_array($query)) { + foreach($query as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['query'] = $query; + } } - // body params $_tempBody = null; if (isset($user)) { @@ -2705,31 +2710,51 @@ class FakeApi $httpBody = ''; $multipart = false; - // query params if ($enum_query_string_array !== null) { - $queryParams['enum_query_string_array'] = $enum_query_string_array; + if('form' === 'form' && is_array($enum_query_string_array)) { + foreach($enum_query_string_array as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['enum_query_string_array'] = $enum_query_string_array; + } } - - // query params if ($enum_query_string !== null) { - $queryParams['enum_query_string'] = $enum_query_string; + if('form' === 'form' && is_array($enum_query_string)) { + foreach($enum_query_string as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['enum_query_string'] = $enum_query_string; + } } - - // query params if ($enum_query_integer !== null) { - $queryParams['enum_query_integer'] = $enum_query_integer; + if('form' === 'form' && is_array($enum_query_integer)) { + foreach($enum_query_integer as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['enum_query_integer'] = $enum_query_integer; + } } - - // query params if ($enum_query_double !== null) { - $queryParams['enum_query_double'] = $enum_query_double; + if('form' === 'form' && is_array($enum_query_double)) { + foreach($enum_query_double as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $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'); @@ -3020,31 +3045,51 @@ class FakeApi $httpBody = ''; $multipart = false; - // query params if ($required_string_group !== null) { - $queryParams['required_string_group'] = $required_string_group; + if('form' === 'form' && is_array($required_string_group)) { + foreach($required_string_group as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['required_string_group'] = $required_string_group; + } } - - // query params if ($required_int64_group !== null) { - $queryParams['required_int64_group'] = $required_int64_group; + if('form' === 'form' && is_array($required_int64_group)) { + foreach($required_int64_group as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['required_int64_group'] = $required_int64_group; + } } - - // query params if ($string_group !== null) { - $queryParams['string_group'] = $string_group; + if('form' === 'form' && is_array($string_group)) { + foreach($string_group as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['string_group'] = $string_group; + } } - - // query params if ($int64_group !== null) { - $queryParams['int64_group'] = $int64_group; + if('form' === 'form' && is_array($int64_group)) { + foreach($int64_group as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['int64_group'] = $int64_group; + } } - // header params if ($required_boolean_group !== null) { $headerParams['required_boolean_group'] = ObjectSerializer::toHeaderValue($required_boolean_group); @@ -3769,48 +3814,52 @@ class FakeApi $httpBody = ''; $multipart = false; - // query params if ($pipe !== null) { - $queryParams['pipe'] = $pipe; + if('form' === 'form' && is_array($pipe)) { + foreach($pipe as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['pipe'] = $pipe; + } } - - // query params if (is_array($ioutil)) { - $ioutil = ObjectSerializer::serializeCollection($ioutil, 'csv', true); + $ioutil = ObjectSerializer::serializeCollection($ioutil, 'form', true); } if ($ioutil !== null) { $queryParams['ioutil'] = $ioutil; } - - // query params if (is_array($http)) { - $http = ObjectSerializer::serializeCollection($http, 'space', true); + $http = ObjectSerializer::serializeCollection($http, 'spaceDelimited', true); } if ($http !== null) { $queryParams['http'] = $http; } - - // query params if (is_array($url)) { - $url = ObjectSerializer::serializeCollection($url, 'csv', true); + $url = ObjectSerializer::serializeCollection($url, 'form', true); } if ($url !== null) { $queryParams['url'] = $url; } - - // query params if ($context !== null) { - $queryParams['context'] = $context; + if('form' === 'form' && is_array($context)) { + foreach($context as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['context'] = $context; + } } - // body params $_tempBody = null; 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 37b798c0417d2b0316c83d13314a29ce366b1d0c..4e1803989caca7f0a19e17fa42acfe7b15fb7ac8 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 @@ -801,10 +801,9 @@ class PetApi $httpBody = ''; $multipart = false; - // query params if (is_array($status)) { - $status = ObjectSerializer::serializeCollection($status, 'csv', true); + $status = ObjectSerializer::serializeCollection($status, 'form', true); } if ($status !== null) { $queryParams['status'] = $status; @@ -812,7 +811,6 @@ class PetApi - // body params $_tempBody = null; @@ -1079,10 +1077,9 @@ class PetApi $httpBody = ''; $multipart = false; - // query params if (is_array($tags)) { - $tags = ObjectSerializer::serializeCollection($tags, 'csv', true); + $tags = ObjectSerializer::serializeCollection($tags, 'form', true); } if ($tags !== null) { $queryParams['tags'] = $tags; @@ -1090,7 +1087,6 @@ class PetApi - // body params $_tempBody = null; 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 4da3fa6fe20be75636bea674868b52433eb54e37..a274723a1fb7462eb7834d055539b5846e0b13cd 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 @@ -1482,21 +1482,31 @@ class UserApi $httpBody = ''; $multipart = false; - // query params if ($username !== null) { - $queryParams['username'] = $username; + if('form' === 'form' && is_array($username)) { + foreach($username as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['username'] = $username; + } } - - // query params if ($password !== null) { - $queryParams['password'] = $password; + if('form' === 'form' && is_array($password)) { + foreach($password as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['password'] = $password; + } } - // body params $_tempBody = null;