ts-json-schema-generator icon indicating copy to clipboard operation
ts-json-schema-generator copied to clipboard

Support boolean schemas

Open hmil opened this issue 3 years ago • 1 comments

As mentioned in #1152 , a schema may be a plain boolean instead of an object, where true means "Always passes validation" and false means "Always fails validation".

Currently, ts-json-schema-generator uses the type JSONSchema7 to represent a schema definition, but the type it should be using is JSONSchema7Definition since the latter also supports boolean schemas.

Boolean schemas can be represented with alternatives ( {} and { "not": {} } respectively), but the spec recommends to use boolean schemas over these forms, as it makes the intent more clear.

hmil avatar Mar 10 '22 10:03 hmil

Happy to review a pull request towards this goal.

domoritz avatar Mar 10 '22 14:03 domoritz