swagger-api / swagger-api/swagger-codegen

[Python] Debug issues when using 'params' as name of query parameter

Open
#6,216 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: Python help wanted Issue: Bug
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

It seems that the code generated for parameter handling in Python will end up creating a recursive params dictionary, if you have a query parameter called 'params'. This does not cause problems running the code normally, but will cause max recursion exception when debugging.

The easy work-around is to avoid 'params' as a parameter name.

Swagger-codegen version

Code generated with swagger-codegen-maven-plugin 2.2.2

Swagger declaration file content or url
    "/v1/instrumentParameters/{id}" : {
      "get" : {
        "summary" : "Get instrument params",
        "description" : "...",
        "operationId" : "getInstrumentParameters",
        "produces" : [ "application/json" ],
        "parameters" : [ {
          "name" : "id",
          "in" : "path",
          "description" : "...",
          "required" : true,
          "type" : "string"
        }, {
          "name" : "params",
          "in" : "query",
          "description" : "Parameters to return",
          "required" : false,
          "type" : "array",
          "items" : {
            "type" : "string",
            "enum" : [ "..." ]
          },
          "collectionFormat" : "multi"
        } ],
        "responses" : {
          "200" : {
            "description" : "successful operation",
            "schema" : {
              "type" : "object",
              "additionalProperties" : {
                "type" : "object"
              }
            }
          }
        }
      }
    }
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by generating the Python client from the Swagger declaration in the issue with swagger-codegen-maven-plugin 2.2.2, then inspect the generated parameter-handling code for the query parameter named "params". Confirm that normal execution works but debugging triggers a maximum-recursion exception; done means the generated client no longer creates a recursive params dictionary.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.