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

Update @exodus/schemasafe config

Open ChALkeR opened this issue 4 years ago • 0 comments

Two changes here:

  1. As this repo now tests on multiple drafts, actually pass the correct draft uri (like to other validators) instead of hardcoding draft-06.
  2. Disable compile-time bail-out on unreachable checks.

To explain (2), schemasafe in default configuration does not allow schemas that can be proven to have unreachable checks, e.g.

  • { "type": "array", "maxLength": 2 }maxLength doesn't do anything on arrays.
  • { "anyOf": [ { "type": "number" }, {} ] } — first check doesn't do anything because second always passes. The static check for this one disabled by allowUnreachable.

allow*** options disable some of those checks, allowing some ill-formed schemas to compile. Those options do not change the runtime behavior of any schemas.

The testsuite includes those ill-formed schemas on a purpose, to test that some parts have no effect on the behavior (assuming they are allowed to compile), and in order to check the runtime behavior here (and compare to the other impls) we have to disable the static checks.

ChALkeR avatar Sep 14 '21 01:09 ChALkeR