Description
In JSON Schema draft 2019-09, any schema can be either a boolean or an object. The false
schema always fails validation, while the true
schema always passes. Neither produces any annotations.
This is really valuable to express intent, particularly with false
which can otherwise be written an endless number of ways, the most straightforward of which is {"not": {}}
. It's easier for people reading the schemas, and in some cases tooling can optimize things a bit when booleans are used.
However, allowing the Schema Object (as opposed to a subschema, or a $ref
target) to be a boolean as well as an object seems like it might be an incompatible change in terms of what's allowed for OAS 3.1.
I would have no object to excluding booleans replacing entire top-level Schema Objects, as the use cases for that are pretty strange and can be solved in other ways.
I can write up a PR to clarify this, and also update the proposed Schema Object meta-schema in #2016 to enforce it, if that is something we want to do.