-
-
Notifications
You must be signed in to change notification settings - Fork 322
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
Changes from 5 commits
9eef7bf
7060428
3ea4c02
a33ef8f
b5ab09f
5553c05
677f20a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,10 +31,12 @@ | |
}, | ||
"$defs": { | ||
"type": "object", | ||
"additionalProperties": { "$dynamicRef": "#meta" }, | ||
"default": {} | ||
"additionalProperties": { "$dynamicRef": "#meta" } | ||
} | ||
}, | ||
"default": { | ||
"$schema": "https://json-schema.org/draft/2020-12/schema" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't this mean that every schema, including sub-schemas, have a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, good point. So we'll have to leave it out.. as we have no way currently of specifying in the metaschema "this should apply for the top level schema but not for anything dynamically referenced lower down". |
||
}, | ||
"$defs": { | ||
"anchorString": { | ||
"type": "string", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,13 +50,11 @@ | |
"maxItems": { "$ref": "#/$defs/nonNegativeInteger" }, | ||
"minItems": { "$ref": "#/$defs/nonNegativeIntegerDefault0" }, | ||
"uniqueItems": { | ||
"type": "boolean", | ||
"default": false | ||
"type": "boolean" | ||
}, | ||
"maxContains": { "$ref": "#/$defs/nonNegativeInteger" }, | ||
"minContains": { | ||
"$ref": "#/$defs/nonNegativeInteger", | ||
"default": 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should stay There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we're okay with using "default" totally contradictory to the spec? If this is here purely for humans, it should be in a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this use is contradictory to the spec, because the spec defines
I had the same thought at first, but I've come to the conclusion that just because There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm in agreement with this. We should consider other applications beyond just being used with an instance, the most obvious, to me, being writing schemas by hand or using UI tools (in terms of adding these for the meta schema). |
||
"$ref": "#/$defs/nonNegativeInteger" | ||
}, | ||
"maxProperties": { "$ref": "#/$defs/nonNegativeInteger" }, | ||
"minProperties": { "$ref": "#/$defs/nonNegativeIntegerDefault0" }, | ||
|
@@ -68,14 +66,16 @@ | |
} | ||
} | ||
}, | ||
"default": { | ||
"minContains": 1 | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not a fan of this format, and I don't think we should encourage it. I think the default value should stay with the property declaration. |
||
"$defs": { | ||
"nonNegativeInteger": { | ||
"type": "integer", | ||
"minimum": 0 | ||
}, | ||
"nonNegativeIntegerDefault0": { | ||
"$ref": "#/$defs/nonNegativeInteger", | ||
"default": 0 | ||
"$ref": "#/$defs/nonNegativeInteger" | ||
}, | ||
"simpleTypes": { | ||
"enum": [ | ||
|
@@ -91,8 +91,7 @@ | |
"stringArray": { | ||
"type": "array", | ||
"items": { "type": "string" }, | ||
"uniqueItems": true, | ||
"default": [] | ||
"uniqueItems": true | ||
} | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.