is-my-json-valid
Advanced tools
Comparing version 2.19.0 to 2.20.0
{ | ||
"name": "is-my-json-valid", | ||
"version": "2.19.0", | ||
"description": "A JSONSchema validator that uses code generation to be extremely fast", | ||
"main": "index.js", | ||
"version": "2.20.0", | ||
"license": "MIT", | ||
"repository": "mafintosh/is-my-json-valid", | ||
"files": [ | ||
"formats.js", | ||
"index.d.ts", | ||
"index.js", | ||
"require.js" | ||
], | ||
"scripts": { | ||
"test": "tape test/*.js && tsc" | ||
}, | ||
"dependencies": { | ||
@@ -18,9 +27,2 @@ "generate-function": "^2.0.0", | ||
}, | ||
"scripts": { | ||
"test": "tape test/*.js && tsc" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/mafintosh/is-my-json-valid" | ||
}, | ||
"keywords": [ | ||
@@ -31,9 +33,3 @@ "json", | ||
"jsonschema" | ||
], | ||
"author": "Mathias Buus", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/mafintosh/is-my-json-valid/issues" | ||
}, | ||
"homepage": "https://github.com/mafintosh/is-my-json-valid" | ||
] | ||
} |
# is-my-json-valid | ||
A [JSONSchema](http://json-schema.org/) validator that uses code generation | ||
to be extremely fast | ||
A [JSONSchema](https://json-schema.org/) validator that uses code generation to be extremely fast. | ||
``` | ||
npm install is-my-json-valid | ||
``` | ||
It passes the entire JSONSchema v4 test suite except for `remoteRefs` and `maxLength`/`minLength` when using unicode surrogate pairs. | ||
[![build status](http://img.shields.io/travis/mafintosh/is-my-json-valid.svg?style=flat)](http://travis-ci.org/mafintosh/is-my-json-valid) | ||
[![build status](https://img.shields.io/travis/mafintosh/is-my-json-valid.svg?style=flat)](https://travis-ci.org/mafintosh/is-my-json-valid) | ||
## Installation | ||
```sh | ||
npm install --save is-my-json-valid | ||
``` | ||
## Usage | ||
@@ -18,3 +19,3 @@ | ||
``` js | ||
```js | ||
var validator = require('is-my-json-valid') | ||
@@ -43,3 +44,3 @@ | ||
``` js | ||
```js | ||
var validate = validator('{"type": ... }') | ||
@@ -50,3 +51,3 @@ ``` | ||
``` js | ||
```js | ||
var validator = require('is-my-json-valid/require') | ||
@@ -61,3 +62,3 @@ var validate = validator('my-schema.json') | ||
``` js | ||
```js | ||
var validate = validator({ | ||
@@ -81,3 +82,3 @@ type: 'string', | ||
``` js | ||
```js | ||
var ext = { | ||
@@ -103,3 +104,3 @@ required: true, | ||
``` js | ||
```js | ||
var filter = validator.filter({ | ||
@@ -125,3 +126,3 @@ required: true, | ||
``` js | ||
```js | ||
var schema = { | ||
@@ -151,3 +152,4 @@ required: true, | ||
Many popular libraries make it easy to retrieve the failing rule with the `schemaPath`: | ||
``` | ||
```js | ||
var schemaPath = validate.errors[0].schemaPath | ||
@@ -171,3 +173,3 @@ var R = require('ramda') | ||
``` js | ||
```js | ||
var validate = validator({ | ||
@@ -194,24 +196,24 @@ type: 'object', | ||
* `is required` | ||
* `is the wrong type` | ||
* `has additional items` | ||
* `must be FORMAT format` (FORMAT is the `format` property from the schema) | ||
* `must be unique` | ||
* `must be an enum value` | ||
* `dependencies not set` | ||
* `has additional properties` | ||
* `referenced schema does not match` | ||
* `negative schema matches` | ||
* `pattern mismatch` | ||
* `no schemas match` | ||
* `no (or more than one) schemas match` | ||
* `has a remainder` | ||
* `has more properties than allowed` | ||
* `has less properties than allowed` | ||
* `has more items than allowed` | ||
* `has less items than allowed` | ||
* `has longer length than allowed` | ||
* `has less length than allowed` | ||
* `is less than minimum` | ||
* `is more than maximum` | ||
- `is required` | ||
- `is the wrong type` | ||
- `has additional items` | ||
- `must be FORMAT format` (FORMAT is the `format` property from the schema) | ||
- `must be unique` | ||
- `must be an enum value` | ||
- `dependencies not set` | ||
- `has additional properties` | ||
- `referenced schema does not match` | ||
- `negative schema matches` | ||
- `pattern mismatch` | ||
- `no schemas match` | ||
- `no (or more than one) schemas match` | ||
- `has a remainder` | ||
- `has more properties than allowed` | ||
- `has less properties than allowed` | ||
- `has more items than allowed` | ||
- `has less items than allowed` | ||
- `has longer length than allowed` | ||
- `has less length than allowed` | ||
- `is less than minimum` | ||
- `is more than maximum` | ||
@@ -222,9 +224,9 @@ ## Performance | ||
At the time of writing, is-my-json-valid is the __fastest validator__ when running | ||
At the time of writing, is-my-json-valid is the **fastest validator** when running | ||
* [json-schema-benchmark](https://github.com/Muscula/json-schema-benchmark) | ||
* [cosmicreals.com benchmark](http://cosmicrealms.com/blog/2014/08/29/benchmark-of-node-dot-js-json-validation-modules-part-3/) | ||
* [jsck benchmark](https://github.com/pandastrike/jsck/issues/72#issuecomment-70992684) | ||
* [themis benchmark](https://cdn.rawgit.com/playlyfe/themis/master/benchmark/results.html) | ||
* [z-schema benchmark](https://rawgit.com/zaggino/z-schema/master/benchmark/results.html) | ||
- [json-schema-benchmark](https://github.com/Muscula/json-schema-benchmark) | ||
- [cosmicreals.com benchmark](http://cosmicrealms.com/blog/2014/08/29/benchmark-of-node-dot-js-json-validation-modules-part-3/) | ||
- [jsck benchmark](https://github.com/pandastrike/jsck/issues/72#issuecomment-70992684) | ||
- [themis benchmark](https://cdn.rawgit.com/playlyfe/themis/master/benchmark/results.html) | ||
- [z-schema benchmark](https://rawgit.com/zaggino/z-schema/master/benchmark/results.html) | ||
@@ -231,0 +233,0 @@ If you know any other relevant benchmarks open a PR and I'll add them. |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
264
2
39456
7
658
1
1