Expand description
A small JSON Schema checker for the arguments of a command or an action: the subset that says what a call may carry, nothing more.
Checked keywords: type (a name or a list; integer is a number
without a fraction), enum, const, properties, required,
additionalProperties (false or a schema), items (one schema),
minItems, maxItems, minimum, maximum, exclusiveMinimum,
exclusiveMaximum (numbers), minLength, maxLength (in
characters), allOf, anyOf, oneOf and not. Every other keyword
(pattern, format, $ref, title, description, default…)
is read as a note and not checked: a schema using them still checks
what it can.
check answers the first mismatch, with where it is (/factor,
/items/2) and what was expected, in plain words.
Functions§
- check
- Whether
valuematchesschema:Errnames the first place it does not (/factor: expected a number, got a string). A schema that is not an object (true,null) accepts everything;falseaccepts nothing.