Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: return parsed params #23

Open
paulish opened this issue Jun 9, 2021 · 0 comments
Open

Feature request: return parsed params #23

paulish opened this issue Jun 9, 2021 · 0 comments

Comments

@paulish
Copy link

paulish commented Jun 9, 2021

It would be nice to get parsed parameters after the validation process.

Imagine you have a request:

/**
 * GET /visit/list
 * @summary get list of visits
 * @param {string} some-header-param.header - some header string value
 * @param {boolean} booleanParam.query - some boolean value
 * @param {integer} intParam.query -  some integer value
 */
router.get('/list', validateRequest(), async (req, res) => {
  const someHeaderParam = req.headers[''];
  const {booleanParam, intParam} = req.query;

  // the problem:
  // we need to gather params from header, query, body and path and to convert there values to previously described types
  // here booleanParam and intParam are string and we need to explicitly convert them before use
});

The suggest is to either set some req property to parsed list of params or to introduce another method to simplify request object parsing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant