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
  • #12887
Closed
Open
Issue created Jul 15, 2022 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG][Javascript] Object as query parameter not correctly handled

Created by: desantisgel

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?

  • Have you validated the input using an OpenAPI validator (example)?

  • Have you tested with the latest master to confirm the issue still exists?

  • Have you searched for related issues/PRs?

  • What's the actual output vs expected output?

  • [Optional] Sponsorship to speed up the bug fix or feature request (example)

Description

Having an object as query parameter the generated axios-typescript produces a request like this

https://localhost:44301/api/error?request=%20........

which isn't correctly.

Instead, the Swagger UI produces this request (correct): https://localhost:44301/api/error?param=XY&value=XY

openapi-generator version

Tested with 6.0.0

OpenAPI declaration file content or url
{
  "openapi": "3.0.1",
  "info": {
    "title": "Bug Example",
    "description": "Bug Example",
    "version": "API v1"
  },
  "paths": {
    "/api/error": {
      "get": {
        "operationId": "getApiError",
        "parameters": [
          {
            "name": "request",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Request"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/Results"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Request": {
        "required": [
          "param",
          "value"
        ],
        "type": "object",
        "properties": {
          "param": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        }
      },
      "Results": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        }
      }
    }
  }
}
Generation Details

openapi-generator-cli generate -i ./src/lib/api/openapi/test.json -o ./src/lib/api/generated/test -g typescript-axios --skip-validate-spec

Related issues/PRs

#https://github.com/OpenAPITools/openapi-generator/issues/11491

Assignee
Assign to
Time tracking