Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update @exodus/schemasafe config #56

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ChALkeR
Copy link
Contributor

@ChALkeR ChALkeR commented Sep 14, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant