Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Things to note:
allowUnusedKeywords
is required because that's what specification is expecting, and there are tests for that. By default,@exodus/schemasafe
instead refuses to compile a schema with unused keywords to prevent failing in open state on e.g. schema author mistakes -- similar to howajv
behaves withstrictKeywords
option, but with deeper checks.That option does not affect the produced code or performance, it just affects whether the schema would be refused to compile or not.
Structured reporting is disabled by default, instead just a boolean validation status is reported — because if the user wants errors, they would enable them, and if they don't need errors and need just the result — they might forget to disable it for performance.
I'm not sure how fair is that to other validators in this benchmark. If it's not -- just add
includeErrors: true,
to the options ;-)Default
$schema
value is needed because$schema
is not specified in all tests, and behavior differs between various spec versions. Specifically,$ref
behavior changed indraft2019-09
, and there is a test for that. Out of those two,draft2019-09
behavior is more secure and makes more sense, hence that's the default in schemasafe unless$schema
is specified in the schema or$schemaDefault
is specified in options.