A route with more then one variable in path, parameters in indeterminate order in output
- Dominant language
- Python
- Stars
- 652
- Forks
- 151
- PR merge metrics
- No merged PRs in 30d
Description
With a route like
@app.route('/foos//bars/')
the output contains a path `/foos/{foo_id}/bars/{bar_id}`, but then
in `"get": { "parameters": [ ... ] }` the order of `foo_id` and `bar_id` is indeterminate between code reloads.
Function `rule_to_params` in `paths.py` accesses `rule.arguments` that is an instance of a set, and the order of arguments may therefore change. Maybe that is the reason?
swagger-codegen-cli produces client and server code that depend on the ordering of parameters.
Also, there doesn't seem to be a test case that has more then one variable in the path.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in paths.py at rule_to_params, where the issue identifies rule.arguments as a set, and review the existing path-parameter generation. Add coverage for a route with both foo_id and bar_id, then run the relevant test suite to verify the generated parameter order remains deterministic across reloads.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- flask, python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100