Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

express.js - best POST json schema validator [closed]

I'm searching for a module to validate POST json requests in my Express.js application.

What json schema module do you use in your node.js apps?

I assume node-validator (https://github.com/chriso/node-validator) is not an option here because it works only with strings.

like image 893
Kosmetika Avatar asked Oct 01 '13 13:10

Kosmetika


1 Answers

I recently wrote express-jsonschema. The main differences with the other validators out there are:

  1. You use the standard json schemas for validation. If you have written other server side languages you probably have used them before.
  2. It doesn't control how your application responds to invalid data. It does give you an opportunity to hook in and respond however you want. In my experience this is something that is nice to control.

express-schema-validator, express-validate, and Paperwork are all great. They each have their own unique syntax for declaring schemas and also control how your app responds to invalid data (i.e. status code and data structure).

like image 100
Adrian Adkison Avatar answered Oct 19 '22 11:10

Adrian Adkison