Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

celebrate

Package Overview
Dependencies
Maintainers
2
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

celebrate - npm Package Compare versions

Comparing version 4.0.1 to 4.0.2

lib/index.d.ts

7

package.json
{
"name": "celebrate",
"version": "4.0.1",
"version": "4.0.2",
"description": "A joi validation middleware for Express.",

@@ -34,6 +34,7 @@ "main": "lib/index.js",

"devDependencies": {
"belly-button": "3.x.x",
"@types/express": "4.x.x",
"belly-button": "4.x.x",
"code": "4.x.x",
"joi": "10.x.x",
"lab": "11.x.x"
"lab": "14.x.x"
},

@@ -40,0 +41,0 @@ "engines": {

@@ -14,3 +14,3 @@ ![Celebrate](https://github.com/continuationlabs/celebrate/raw/master/images/logo.png)

Wondering why *another* joi middleware library for Express? Full blog post [here](https://blog.continuation.io/time-to-clelebrate/).
Wondering why *another* joi middleware library for Express? Full blog post [here](https://blog.continuation.io/time-to-celebrate/).

@@ -45,3 +45,3 @@ ## Usage

Example of using `celebrate` to validate all incoming requests to ensure the `token` header is present and mathes the supplied regular expression.
Example of using `celebrate` to validate all incoming requests to ensure the `token` header is present and matches the supplied regular expression.
```js

@@ -53,3 +53,3 @@ const express = require('express');

// valide all incoming request headers for the token header
// validate all incoming request headers for the token header
// if missing or not the correct format, respond with an error

@@ -63,3 +63,3 @@ app.use(Celebrate({

app.get('/foo', (req, res) => { res.send('a foo request'); });
app.use(Celebrate.errors()));
app.use(Celebrate.errors());
```

@@ -73,3 +73,3 @@

- `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 incomming `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.
- `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.
- `[options]` - `joi` [options](https://github.com/hapijs/joi/blob/master/API.md#validatevalue-schema-options-callback) that are passed directly into the `validate` function.

@@ -79,3 +79,3 @@

Returns a `function` with the error handler signature (`(err, req, res, next)`). This should be placed with any other error handling middleware to catch Joi validation errors. If the incomming `err` object is a Joi error, `errors()` will respond with a 400 status code and the Joi validation message. Otherwise, it will call `next(err)` and will pass the error along and need to be processed by another error handler.
Returns a `function` with the error handler signature (`(err, req, res, next)`). This should be placed with any other error handling middleware to catch Joi validation errors. If the incoming `err` object is a Joi error, `errors()` will respond with a 400 status code and the Joi validation message. Otherwise, it will call `next(err)` and will pass the error along and need to be processed by another error handler.

@@ -97,2 +97,2 @@ If the error format does not suite your needs, you an encouraged to write your own error handler and check `err.isJoi` to format joi errors to your liking. The full joi error object will be available in your own error handler.

*Before* opening issues on this repo, make sure your joi schema is correct and working as you intended. The bulk of this code is just exposing the joi API as Express middleware. All of the heavy lifting still happens inside joi.
*Before* opening issues on this repo, make sure your joi schema is correct and working as you intended. The bulk of this code is just exposing the joi API as Express middleware. All of the heavy lifting still happens inside joi. You can go [here](https://npm.runkit.com/joi) to verify your joi schema easily.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc