Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
provide defaults for all keywords and subschemas that lacked them #1006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
provide defaults for all keywords and subschemas that lacked them #1006
Changes from 2 commits
9eef7bf
7060428
3ea4c02
a33ef8f
b5ab09f
5553c05
677f20a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't agree with having defaults in the roots of the meta-schemas. What's the motivation for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get that the motivation is to avoid putting
"default": true
everywhere we reference a schema, but the default isn't always "true" for all references.Traditionally, in our meta-schemas,
default
has meant something like: if this doesn't exist, the validation result would be the same as if it did exist and had this default value. For example, thedefault
ofproperties
is{}
. Therefore,{}
has the same result as{ "properties": {} }
.So, now consider the
not
keyword. It references the top-level meta-schema. If the top-level meta-schema has"default": true
that says thedefault
ofnot
istrue
. Therefore,{}
has the same result as{ "not": true }
, which is not correct. That means each time something references the top-level meta-schema it needs to define adefault
that makes sense in its context.... or just get rid of
default
in meta-schemas altogether because it doesn't provide any real value.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jdesrosiers I think we're arguing the same side of the coin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we are. Bottom line is that
default
doesn't belong at the root of meta-schemas.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or, we can add a default for not -- which should be false. that is,
..., "not": { "$dynamicRef": "#meta", "default": false }, ...
So, how about we remove all uses of default where it's just the obvious thing (
{}
for objects,[]
for arrays, ortrue
or{}
for schemas), and keep them only when they're non-standard -- which is, I believe, just "not", "deprecated", "readOnly", "writeOnly", "uniqueItems", and "minContains".)If that's amenable to all I can amend this PR.