ExodusMovement / schemasafe

A reasonably safe JSON Schema validator with draft-04/06/07/2019-09/2020-12 support.
https://npmjs.com/@exodus/schemasafe
MIT License
156 stars 12 forks source link

Using const or enum keywords should short-circuit other checks #63

Closed kklash closed 4 years ago

kklash commented 4 years ago

If a schema specifies the exact possible values of a data structure, we shouldn't have to also declare a series of other keywords which add no additional value.

Take this example:

const { validator } = require('.')
const validate = validator({ type: 'array', const: [1,2,3] }, { mode: 'strong' })
// Error: [requireValidation] items rule must be specified at #