express-validate-schema
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -35,2 +35,6 @@ /* | ||
custom (key, schema) { | ||
return procRequest.bind(this, key, schema) | ||
} | ||
response (schema) { | ||
@@ -37,0 +41,0 @@ return procResponse.bind(this, schema) |
{ | ||
"name": "express-validate-schema", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "a simple express middleware to validate the request/response objects (body, params, querystring and headers) againts an object schema with joi", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -44,2 +44,6 @@ # express-validate-schema | ||
**validating a custom key in the req object** | ||
`validateSchema([options]).custom('key', some joi schema)` | ||
**validating response** | ||
@@ -90,2 +94,13 @@ | ||
// validating the foobar custom req key | ||
router.get( | ||
'/custom/:foobar?', | ||
(req, res, next) => { | ||
req.foobar = req.params.foobar | ||
next() | ||
}, | ||
validateSchema({ processHttpCallOnError: true }).custom('foobar', customSchema), | ||
(req, res) => { res.send('custom') } | ||
) | ||
// validating params, body and header | ||
@@ -92,0 +107,0 @@ router.put( |
8060
76
121