swagger-api / swagger-api/swagger-codegen
[Python] Query parameter sent as "None" when it is passed as None
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
When the query parameter is optional, if the parameter is passed as None it is sent as the string None
Swagger-codegen version
2.4.8
Swagger declaration file content or url
/pets:
get:
summary: List all pets
operationId: listPets
tags:
- pets
parameters:
- name: limit
in: query
description: How many items to return at one time (max 100)
required: false
schema:
type: integer
format: int32
Command line used for generation
swagger-codegen generate -i http://petstore.swagger.io/v2/swagger.json -l python -o /tmp/test/
Steps to reproduce
Pass limit as None in get pets API. The limit is passed as host.com/pets?limit=None
Related issues/PRs
Did not find any
Suggest a fix/enhancement
When an optional query param is None, do not pass the value as 'None' rather don't pass the variable
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the generated Python client's handling of optional query parameters and reproduce the /pets request with limit=None. Trace how that value is serialized; done means an unset optional parameter is omitted rather than sent as limit=None. The issue names no source file or test to begin with.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100