Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions meta/applicator.json
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,24 @@
"prefixItems": { "$ref": "#/$defs/schemaArray" },
"items": { "$dynamicRef": "#meta" },
"contains": { "$dynamicRef": "#meta" },
"additionalProperties": {
"$dynamicRef": "#meta",
"default": {}
},
"additionalProperties": { "$dynamicRef": "#meta" },
"properties": {
"type": "object",
"additionalProperties": { "$dynamicRef": "#meta" },
"default": {}
"$comment": "default: {}"
},
"patternProperties": {
"type": "object",
"additionalProperties": { "$dynamicRef": "#meta" },
"propertyNames": { "format": "regex" },
"default": {}
"$comment": "default: {}"
},
"dependentSchemas": {
"type": "object",
"additionalProperties": { "$dynamicRef": "#meta" },
"default": {}
},
"propertyNames": {
"$dynamicRef": "#meta",
"default": {}
"$comment": "default: {}"
},
"propertyNames": { "$dynamicRef": "#meta" },
"if": { "$dynamicRef": "#meta" },
"then": { "$dynamicRef": "#meta" },
"else": { "$dynamicRef": "#meta" },
Expand Down
3 changes: 1 addition & 2 deletions meta/core.json
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
},
"$defs": {
"type": "object",
"additionalProperties": { "$dynamicRef": "#meta" },
"default": {}
"additionalProperties": { "$dynamicRef": "#meta" }
}
},
"$defs": {
Expand Down
6 changes: 3 additions & 3 deletions meta/meta-data.json
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
"default": true,
"deprecated": {
"type": "boolean",
"default": false
"$comment": "default: false"
},
"readOnly": {
"type": "boolean",
"default": false
"$comment": "default: false"
},
"writeOnly": {
"type": "boolean",
"default": false
"$comment": "default: false"
},
"examples": {
"type": "array",
Expand Down
10 changes: 4 additions & 6 deletions meta/validation.json
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@
"minItems": { "$ref": "#/$defs/nonNegativeIntegerDefault0" },
"uniqueItems": {
"type": "boolean",
"default": false
"$comment": "default: false"
},
"maxContains": { "$ref": "#/$defs/nonNegativeInteger" },
"minContains": {
"$ref": "#/$defs/nonNegativeInteger",
"default": 1
Copy link
Member

@gregsdennis gregsdennis Jan 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should stay

Relequestual reacted with thumbs up emoji
Copy link
Member Author

@karenetheridge karenetheridge Jan 22, 2021

Choose a reason for hiding this comment

The 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 $comment.

Copy link
Member

@jdesrosiers jdesrosiers Jan 22, 2021

Choose a reason for hiding this comment

The 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 default so broadly that there is no wrong way to use it. Since there is no right or wrong way to use it and it doesn't do anything anyway, I'd rather use it in the spirit of how it was intended to be used.

If this is here purely for humans, it should be in a $comment.

I had the same thought at first, but I've come to the conclusion that just because default is not useful as an annotation, doesn't mean it's not useful. Consider that a documentation generator doesn't use instances and therefore doesn't work on annotations as they are defined by the spec. The documentation generator can still make good use of default because the limitations of using it as an annotation don't apply in that context.

Copy link
Member

@Relequestual Relequestual Jan 22, 2021

Choose a reason for hiding this comment

The 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).

"$comment": "default: 1"
},
"maxProperties": { "$ref": "#/$defs/nonNegativeInteger" },
"minProperties": { "$ref": "#/$defs/nonNegativeIntegerDefault0" },
Expand All @@ -74,8 +74,7 @@
"minimum": 0
},
"nonNegativeIntegerDefault0": {
"$ref": "#/$defs/nonNegativeInteger",
"default": 0
"$ref": "#/$defs/nonNegativeInteger"
},
"simpleTypes": {
"enum": [
Expand All @@ -91,8 +90,7 @@
"stringArray": {
"type": "array",
"items": { "type": "string" },
"uniqueItems": true,
"default": []
"uniqueItems": true
}
}
}
1 change: 0 additions & 1 deletion schema.json
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"$comment": "\"definitions\" has been replaced by \"$defs\".",
"type": "object",
"additionalProperties": { "$dynamicRef": "#meta" },
"default": {},
"deprecated": true
},
"dependencies": {
Expand Down

AltStyle によって変換されたページ (->オリジナル) /