Comparing version 4.0.3 to 5.0.0
@@ -18,7 +18,11 @@ import { ErrorRequestHandler, RequestHandler } from 'express'; | ||
/** | ||
* Creates a Celebrate error handler middleware function | ||
* Creates a Celebrate error handler middleware function. | ||
*/ | ||
function errors(): ErrorRequestHandler; | ||
/** | ||
* The Joi version Celebrate uses internally. | ||
*/ | ||
export const Joi: object; | ||
} | ||
export = Celebrate; |
@@ -78,3 +78,7 @@ 'use strict'; | ||
for (var i = 0; i < err.details.length; i++) { | ||
error.validation.keys.push(EscapeHtml(err.details[i].path)); | ||
// Disabling because the only way to get this is to fake the Joi response which I don't feel like doing | ||
/* $lab:coverage:off$ */ | ||
const path = Array.isArray(err.details[i].path) ? err.details[i].path.join('.') : err.details[i].path; | ||
/* $lab:coverage:on$ */ | ||
error.validation.keys.push(EscapeHtml(path)); | ||
} | ||
@@ -90,2 +94,4 @@ } | ||
Celebrate.Joi = Joi; | ||
module.exports = Celebrate; |
{ | ||
"name": "celebrate", | ||
"version": "4.0.3", | ||
"version": "5.0.0", | ||
"description": "A joi validation middleware for Express.", | ||
@@ -28,7 +28,5 @@ "main": "lib/index.js", | ||
"escape-html": "1.0.3", | ||
"fastseries": "1.7.2" | ||
"fastseries": "1.7.2", | ||
"joi": "11.x.x" | ||
}, | ||
"peerDependencies": { | ||
"joi": "10.x.x" | ||
}, | ||
"devDependencies": { | ||
@@ -38,3 +36,2 @@ "@types/express": "4.x.x", | ||
"code": "4.x.x", | ||
"joi": "10.x.x", | ||
"lab": "14.x.x" | ||
@@ -41,0 +38,0 @@ }, |
@@ -22,4 +22,4 @@ ![Celebrate](https://github.com/continuationlabs/celebrate/raw/master/images/logo.png) | ||
const BodyParser = require('body-parser'); | ||
const Joi = require('joi'); | ||
const Celebrate = require('celebrate'); | ||
const { Joi } = Celebrate; | ||
@@ -48,4 +48,4 @@ const app = express(); | ||
const express = require('express'); | ||
const Joi = require('joi'); | ||
const Celebrate = require('celebrate'); | ||
const { Joi } = Celebrate; | ||
const app = express(); | ||
@@ -69,3 +69,3 @@ | ||
Returns a `function` with the middleware signature (`(req, res, next)`). | ||
The single exported function from `celebrate`. Returns a `function` with the middleware signature (`(req, res, next)`). | ||
@@ -81,2 +81,6 @@ - `schema` - a object where `key` can be one of `'params', 'headers', 'query', and 'body'` and the `value` is a [joi](https://github.com/hapijs/joi/blob/master/API.md) validation schema. Only the `key`s specified will be validated against the incoming `req` object. If you omit a key, that part of the `req` object will not be validated. A schema must contain at least one of the valid keys. | ||
### `Celebrate.Joi` | ||
`celebrate` exports the version of joi it is using internally. For maximum compatibility, you should use this version when passing in any validation schemas. | ||
## Order | ||
@@ -83,0 +87,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9589
4
112
96
+ Addedjoi@11.x.x
+ Addedisemail@3.2.0(transitive)
+ Addedjoi@11.4.0(transitive)
+ Addedpunycode@2.3.1(transitive)
- Removedisemail@2.2.1(transitive)
- Removeditems@2.2.1(transitive)
- Removedjoi@10.6.0(transitive)