When we pass only 1 item as to array param express parses it as plain type (not array). As result we get validation error.
Example:
/**
* GET /testArray
* @param {array<string>} testParam.query.required - test array param
* @returns {boolean} 200 - OK
* @returns {ErrorResponse} 400 - Bad Request
*/
router.get('/testArray', validateRequest()),
async (req, res, next) => {
console.log(Array.from(req.query.testParam));
}
When we pass only 1 item as to array param express parses it as plain type (not array). As result we get validation error.
Example: