[BUG][PHP] x-group-parameters with bad/weird behavior
Created by: ypereirareis
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? -
What's the version of OpenAPI Generator used? -
Have you search for related issues/PRs? -
What's the actual output vs expected output? -
[Optional] Bounty to sponsor the fix (example)
Description
A generated method is called with a list of parameters instead of a single parameter bag.
public function getBookCollectionWithHttpInfo($associative_array)
{
$request = $this->getBookCollectionRequest($associative_array['page'], $associative_array['items_per_page'], $associative_array['pagination']);
...
}
protected function getBookCollectionRequest($associative_array)
{
// unbox the parameters from the associative array
$page = array_key_exists('page', $associative_array) ? $associative_array['page'] : null;
$items_per_page = array_key_exists('items_per_page', $associative_array) ? $associative_array['items_per_page'] : null;
$pagination = array_key_exists('pagination', $associative_array) ? $associative_array['pagination'] : null;
...
}
EXPECTED
public function getBookCollectionWithHttpInfo($associative_array)
{
$request = $this->getBookCollectionRequest($associative_array);
...
}
openapi-generator version
4.0.1-SNAPSHOT
OpenAPI declaration file content or url
{
"basePath": "/",
"info": {
"description": "Test API v3",
"title": "TestAPI",
"version": "1.0.7"
},
"paths": {
"/api/book": {
"get": {
"operationId": "getBookCollection",
"parameters": [
{
"description": "The collection page number",
"in": "query",
"name": "page",
"required": false,
"type": "integer"
},
{
"description": "The number of items per page",
"in": "query",
"name": "itemsPerPage",
"required": false,
"type": "integer"
},
{
"description": "Enable or disable pagination",
"in": "query",
"name": "pagination",
"required": false,
"type": "boolean"
}
],
"produces": [
"application/ld+json",
"application/json",
"text/html"
],
"responses": {
"200": {
"description": "bookcollection response",
"schema": {
"type": "string"
}
}
},
"summary": "",
"tags": [
"book"
],
"x-group-parameters": true
}
}
},
"security": [
{
"apiKey": []
}
],
"securityDefinitions": {
"apiKey": {
"description": "Value for the X-AUTHENTICATION-TOKEN header",
"in": "header",
"name": "X-AUTHENTICATION-TOKEN",
"type": "apiKey"
}
},
"swagger": "2.0"
}
-->
Command line used for generation
docker run --rm --user $(id -u):$(id -g) -v ${PWD}:/local \
openapitools/openapi-generator-cli generate \
--git-user-id "USER" \
--git-repo-id "test-client-lib" \
--release-note "Test Service Client Library" \
-g php \
-o /local/${SWAGGER_CLIENT_PATH} \
-i /local/${SWAGGER_SERVICE}/config/packages/api_platform/swagger/api.json \
-c /local/${SWAGGER_SERVICE}/config/packages/api_platform/swagger/generator.json