Skip to content

Commit b6d9b3f

Browse files
committedFeb 13, 2019
Cleanup package metadata
1 parent dcea5be commit b6d9b3f

File tree

2 files changed

+58
-60
lines changed

2 files changed

+58
-60
lines changed
 

‎README.md

+46-44
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
# is-my-json-valid
22

3-
A [JSONSchema](http://json-schema.org/) validator that uses code generation
4-
to be extremely fast
5-
6-
```
7-
npm install is-my-json-valid
8-
```
3+
A [JSONSchema](https://json-schema.org/) validator that uses code generation to be extremely fast.
94

105
It passes the entire JSONSchema v4 test suite except for `remoteRefs` and `maxLength`/`minLength` when using unicode surrogate pairs.
116

12-
[![build status](http://img.shields.io/travis/mafintosh/is-my-json-valid.svg?style=flat)](http://travis-ci.org/mafintosh/is-my-json-valid)
7+
[![build status](https://img.shields.io/travis/mafintosh/is-my-json-valid.svg?style=flat)](https://travis-ci.org/mafintosh/is-my-json-valid)
8+
9+
## Installation
10+
11+
```sh
12+
npm install --save is-my-json-valid
13+
```
1314

1415
## Usage
1516

1617
Simply pass a schema to compile it
1718

18-
``` js
19+
```js
1920
var validator = require('is-my-json-valid')
2021

2122
var validate = validator({
@@ -39,13 +40,13 @@ console.log(validate.errors)
3940

4041
You can also pass the schema as a string
4142

42-
``` js
43+
```js
4344
var validate = validator('{"type": ... }')
4445
```
4546

4647
Optionally you can use the require submodule to load a schema from `__dirname`
4748

48-
``` js
49+
```js
4950
var validator = require('is-my-json-valid/require')
5051
var validate = validator('my-schema.json')
5152
```
@@ -55,7 +56,7 @@ var validate = validator('my-schema.json')
5556
is-my-json-valid supports the formats specified in JSON schema v4 (such as date-time).
5657
If you want to add your own custom formats pass them as the formats options to the validator
5758

58-
``` js
59+
```js
5960
var validate = validator({
6061
type: 'string',
6162
required: true,
@@ -74,7 +75,7 @@ console.log(validate('ab')) // false
7475

7576
You can pass in external schemas that you reference using the `$ref` attribute as the `schemas` option
7677

77-
``` js
78+
```js
7879
var ext = {
7980
required: true,
8081
type: 'string'
@@ -95,7 +96,7 @@ validate(42) // return false
9596

9697
is-my-json-valid supports filtering away properties not in the schema
9798

98-
``` js
99+
```js
99100
var filter = validator.filter({
100101
required: true,
101102
type: 'object',
@@ -116,7 +117,7 @@ When the `verbose` options is set to `true`, `is-my-json-valid` also outputs:
116117
- `value`: The data value that caused the error
117118
- `schemaPath`: an array of keys indicating which sub-schema failed
118119

119-
``` js
120+
```js
120121
var schema = {
121122
required: true,
122123
type: 'object',
@@ -141,7 +142,8 @@ console.log(validate.errors)
141142
```
142143

143144
Many popular libraries make it easy to retrieve the failing rule with the `schemaPath`:
144-
```
145+
146+
```js
145147
var schemaPath = validate.errors[0].schemaPath
146148
var R = require('ramda')
147149

@@ -160,7 +162,7 @@ console.log( 'All evaluate to the same thing: ', R.equals(
160162
By default is-my-json-valid bails on first validation error but when greedy is
161163
set to true it tries to validate as much as possible:
162164

163-
``` js
165+
```js
164166
var validate = validator({
165167
type: 'object',
166168
properties: {
@@ -182,40 +184,40 @@ console.log(validate.errors) // [{field: 'data.y', message: 'is required'},
182184

183185
Here is a list of possible `message` values for errors:
184186

185-
* `is required`
186-
* `is the wrong type`
187-
* `has additional items`
188-
* `must be FORMAT format` (FORMAT is the `format` property from the schema)
189-
* `must be unique`
190-
* `must be an enum value`
191-
* `dependencies not set`
192-
* `has additional properties`
193-
* `referenced schema does not match`
194-
* `negative schema matches`
195-
* `pattern mismatch`
196-
* `no schemas match`
197-
* `no (or more than one) schemas match`
198-
* `has a remainder`
199-
* `has more properties than allowed`
200-
* `has less properties than allowed`
201-
* `has more items than allowed`
202-
* `has less items than allowed`
203-
* `has longer length than allowed`
204-
* `has less length than allowed`
205-
* `is less than minimum`
206-
* `is more than maximum`
187+
- `is required`
188+
- `is the wrong type`
189+
- `has additional items`
190+
- `must be FORMAT format` (FORMAT is the `format` property from the schema)
191+
- `must be unique`
192+
- `must be an enum value`
193+
- `dependencies not set`
194+
- `has additional properties`
195+
- `referenced schema does not match`
196+
- `negative schema matches`
197+
- `pattern mismatch`
198+
- `no schemas match`
199+
- `no (or more than one) schemas match`
200+
- `has a remainder`
201+
- `has more properties than allowed`
202+
- `has less properties than allowed`
203+
- `has more items than allowed`
204+
- `has less items than allowed`
205+
- `has longer length than allowed`
206+
- `has less length than allowed`
207+
- `is less than minimum`
208+
- `is more than maximum`
207209

208210
## Performance
209211

210212
is-my-json-valid uses code generation to turn your JSON schema into basic javascript code that is easily optimizeable by v8.
211213

212-
At the time of writing, is-my-json-valid is the __fastest validator__ when running
214+
At the time of writing, is-my-json-valid is the **fastest validator** when running
213215

214-
* [json-schema-benchmark](https://github.com/Muscula/json-schema-benchmark)
215-
* [cosmicreals.com benchmark](http://cosmicrealms.com/blog/2014/08/29/benchmark-of-node-dot-js-json-validation-modules-part-3/)
216-
* [jsck benchmark](https://github.com/pandastrike/jsck/issues/72#issuecomment-70992684)
217-
* [themis benchmark](https://cdn.rawgit.com/playlyfe/themis/master/benchmark/results.html)
218-
* [z-schema benchmark](https://rawgit.com/zaggino/z-schema/master/benchmark/results.html)
216+
- [json-schema-benchmark](https://github.com/Muscula/json-schema-benchmark)
217+
- [cosmicreals.com benchmark](http://cosmicrealms.com/blog/2014/08/29/benchmark-of-node-dot-js-json-validation-modules-part-3/)
218+
- [jsck benchmark](https://github.com/pandastrike/jsck/issues/72#issuecomment-70992684)
219+
- [themis benchmark](https://cdn.rawgit.com/playlyfe/themis/master/benchmark/results.html)
220+
- [z-schema benchmark](https://rawgit.com/zaggino/z-schema/master/benchmark/results.html)
219221

220222
If you know any other relevant benchmarks open a PR and I'll add them.
221223

‎package.json

+12-16
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
{
22
"name": "is-my-json-valid",
33
"version": "2.19.0",
4-
"description": "A JSONSchema validator that uses code generation to be extremely fast",
5-
"main": "index.js",
4+
"license": "MIT",
5+
"repository": "mafintosh/is-my-json-valid",
6+
"files": [
7+
"formats.js",
8+
"index.d.ts",
9+
"index.js",
10+
"require.js"
11+
],
12+
"scripts": {
13+
"test": "tape test/*.js && tsc"
14+
},
615
"dependencies": {
716
"generate-function": "^2.0.0",
817
"generate-object-property": "^1.1.0",
@@ -15,23 +24,10 @@
1524
"tape": "^2.13.4",
1625
"typescript": "^3.0.1"
1726
},
18-
"scripts": {
19-
"test": "tape test/*.js && tsc"
20-
},
21-
"repository": {
22-
"type": "git",
23-
"url": "https://github.com/mafintosh/is-my-json-valid"
24-
},
2527
"keywords": [
2628
"json",
2729
"schema",
2830
"orderly",
2931
"jsonschema"
30-
],
31-
"author": "Mathias Buus",
32-
"license": "MIT",
33-
"bugs": {
34-
"url": "https://github.com/mafintosh/is-my-json-valid/issues"
35-
},
36-
"homepage": "https://github.com/mafintosh/is-my-json-valid"
32+
]
3733
}

0 commit comments

Comments
 (0)
Please sign in to comment.