Proposal: change const and default definitions #743
SorinGFS
started this conversation in
Specification
Replies: 2 comments 10 replies
-
Boolean values are schemas since draft-06. https://json-schema.org/draft/2020-12/json-schema-core#name-boolean-json-schemas Personally, I also tend to prefer using |
Beta Was this translation helpful? Give feedback.
3 replies
-
The two schemas you posted: {
"const": true,
"default": true
} and {
"const": {},
"default": {}
} are not equivalent. These keywords take JSON values, NOT schemas. the |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
the definitions for
const
anddefault
actually are:I think those definitions are incorrect, because
true
is not a schema. Despite the fact that usingtrue
would bypass lots of checks..true
is not a schema! Alse despite the fact that in various languagestrue
also passes a test likeisObject(true)
we here are talking aboutjson
, and injson
...true
is aboolean
not an object.Therefore, I propose to change them to empty object:
Their definitions can be found in
meta-data
andvalidation
.This would mean no implications of any kind since empty object
{}
is also a value that evaluates to true.Beta Was this translation helpful? Give feedback.
All reactions