restify / restify/node-restify
queryParser options mapParams documentation is inconsistent and unintuitive
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.7k
- Forks
- 975
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 5
Description
- [ x ] Used appropriate template for the issue type
- [ x ] Searched both open and closed issues for duplicates of this issue
- [ x ] Title adequately and concisely reflects the feature or the bug
Restify Version:
8.5.1
Node.js Version:
v14 LTS
The documentation for the mapParams option for queryParser states in two separate lines that the default value for mapParams is both true and false, and one value is an object and the other a boolean: http://restify.com/docs/plugins-api/#queryParser
options.mapParams Object disable passing (optional, default true)
options.mapParams Boolean Copies parsed query parameters into req.params. (optional, default false).
In the source code, the in-code comments say that setting mapParams to true disables mapping the params.
@param {Object} [options.mapParams=true] - disable passing
@param {Boolean} [options.mapParams=false] - Copies parsed query parameters intoreq.params`.
https://github.com/restify/node-restify/blob/71c7f4965342c13cac55847f87149cc34c1ad566/lib/plugins/query.js#L20
However, in source, you can clearly see that the only valid value to execute parameter passing for mapParams is boolean true
https://github.com/restify/node-restify/blob/71c7f4965342c13cac55847f87149cc34c1ad566/lib/plugins/query.js#L58
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 queryParser documentation at the linked plugins API page and lib/plugins/query.js around the referenced lines. Compare the mapParams type, default, and behavior descriptions with the implementation. Done means the published documentation and source comments no longer contradict each other.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- backend, documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100