You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
As we're only loosening requirements here, (as we are doing with type now taking a string or array) I don't see that as a problem for a minor release like 3.1.
I think if we're saying 3.1 supports true JSON Schema, but then we add caveats, we're undermining one of the key selling points of 3.1.
In JSON Schema draft 2019-09, any schema can be either a boolean or an object. The
false
schema always fails validation, while thetrue
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.
The text was updated successfully, but these errors were encountered: