is-my-json-valid / 2.13.1 last updated 6 days ago created on Jul 31st 2014
Install
npm install --save is-my-json-valid
Clone
git clone git@github.com:mafintosh/is-my-json-valid.git
dependencies
| main |
|
generate-function | 2.0.0 | MIT |
|
|
generate-object-property | 1.2.0 | MIT | |
|
|
jsonpointer | 2.0.0 | MIT | |
|
|
xtend | 4.0.1 | MIT |
versions
47 total
| 2.13.1 | 5 months ago | mafintosh |
| 2.13.0 | 5 months ago | mafintosh |
| 2.12.4 | 6 months ago | mafintosh |
| 2.12.3 | 9 months ago | mafintosh |
| 2.12.2 | a year ago | mafintosh |
| 2.12.1 | a year ago | mafintosh |
| 2.12.0 | a year ago | mafintosh |
| 2.11.0 | a year ago | mafintosh |
| 2.10.1 | a year ago | mafintosh |
| 2.10.0 | a year ago | mafintosh |
| 2.9.4 | a year ago | mafintosh |
| 2.9.3 | a year ago | mafintosh |
| 2.9.2 | a year ago | mafintosh |
| 2.9.1 | a year ago | mafintosh |
| 2.9.0 | a year ago | mafintosh |
| 2.8.0 | a year ago | mafintosh |
| 2.7.0 | a year ago | mafintosh |
| 2.6.0 | a year ago | mafintosh |
| 2.5.0 | a year ago | mafintosh |
| 2.4.1 | a year ago | mafintosh |
| 2.4.0 | a year ago | mafintosh |
| 2.3.1 | a year ago | watson |
| 2.3.0 | 2 years ago | mafintosh |
| 2.2.1 | 2 years ago | mafintosh |
| 2.2.0 | 2 years ago | mafintosh |
| 2.1.0 | 2 years ago | mafintosh |
| 2.0.3 | 2 years ago | mafintosh |
| 2.0.2 | 2 years ago | mafintosh |
| 2.0.1 | 2 years ago | mafintosh |
| 2.0.0 | 2 years ago | mafintosh |
| 1.4.1 | 2 years ago | mafintosh |
| 1.4.0 | 2 years ago | watson |
| 1.3.9 | 2 years ago | mafintosh |
| 1.3.8 | 2 years ago | mafintosh |
| 1.3.7 | 2 years ago | mafintosh |
| 1.3.6 | 2 years ago | mafintosh |
| 1.3.5 | 2 years ago | mafintosh |
| 1.3.4 | 2 years ago | mafintosh |
| 1.3.3 | 2 years ago | mafintosh |
| 1.3.2 | 2 years ago | mafintosh |
| 1.3.1 | 2 years ago | mafintosh |
| 1.3.0 | 2 years ago | mafintosh |
| 1.2.0 | 2 years ago | mafintosh |
| 1.1.0 | 2 years ago | mafintosh |
| 1.0.1 | 2 years ago | mafintosh |
| 1.0.0 | 2 years ago | mafintosh |
| 0.0.0 | 2 years ago | mafintosh |
readme
is-my-json-valid
A JSONSchema validator that uses code generation to be extremely fast
It passes the entire JSONSchema v4 test suite except for remoteRefs and maxLength/minLength when using unicode surrogate pairs.
Usage
Simply pass a schema to compile it
You can also pass the schema as a string
Optionally you can use the require submodule to load a schema from __dirname
Custom formats
is-my-json-valid supports the formats specified in JSON schema v4 (such as date-time). If you want to add your own custom formats pass them as the formats options to the validator
External schemas
You can pass in external schemas that you reference using the $ref attribute as the schemas option
Filtering away additional properties
is-my-json-valid supports filtering away properties not in the schema
Verbose mode outputs the value on errors
is-my-json-valid outputs the value causing an error when verbose is set to true
Greedy mode tries to validate as much as possible
By default is-my-json-valid bails on first validation error but when greedy is set to true it tries to validate as much as possible:
Performance
is-my-json-valid uses code generation to turn your JSON schema into basic javascript code that is easily optimizeable by v8.
At the time of writing, is-my-json-valid is the fastest validator when running
If you know any other relevant benchmarks open a PR and I'll add them.
License
MIT