boolean-json-joi-schema
This package is a Joi port of boolean-json-schema. It exports a Joi schema that can be used to validate boolean JSON expressions.
The simplest valid expression is just a variable name:
const schema = ;const Joi = ; Joi;
Per the original, the schema permits negation, conjunction, disjunction, and arbitrary combinations:
not: 'x' and: 'x' 'y' or: 'x' 'y' and: or: 'x' 'y' not: 'z'
Conjunctions and disjunctions must have at least two operands:
and: 'x' // INVALID 🚫 and: 'x' 'y' 'z' // VALID ✅ or: 'x' // INVALID 🚫 or: 'x' 'y' 'z' // VALID ✅