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
Uh oh!
There was an error while loading. Please reload this page.
-
the definitions for
constanddefaultactually are:{ "const": true, "default": true }I think those definitions are incorrect, because
trueis not a schema. Despite the fact that usingtruewould bypass lots of checks..trueis not a schema! Alse despite the fact that in various languagestruealso passes a test likeisObject(true)we here are talking aboutjson, and injson...trueis abooleannot an object.Therefore, I propose to change them to empty object:
{ "const": {}, "default": {} }Their definitions can be found in
meta-dataandvalidation.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