Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #2945
Closed
Open
Issue created May 20, 2019 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[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
Steps to reproduce
Related issues/PRs
Suggest a fix
Assignee
Assign to
Time tracking