Skip to content

Commit 032715f

Browse files
committed
Demo with prototype-safe tests
Minus json-gate, minus side-effects
1 parent e94479f commit 032715f

20 files changed

+579
-30
lines changed

README.md

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,15 @@ for validators that cause side-effects on schema or data.
88

99
# Performance
1010

11-
![performance](https://chart.googleapis.com/chart?chxt=x,y&cht=bhs&chco=76A4FB&chls=2.0&chbh=76,4,1&chs=600x420&chxl=-1:|@exodus/schemasafe|ajv|is-my-json-valid|z-schema|@cfworker/json-schema&chd=t:100,62.3,37.3,3.6,2.3)
11+
![performance](https://chart.googleapis.com/chart?chxt=x,y&cht=bhs&chco=76A4FB&chls=2.0&chbh=396,4,1&chs=600x420&chxl=-1:|@exodus/schemasafe&chd=t:100)
1212

1313
|Validator|Relative speed|Number of test runs per second|
1414
|---------|:------------:|:----------------------------:|
15-
|[`@exodus/schemasafe`](https://github.com/ExodusMovement/schemasafe)|100%|19731 (± 10.62%)|
16-
|[`ajv`](https://github.com/ajv-validator/ajv)|62.3%|12290 (± 18.42%)|
17-
|[`is-my-json-valid`](https://github.com/mafintosh/is-my-json-valid#readme)|37.3%|7367 (± 6.2%)|
18-
|[`z-schema`](https://github.com/zaggino/z-schema)|3.6%|705 (± 8.35%)|
19-
|[`@cfworker/json-schema`](https://github.com/cfworker/cfworker/tree/master/packages/json-schema/README.md)|2.3%|458 (± 4.89%)|
15+
|[`@exodus/schemasafe`](https://github.com/ExodusMovement/schemasafe)|100%|38364 (± 1.31%)|
2016

2117
235 tests are run in each test run.
2218

23-
Validators tested: [`json-schema-validator-generator (1.1.11)`](https://github.com/danwang/json-schema-validator-generator), [`is-my-json-valid (2.20.4)`](https://github.com/mafintosh/is-my-json-valid#readme), [`jsen (0.6.6)`](https://github.com/bugventure/jsen), [`ajv (6.12.3)`](https://github.com/ajv-validator/ajv), [`themis (1.1.6)`](https://github.com/playlyfe/themis), [`z-schema (4.2.3)`](https://github.com/zaggino/z-schema), [`jjv (1.0.2)`](https://github.com/acornejo/jjv), [`djv (2.1.3-alpha.0)`](https://github.com/korzio/djv#readme), [`skeemas (1.2.5)`](https://github.com/Prestaul/skeemas#readme), [`schemasaurus (0.7.8)`](https://github.com/AlexeyGrishin/schemasaurus), [`jsck (0.3.2)`](https://github.com/pandastrike/jsck#readme), [`jassi (0.1.2)`](https://github.com/iclanzan/jassi), [`JSV (4.0.2)`](http://github.com/garycourt/JSV), [`request-validator (0.3.3)`](https://github.com/bugventure/request-validator), [`json-gate (0.8.23)`](https://github.com/oferei/json-gate#readme), [`json-model (0.2.24)`](https://github.com/geraintluff/json-model), [`tv4 (1.3.0)`](https://github.com/geraintluff/tv4), [`jsonschema (1.2.6)`](https://github.com/tdegrunt/jsonschema#readme), [`revalidator (0.3.1)`](https://github.com/flatiron/revalidator), [`json-schema-library (4.1.2)`](https://github.com/sagold/json-schema-library), [`@exodus/schemasafe (1.0.0-alpha.4)`](https://github.com/ExodusMovement/schemasafe), [`@cfworker/json-schema (1.2.14)`](https://github.com/cfworker/cfworker/tree/master/packages/json-schema/README.md),
19+
Validators tested: [`json-schema-validator-generator (1.1.11)`](https://github.com/danwang/json-schema-validator-generator), [`is-my-json-valid (2.20.4)`](https://github.com/mafintosh/is-my-json-valid#readme), [`jsen (0.6.6)`](https://github.com/bugventure/jsen), [`ajv (6.12.3)`](https://github.com/ajv-validator/ajv), [`themis (1.1.6)`](https://github.com/playlyfe/themis), [`z-schema (4.2.3)`](https://github.com/zaggino/z-schema), [`jjv (1.0.2)`](https://github.com/acornejo/jjv), [`djv (2.1.3-alpha.0)`](https://github.com/korzio/djv#readme), [`skeemas (1.2.5)`](https://github.com/Prestaul/skeemas#readme), [`schemasaurus (0.7.8)`](https://github.com/AlexeyGrishin/schemasaurus), [`jsck (0.3.2)`](https://github.com/pandastrike/jsck#readme), [`jassi (0.1.2)`](https://github.com/iclanzan/jassi), [`JSV (4.0.2)`](http://github.com/garycourt/JSV), [`request-validator (0.3.3)`](https://github.com/bugventure/request-validator), [`json-model (0.2.24)`](https://github.com/geraintluff/json-model), [`tv4 (1.3.0)`](https://github.com/geraintluff/tv4), [`jsonschema (1.2.6)`](https://github.com/tdegrunt/jsonschema#readme), [`revalidator (0.3.1)`](https://github.com/flatiron/revalidator), [`json-schema-library (4.1.2)`](https://github.com/sagold/json-schema-library), [`@exodus/schemasafe (1.0.0-beta.2)`](https://github.com/ExodusMovement/schemasafe), [`@cfworker/json-schema (1.2.18)`](https://github.com/cfworker/cfworker/tree/master/packages/json-schema/README.md),
2420

2521
(validators not in the results above where excluded because of failing tests - see below for details)
2622

@@ -36,32 +32,31 @@ This test suite uses the [official JSON-schema test suite](https://github.com/js
3632

3733
If a validator does not pass a test in the official test suite, it will show up in these results.
3834

39-
![failing tests](https://chart.googleapis.com/chart?chxt=x,y&cht=bhs&chco=76A4FB&chls=2.0&chbh=14,4,1&chs=600x416&chxl=-1:|@exodus/schemasafe|@cfworker/json-schema|ajv|z-schema|jsonschema|is-my-json-valid|jsen|json-schema-library|jsck|tv4|themis|request-validator|skeemas|jassi|schemasaurus|json-schema-validator-generator|jjv|djv|json-model|JSV|json-gate|revalidator&chd=t:1,7,17,18,23,25,30,30,51,53,56,64,67,69,71,75,86,93,103,125,208,277&chxr=0,0,277&chds=0,277)
35+
![failing tests](https://chart.googleapis.com/chart?chxt=x,y&cht=bhs&chco=76A4FB&chls=2.0&chbh=15,4,1&chs=600x419&chxl=-1:|@exodus/schemasafe|@cfworker/json-schema|jsonschema|jsen|json-schema-library|is-my-json-valid|z-schema|ajv|tv4|jsck|jassi|skeemas|schemasaurus|json-schema-validator-generator|jjv|djv|themis|request-validator|json-model|JSV|revalidator&chd=t:1,17,27,40,40,51,52,55,57,64,69,77,87,89,94,95,96,128,167,281,307&chxr=0,0,307&chds=0,307)
4036

4137
|Validator|Number of failing tests (click for details)|
4238
|---------|-----------------------|
4339
|[`@exodus/schemasafe`](https://github.com/ExodusMovement/schemasafe)|[1](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/@exodus/schemasafe.md)|
44-
|[`@cfworker/json-schema`](https://github.com/cfworker/cfworker/tree/master/packages/json-schema/README.md)|[7](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/@cfworker/json-schema.md)|
45-
|[`ajv`](https://github.com/ajv-validator/ajv)|[17](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/ajv.md)|
46-
|[`z-schema`](https://github.com/zaggino/z-schema)|[18](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/z-schema.md)|
47-
|[`jsonschema`](https://github.com/tdegrunt/jsonschema#readme)|[23](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/jsonschema.md)|
48-
|[`is-my-json-valid`](https://github.com/mafintosh/is-my-json-valid#readme)|[25](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/is-my-json-valid.md)|
49-
|[`jsen`](https://github.com/bugventure/jsen)|[30](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/jsen.md)|
50-
|[`json-schema-library`](https://github.com/sagold/json-schema-library)|[30](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/json-schema-library.md)|
51-
|[`jsck`](https://github.com/pandastrike/jsck#readme)|[51](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/jsck.md)|
52-
|[`tv4`](https://github.com/geraintluff/tv4)|[53](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/tv4.md)|
53-
|[`themis`](https://github.com/playlyfe/themis)|[56](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/themis.md)|
54-
|[`request-validator`](https://github.com/bugventure/request-validator)|[64](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/request-validator.md)|
55-
|[`skeemas`](https://github.com/Prestaul/skeemas#readme)|[67](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/skeemas.md)|
40+
|[`@cfworker/json-schema`](https://github.com/cfworker/cfworker/tree/master/packages/json-schema/README.md)|[17](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/@cfworker/json-schema.md)|
41+
|[`jsonschema`](https://github.com/tdegrunt/jsonschema#readme)|[27](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/jsonschema.md)|
42+
|[`jsen`](https://github.com/bugventure/jsen)|[40](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/jsen.md)|
43+
|[`json-schema-library`](https://github.com/sagold/json-schema-library)|[40](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/json-schema-library.md)|
44+
|[`is-my-json-valid`](https://github.com/mafintosh/is-my-json-valid#readme)|[51](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/is-my-json-valid.md)|
45+
|[`z-schema`](https://github.com/zaggino/z-schema)|[52](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/z-schema.md)|
46+
|[`ajv`](https://github.com/ajv-validator/ajv)|[55](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/ajv.md)|
47+
|[`tv4`](https://github.com/geraintluff/tv4)|[57](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/tv4.md)|
48+
|[`jsck`](https://github.com/pandastrike/jsck#readme)|[64](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/jsck.md)|
5649
|[`jassi`](https://github.com/iclanzan/jassi)|[69](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/jassi.md)|
57-
|[`schemasaurus`](https://github.com/AlexeyGrishin/schemasaurus)|[71](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/schemasaurus.md)|
58-
|[`json-schema-validator-generator`](https://github.com/danwang/json-schema-validator-generator)|[75](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/json-schema-validator-generator.md)|
59-
|[`jjv`](https://github.com/acornejo/jjv)|[86](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/jjv.md)|
60-
|[`djv`](https://github.com/korzio/djv#readme)|[93](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/djv.md)|
61-
|[`json-model`](https://github.com/geraintluff/json-model)|[103](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/json-model.md)|
62-
|[`JSV`](http://github.com/garycourt/JSV)|[125](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/JSV.md)|
63-
|[`json-gate`](https://github.com/oferei/json-gate#readme)|[208](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/json-gate.md)|
64-
|[`revalidator`](https://github.com/flatiron/revalidator)|[277](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/revalidator.md)|
50+
|[`skeemas`](https://github.com/Prestaul/skeemas#readme)|[77](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/skeemas.md)|
51+
|[`schemasaurus`](https://github.com/AlexeyGrishin/schemasaurus)|[87](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/schemasaurus.md)|
52+
|[`json-schema-validator-generator`](https://github.com/danwang/json-schema-validator-generator)|[89](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/json-schema-validator-generator.md)|
53+
|[`jjv`](https://github.com/acornejo/jjv)|[94](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/jjv.md)|
54+
|[`djv`](https://github.com/korzio/djv#readme)|[95](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/djv.md)|
55+
|[`themis`](https://github.com/playlyfe/themis)|[96](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/themis.md)|
56+
|[`request-validator`](https://github.com/bugventure/request-validator)|[128](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/request-validator.md)|
57+
|[`json-model`](https://github.com/geraintluff/json-model)|[167](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/json-model.md)|
58+
|[`JSV`](http://github.com/garycourt/JSV)|[281](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/JSV.md)|
59+
|[`revalidator`](https://github.com/flatiron/revalidator)|[307](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/revalidator.md)|
6560

6661
Some validators have deliberately chosen not to support parts of the spec. Go to the homepage of the validator to learn if
6762
that is the case for these tests.
@@ -72,9 +67,10 @@ Number of tests that caused side-effects. The schema or data was altered by the
7267

7368
|Validator|Number of side-effects (BAD)|
7469
|---------|----------------------------|
70+
|[`jsonschema`](https://github.com/tdegrunt/jsonschema#readme)|[4](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/jsonschema-side-effects.md)|
7571
|[`tv4`](https://github.com/geraintluff/tv4)|[13](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/tv4-side-effects.md)|
76-
|[`revalidator`](https://github.com/flatiron/revalidator)|[616](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/revalidator-side-effects.md)|
77-
|[`json-model`](https://github.com/geraintluff/json-model)|[643](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/json-model-side-effects.md)|
72+
|[`revalidator`](https://github.com/flatiron/revalidator)|[968](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/revalidator-side-effects.md)|
73+
|[`json-model`](https://github.com/geraintluff/json-model)|[995](https://github.com/ebdrup/json-schema-benchmark/blob/master/reports/json-model-side-effects.md)|
7874

7975
Validators not in the list have no side-effects on data or schemas.
8076

reports/@cfworker/json-schema.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ that is the case for these tests.
1717
`Proper UTF-16 surrogate pair handling: pattern, matches empty`|Expected result: `true` but validator returned: `false`
1818
`Proper UTF-16 surrogate pair handling: pattern, matches two`|Expected result: `true` but validator returned: `false`
1919
`Proper UTF-16 surrogate pair handling: patternProperties, doesn't match two`|Expected result: `false` but validator returned: `true`
20+
`Does not see elements non existing on the object: 'toString' as number, Valid if not present`|Expected result: `true` but validator returned: `"Instances of \"function\" type are not supported."`. **This excludes this validator from performance tests**
21+
`Does not see elements non existing on the object: 'toString' as object, Valid if not present`|Expected result: `true` but validator returned: `"Instances of \"function\" type are not supported."`. **This excludes this validator from performance tests**
22+
`Does not see elements non existing on the object: 'toString' via required, Invalid if not present`|Expected result: `false` but validator returned: `true`. **This excludes this validator from performance tests**
23+
`Does not see elements non existing on the object: 'constructor' as number, Valid if not present`|Expected result: `true` but validator returned: `"Instances of \"function\" type are not supported."`. **This excludes this validator from performance tests**
24+
`Does not see elements non existing on the object: 'constructor' as object, Valid if not present`|Expected result: `true` but validator returned: `"Instances of \"function\" type are not supported."`. **This excludes this validator from performance tests**
25+
`Does not see elements non existing on the object: 'constructor' via required, Invalid if not present`|Expected result: `false` but validator returned: `true`. **This excludes this validator from performance tests**
26+
`Does not see elements non existing on the object: '__proto__' as number, Valid if not present`|Expected result: `true` but validator returned: `false`. **This excludes this validator from performance tests**
27+
`Does not see elements non existing on the object: '__proto__' via required, Invalid if not present`|Expected result: `false` but validator returned: `true`. **This excludes this validator from performance tests**
28+
`Does not see inexisting elements on new objects: '__proto__' via required, Invalid if not present`|Expected result: `false` but validator returned: `true`. **This excludes this validator from performance tests**
29+
`Does not see inexisting elements on new objects: '__proto__' via required, Valid if not present`|Expected result: `true` but validator returned: `false`. **This excludes this validator from performance tests**
2030

2131
**All other tests passed**.
2232

0 commit comments

Comments
 (0)