An express.js middleware for validator.js.
MIT License
Bot releases are hidden (Show)
@types/express
dependency removed; if you're using express, you must install this yourself now
checkSchema()
function.customSanitizer()
chain function.withMessage()
validationResult.withDefaults()
which can create a validationResult
function with default options setcheck
/sanitize
functions with buildCheckFunction
or buildSanitizeFunction
, respectively.formatWith()
examplematchedData()
oneOf()
and matchedData()
work togetherwithMessage()
arg type to any
req.asyncValidationErrors()
return value description.throw()
without try..catch
validationResult
work even though no validators ran.withMessage()
is called without any validatorundefined
, null
, NaN
, []
=> ''
)...but with backwards compatibility, because we're cool to our users 😉
Most notable features are the introduction of check
and filter
APIs.
They are additions to express-validator, previous ways to validate your requests are still here, but under the name "legacy APIs".
Check the README for complete docs and the upgrade guide for version 3 users.
check
API.not()
*
oneOf
function to emulate OR validationsfilter
API.exists()
validatorvalidator
v8.1.0req.validationErrors()
and req.asyncValidationErrors()
null
/undefined
~6.1.0
req.checkCookies()
and req.sanitizeCookies()
req.checkQuery()
, req.checkParams()
and req.checkBody()
req.getValidationResult()
req.validationErrors()
and req.asyncValidationErrors()