🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@ssense/restify-request-validator

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ssense/restify-request-validator - npm Package Compare versions

Comparing version

to
1.0.7

1

index.d.ts

@@ -5,2 +5,3 @@ export class RequestValidator {

public validate(req: any, res: any, next: Function): void;
public disableFailOnFirstError(): void;
}

2

package.json
{
"name": "@ssense/restify-request-validator",
"version": "1.0.6",
"version": "1.0.7",
"description": "Restify requests validator",

@@ -5,0 +5,0 @@ "main": "js/index.js",

@@ -118,2 +118,36 @@ # Restify request validator

#### Behavior
By default the validator will throw an error on the first validation failure, if you want to change this behavior to get all the validation errors, you can call the `disableFailOnFirstError` method on your `validator` object:
##### For javascript project
```js
// Require module
var restifyValidation = require('@ssense/restify-request-validator');
...
// Create restify server
var server = restify.createServer();
...
// Add middleware
var validator = new restifyValidation.RequestValidator();
validator.disableFailOnFirstError();
server.use(validator.validate.bind(validator));
```
##### For typescript project
```js
// Import module
import {RequestValidator} from '@ssense/restify-request-validator';
...
// Create restify server
const server = restify.createServer();
...
// Add middleware
const validator = new RequestValidator();
validator.disableFailOnFirstError();
server.use(validator.validate.bind(validator));
```
## Development

@@ -146,2 +180,3 @@

* **Rémy Jeancolas** - *Initial work* - [RemyJeancolas](https://github.com/RemyJeancolas)
* **Mickael Burguet** - *Add `disableFailOnFirstError` behavior* - [rundef](https://github.com/rundef)

@@ -148,0 +183,0 @@ ## License

@@ -20,3 +20,3 @@ import {ParamValidation} from './ParamValidation';

public disableFailOnFirstError(): any {
public disableFailOnFirstError(): void {
this.failOnFirstError = false;

@@ -23,0 +23,0 @@ }