swagger-api / swagger-api/swagger-codegen
PHP boolean parameter in query string incorrectly converted to string
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
The boolean query string parameters are incorrectly converted to string.
If the value is true it's converted to "1", and if it's false it's converted to "".
The PHP generated code is calling https://github.com/guzzle/psr7/blob/ff1b0eae41c6bc0b03ef657f29d8a9eea7ee75eb/src/Query.php#L71
But this code has a bug, it's incorrectly converting boolean values to string.
See https://github.com/guzzle/psr7/issues/264
Suggest a fix/enhancement
swagger-codegen should probably encode the query string by itself.
Currently the generated code is broken.
And Guzzle/psr7 doesn't seem to want to fix this bug soon.
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 by examining the generated PHP query-parameter handling and the referenced guzzle/psr7 src/Query.php at line 71. Reproduce the true and false cases, then define completion as boolean query values being encoded correctly without relying on the reported conversion behavior; the issue names no repository file or test to run.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100