json-schema-benchmark icon indicating copy to clipboard operation
json-schema-benchmark copied to clipboard

What is the fastest JSON schema validator for draft-3, draft-4, draft-6 or draft-7?

Open christian-weiss opened this issue 6 years ago • 7 comments

Some validators are not supporting all drafts. It would be interesting to see rankings per draft-version and also which validator is supporing which draft-version.

christian-weiss avatar Dec 05 '19 10:12 christian-weiss

@christian-weiss I think it's a really good idea. I don't have time to do much else than accepting PRs and updating the test results as new versions of the testsuite and validators are released. Help would be appreciated :-)

ebdrup avatar Jul 05 '20 14:07 ebdrup

An easy way would be to host separate branches for each draft, e.g.:

  • draft-04
  • draft-06
  • draft-07
  • draft2019-09

And add a simple menu in the README to switch between those branches.

Default could be any of those (I would vote for anything newer than 04).

#48 implements draft-06 tests.

ChALkeR avatar Jul 07 '20 00:07 ChALkeR

Menu in the readme, super great idea. I guess it's also misleading that the current readme doesn't show you that it's actually testing only draft-4

ebdrup avatar Nov 29 '20 11:11 ebdrup

I have added draft 4 and 6, draft 6 is the default, now... I'm out of touch with the developments in the standard. Would it make sense to make draft2019-09 the default, or do too few validators support that?

ebdrup avatar Nov 30 '20 08:11 ebdrup

As drafts are drafts, i would not call them "standard". As far as i know draft-3, draft-4, draft-6 and draft-7 are somehow "stable", so i do not expect big changes here. So i vote for making "draft-7" the default.

daniela-waranie avatar Nov 30 '20 09:11 daniela-waranie

@daniela-waranie I have added tests for draft-7: https://github.com/ebdrup/json-schema-benchmark/tree/master/draft7 But I chose to not make it the default as all validators fail a LOT of the tests - I'm not sure if I'm doing something wrong or validators are really so bad at draft-7? I think it's probably me doing something wrong, so I can't make it the default right now.

ebdrup avatar Dec 01 '20 11:12 ebdrup

@ebdrup I think it would be good to use draft-7 as the default. It's ajv's default draft version and the most modern of the stable drafts.

The test results look correct to me- the failures here: https://github.com/ebdrup/json-schema-benchmark/blob/master/draft7/reports/@cfworker/json-schema.md Match the unsupported tests here: https://github.com/cfworker/cfworker/blob/main/packages/json-schema/test/index.spec.ts#L7

jdanyow avatar Jun 03 '21 02:06 jdanyow