From 9eef7bfa39da7ec58f7954fd2039125718129115 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Thu, 22 Oct 2020 11:28:16 -0700 Subject: [PATCH 1/7] provide defaults for all keywords and subschemas that lacked them For vocabulary metaschemas, the default is just 'true'; for the 'dependentRequired' and 'dependentSchemas' keywords, the default is the empty object. --- meta/applicator.json | 3 ++- meta/content.json | 3 ++- meta/core.json | 3 ++- meta/format-annotation.json | 3 ++- meta/format-assertion.json | 3 ++- meta/meta-data.json | 3 ++- meta/unevaluated.json | 3 ++- meta/validation.json | 6 ++++-- schema.json | 3 ++- 9 files changed, 20 insertions(+), 10 deletions(-) diff --git a/meta/applicator.json b/meta/applicator.json index ff2cfc2f..21e34a27 100644 --- a/meta/applicator.json +++ b/meta/applicator.json @@ -50,5 +50,6 @@ "minItems": 1, "items": { "$dynamicRef": "#meta" } } - } + }, + "default": true } diff --git a/meta/content.json b/meta/content.json index 2f6e056a..76dbc488 100644 --- a/meta/content.json +++ b/meta/content.json @@ -13,5 +13,6 @@ "contentEncoding": { "type": "string" }, "contentMediaType": { "type": "string" }, "contentSchema": { "$dynamicRef": "#meta" } - } + }, + "default": true } diff --git a/meta/core.json b/meta/core.json index 7b5758b1..508c6eb4 100644 --- a/meta/core.json +++ b/meta/core.json @@ -48,5 +48,6 @@ "type": "string", "format": "uri-reference" } - } + }, + "default": true } diff --git a/meta/format-annotation.json b/meta/format-annotation.json index 51ef7ea1..b2b7c665 100644 --- a/meta/format-annotation.json +++ b/meta/format-annotation.json @@ -10,5 +10,6 @@ "type": ["object", "boolean"], "properties": { "format": { "type": "string" } - } + }, + "default": true } diff --git a/meta/format-assertion.json b/meta/format-assertion.json index 5e73fd75..9f956914 100644 --- a/meta/format-assertion.json +++ b/meta/format-assertion.json @@ -10,5 +10,6 @@ "type": ["object", "boolean"], "properties": { "format": { "type": "string" } - } + }, + "default": true } diff --git a/meta/meta-data.json b/meta/meta-data.json index 05cbc22a..301bd808 100644 --- a/meta/meta-data.json +++ b/meta/meta-data.json @@ -33,5 +33,6 @@ "type": "array", "items": true } - } + }, + "default": true } diff --git a/meta/unevaluated.json b/meta/unevaluated.json index 5f62a3ff..028a51c7 100644 --- a/meta/unevaluated.json +++ b/meta/unevaluated.json @@ -11,5 +11,6 @@ "properties": { "unevaluatedItems": { "$dynamicRef": "#meta" }, "unevaluatedProperties": { "$dynamicRef": "#meta" } - } + }, + "default": true } diff --git a/meta/validation.json b/meta/validation.json index 606b87ba..530f209c 100644 --- a/meta/validation.json +++ b/meta/validation.json @@ -65,7 +65,8 @@ "type": "object", "additionalProperties": { "$ref": "#/$defs/stringArray" - } + }, + "default": {} } }, "$defs": { @@ -94,5 +95,6 @@ "uniqueItems": true, "default": [] } - } + }, + "default": true } diff --git a/schema.json b/schema.json index a88709f7..2c96bbba 100644 --- a/schema.json +++ b/schema.json @@ -53,5 +53,6 @@ "$ref": "meta/core#/$defs/uriReferenceString", "deprecated": true } - } + }, + "default": true } From 706042884d7f4a8c044ea689840dd065770947c5 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Wed, 20 Jan 2021 09:31:49 -0800 Subject: [PATCH 2/7] remove redundant defaults adjacent to $dynamicRef --- meta/applicator.json | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/meta/applicator.json b/meta/applicator.json index 21e34a27..9240c1ce 100644 --- a/meta/applicator.json +++ b/meta/applicator.json @@ -13,8 +13,7 @@ "items": { "$dynamicRef": "#meta" }, "contains": { "$dynamicRef": "#meta" }, "additionalProperties": { - "$dynamicRef": "#meta", - "default": {} + "$dynamicRef": "#meta" }, "properties": { "type": "object", @@ -33,8 +32,7 @@ "default": {} }, "propertyNames": { - "$dynamicRef": "#meta", - "default": {} + "$dynamicRef": "#meta" }, "if": { "$dynamicRef": "#meta" }, "then": { "$dynamicRef": "#meta" }, From 3ea4c029dd4f45bfc38aaf419835c9bafeef9217 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Thu, 21 Jan 2021 11:26:20 -0800 Subject: [PATCH 3/7] remove misleading/incorrect defaults at top schema level e.g. when evaluating the "not" keyword, the subschema inside it should *not* be true, as that would produce a false result from this keyword --- meta/applicator.json | 3 +-- meta/content.json | 3 +-- meta/core.json | 3 +-- meta/format-annotation.json | 3 +-- meta/format-assertion.json | 3 +-- meta/meta-data.json | 3 +-- meta/unevaluated.json | 3 +-- meta/validation.json | 3 +-- schema.json | 3 +-- 9 files changed, 9 insertions(+), 18 deletions(-) diff --git a/meta/applicator.json b/meta/applicator.json index 9240c1ce..86527791 100644 --- a/meta/applicator.json +++ b/meta/applicator.json @@ -48,6 +48,5 @@ "minItems": 1, "items": { "$dynamicRef": "#meta" } } - }, - "default": true + } } diff --git a/meta/content.json b/meta/content.json index 76dbc488..2f6e056a 100644 --- a/meta/content.json +++ b/meta/content.json @@ -13,6 +13,5 @@ "contentEncoding": { "type": "string" }, "contentMediaType": { "type": "string" }, "contentSchema": { "$dynamicRef": "#meta" } - }, - "default": true + } } diff --git a/meta/core.json b/meta/core.json index 508c6eb4..7b5758b1 100644 --- a/meta/core.json +++ b/meta/core.json @@ -48,6 +48,5 @@ "type": "string", "format": "uri-reference" } - }, - "default": true + } } diff --git a/meta/format-annotation.json b/meta/format-annotation.json index b2b7c665..51ef7ea1 100644 --- a/meta/format-annotation.json +++ b/meta/format-annotation.json @@ -10,6 +10,5 @@ "type": ["object", "boolean"], "properties": { "format": { "type": "string" } - }, - "default": true + } } diff --git a/meta/format-assertion.json b/meta/format-assertion.json index 9f956914..5e73fd75 100644 --- a/meta/format-assertion.json +++ b/meta/format-assertion.json @@ -10,6 +10,5 @@ "type": ["object", "boolean"], "properties": { "format": { "type": "string" } - }, - "default": true + } } diff --git a/meta/meta-data.json b/meta/meta-data.json index 301bd808..05cbc22a 100644 --- a/meta/meta-data.json +++ b/meta/meta-data.json @@ -33,6 +33,5 @@ "type": "array", "items": true } - }, - "default": true + } } diff --git a/meta/unevaluated.json b/meta/unevaluated.json index 028a51c7..5f62a3ff 100644 --- a/meta/unevaluated.json +++ b/meta/unevaluated.json @@ -11,6 +11,5 @@ "properties": { "unevaluatedItems": { "$dynamicRef": "#meta" }, "unevaluatedProperties": { "$dynamicRef": "#meta" } - }, - "default": true + } } diff --git a/meta/validation.json b/meta/validation.json index 530f209c..1432ad8c 100644 --- a/meta/validation.json +++ b/meta/validation.json @@ -95,6 +95,5 @@ "uniqueItems": true, "default": [] } - }, - "default": true + } } diff --git a/schema.json b/schema.json index 2c96bbba..a88709f7 100644 --- a/schema.json +++ b/schema.json @@ -53,6 +53,5 @@ "$ref": "meta/core#/$defs/uriReferenceString", "deprecated": true } - }, - "default": true + } } From a33ef8f71c2a7058b0c1d49e434f706504562b2c Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Thu, 21 Jan 2021 14:21:07 -0800 Subject: [PATCH 4/7] squash - final (?) attempt - move defaults to where they belong, and only include those that insert different behaviour than would exist if they were absent --- meta/applicator.json | 9 +++------ meta/core.json | 6 ++++-- meta/meta-data.json | 9 +++------ meta/validation.json | 12 ++++++------ schema.json | 1 - 5 files changed, 16 insertions(+), 21 deletions(-) diff --git a/meta/applicator.json b/meta/applicator.json index 86527791..314a24fa 100644 --- a/meta/applicator.json +++ b/meta/applicator.json @@ -17,19 +17,16 @@ }, "properties": { "type": "object", - "additionalProperties": { "$dynamicRef": "#meta" }, - "default": {} + "additionalProperties": { "$dynamicRef": "#meta" } }, "patternProperties": { "type": "object", "additionalProperties": { "$dynamicRef": "#meta" }, - "propertyNames": { "format": "regex" }, - "default": {} + "propertyNames": { "format": "regex" } }, "dependentSchemas": { "type": "object", - "additionalProperties": { "$dynamicRef": "#meta" }, - "default": {} + "additionalProperties": { "$dynamicRef": "#meta" } }, "propertyNames": { "$dynamicRef": "#meta" diff --git a/meta/core.json b/meta/core.json index 7b5758b1..098dba88 100644 --- a/meta/core.json +++ b/meta/core.json @@ -31,10 +31,12 @@ }, "$defs": { "type": "object", - "additionalProperties": { "$dynamicRef": "#meta" }, - "default": {} + "additionalProperties": { "$dynamicRef": "#meta" } } }, + "default": { + "$schema": "https://json-schema.org/draft/2020-12/schema" + }, "$defs": { "anchorString": { "type": "string", diff --git a/meta/meta-data.json b/meta/meta-data.json index 05cbc22a..12ea78f7 100644 --- a/meta/meta-data.json +++ b/meta/meta-data.json @@ -18,16 +18,13 @@ }, "default": true, "deprecated": { - "type": "boolean", - "default": false + "type": "boolean" }, "readOnly": { - "type": "boolean", - "default": false + "type": "boolean" }, "writeOnly": { - "type": "boolean", - "default": false + "type": "boolean" }, "examples": { "type": "array", diff --git a/meta/validation.json b/meta/validation.json index 1432ad8c..71060853 100644 --- a/meta/validation.json +++ b/meta/validation.json @@ -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 + "$ref": "#/$defs/nonNegativeInteger" }, "maxProperties": { "$ref": "#/$defs/nonNegativeInteger" }, "minProperties": { "$ref": "#/$defs/nonNegativeIntegerDefault0" }, @@ -65,10 +63,12 @@ "type": "object", "additionalProperties": { "$ref": "#/$defs/stringArray" - }, - "default": {} + } } }, + "default": { + "minContains": 1 + }, "$defs": { "nonNegativeInteger": { "type": "integer", diff --git a/schema.json b/schema.json index a88709f7..b94a6dc0 100644 --- a/schema.json +++ b/schema.json @@ -29,7 +29,6 @@ "$comment": "\"definitions\" has been replaced by \"$defs\".", "type": "object", "additionalProperties": { "$dynamicRef": "#meta" }, - "default": {}, "deprecated": true }, "dependencies": { From b5ab09f10e4c9069c8c57e6b4b8e4cda89ada6ba Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Thu, 21 Jan 2021 14:24:25 -0800 Subject: [PATCH 5/7] squash - these defaults do not make sense here - missing keywords produce no annotations --- meta/validation.json | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/meta/validation.json b/meta/validation.json index 71060853..8d3628ea 100644 --- a/meta/validation.json +++ b/meta/validation.json @@ -75,8 +75,7 @@ "minimum": 0 }, "nonNegativeIntegerDefault0": { - "$ref": "#/$defs/nonNegativeInteger", - "default": 0 + "$ref": "#/$defs/nonNegativeInteger" }, "simpleTypes": { "enum": [ @@ -92,8 +91,7 @@ "stringArray": { "type": "array", "items": { "type": "string" }, - "uniqueItems": true, - "default": [] + "uniqueItems": true } } } From 5553c05b982a01df0056b5cbf5515663e0d4e088 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Fri, 22 Jan 2021 10:55:41 -0800 Subject: [PATCH 6/7] squash. remove defaults in the wrong place; add $comments for defaults that are useful to note for humans. --- meta/applicator.json | 17 ++++++++--------- meta/core.json | 3 --- meta/meta-data.json | 9 ++++++--- meta/validation.json | 9 ++++----- 4 files changed, 18 insertions(+), 20 deletions(-) diff --git a/meta/applicator.json b/meta/applicator.json index 314a24fa..998ac597 100644 --- a/meta/applicator.json +++ b/meta/applicator.json @@ -12,25 +12,24 @@ "prefixItems": { "$ref": "#/$defs/schemaArray" }, "items": { "$dynamicRef": "#meta" }, "contains": { "$dynamicRef": "#meta" }, - "additionalProperties": { - "$dynamicRef": "#meta" - }, + "additionalProperties": { "$dynamicRef": "#meta" }, "properties": { "type": "object", - "additionalProperties": { "$dynamicRef": "#meta" } + "additionalProperties": { "$dynamicRef": "#meta" }, + "$comment": "default: {}" }, "patternProperties": { "type": "object", "additionalProperties": { "$dynamicRef": "#meta" }, - "propertyNames": { "format": "regex" } + "propertyNames": { "format": "regex" }, + "$comment": "default: {}" }, "dependentSchemas": { "type": "object", - "additionalProperties": { "$dynamicRef": "#meta" } - }, - "propertyNames": { - "$dynamicRef": "#meta" + "additionalProperties": { "$dynamicRef": "#meta" }, + "$comment": "default: {}" }, + "propertyNames": { "$dynamicRef": "#meta" }, "if": { "$dynamicRef": "#meta" }, "then": { "$dynamicRef": "#meta" }, "else": { "$dynamicRef": "#meta" }, diff --git a/meta/core.json b/meta/core.json index 098dba88..dfc092d9 100644 --- a/meta/core.json +++ b/meta/core.json @@ -34,9 +34,6 @@ "additionalProperties": { "$dynamicRef": "#meta" } } }, - "default": { - "$schema": "https://json-schema.org/draft/2020-12/schema" - }, "$defs": { "anchorString": { "type": "string", diff --git a/meta/meta-data.json b/meta/meta-data.json index 12ea78f7..b5f5630c 100644 --- a/meta/meta-data.json +++ b/meta/meta-data.json @@ -18,13 +18,16 @@ }, "default": true, "deprecated": { - "type": "boolean" + "type": "boolean", + "$comment": "default: false" }, "readOnly": { - "type": "boolean" + "type": "boolean", + "$comment": "default: false" }, "writeOnly": { - "type": "boolean" + "type": "boolean", + "$comment": "default: false" }, "examples": { "type": "array", diff --git a/meta/validation.json b/meta/validation.json index 8d3628ea..cfbe1b64 100644 --- a/meta/validation.json +++ b/meta/validation.json @@ -50,11 +50,13 @@ "maxItems": { "$ref": "#/$defs/nonNegativeInteger" }, "minItems": { "$ref": "#/$defs/nonNegativeIntegerDefault0" }, "uniqueItems": { - "type": "boolean" + "type": "boolean", + "$comment": "default: false" }, "maxContains": { "$ref": "#/$defs/nonNegativeInteger" }, "minContains": { - "$ref": "#/$defs/nonNegativeInteger" + "$ref": "#/$defs/nonNegativeInteger", + "$comment": "default: 1" }, "maxProperties": { "$ref": "#/$defs/nonNegativeInteger" }, "minProperties": { "$ref": "#/$defs/nonNegativeIntegerDefault0" }, @@ -66,9 +68,6 @@ } } }, - "default": { - "minContains": 1 - }, "$defs": { "nonNegativeInteger": { "type": "integer", From 677f20a9016a93b0b5026fecdc14ecf0e86c93a1 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Fri, 22 Jan 2021 15:44:56 -0800 Subject: [PATCH 7/7] squash - okay, one last time. keep defaults at property level as human sugar. --- meta/applicator.json | 6 +++--- meta/meta-data.json | 6 +++--- meta/validation.json | 10 ++++++---- schema.json | 6 ++++-- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/meta/applicator.json b/meta/applicator.json index 998ac597..ca699230 100644 --- a/meta/applicator.json +++ b/meta/applicator.json @@ -16,18 +16,18 @@ "properties": { "type": "object", "additionalProperties": { "$dynamicRef": "#meta" }, - "$comment": "default: {}" + "default": {} }, "patternProperties": { "type": "object", "additionalProperties": { "$dynamicRef": "#meta" }, "propertyNames": { "format": "regex" }, - "$comment": "default: {}" + "default": {} }, "dependentSchemas": { "type": "object", "additionalProperties": { "$dynamicRef": "#meta" }, - "$comment": "default: {}" + "default": {} }, "propertyNames": { "$dynamicRef": "#meta" }, "if": { "$dynamicRef": "#meta" }, diff --git a/meta/meta-data.json b/meta/meta-data.json index b5f5630c..05cbc22a 100644 --- a/meta/meta-data.json +++ b/meta/meta-data.json @@ -19,15 +19,15 @@ "default": true, "deprecated": { "type": "boolean", - "$comment": "default: false" + "default": false }, "readOnly": { "type": "boolean", - "$comment": "default: false" + "default": false }, "writeOnly": { "type": "boolean", - "$comment": "default: false" + "default": false }, "examples": { "type": "array", diff --git a/meta/validation.json b/meta/validation.json index cfbe1b64..606b87ba 100644 --- a/meta/validation.json +++ b/meta/validation.json @@ -51,12 +51,12 @@ "minItems": { "$ref": "#/$defs/nonNegativeIntegerDefault0" }, "uniqueItems": { "type": "boolean", - "$comment": "default: false" + "default": false }, "maxContains": { "$ref": "#/$defs/nonNegativeInteger" }, "minContains": { "$ref": "#/$defs/nonNegativeInteger", - "$comment": "default: 1" + "default": 1 }, "maxProperties": { "$ref": "#/$defs/nonNegativeInteger" }, "minProperties": { "$ref": "#/$defs/nonNegativeIntegerDefault0" }, @@ -74,7 +74,8 @@ "minimum": 0 }, "nonNegativeIntegerDefault0": { - "$ref": "#/$defs/nonNegativeInteger" + "$ref": "#/$defs/nonNegativeInteger", + "default": 0 }, "simpleTypes": { "enum": [ @@ -90,7 +91,8 @@ "stringArray": { "type": "array", "items": { "type": "string" }, - "uniqueItems": true + "uniqueItems": true, + "default": [] } } } diff --git a/schema.json b/schema.json index b94a6dc0..d5e2d31c 100644 --- a/schema.json +++ b/schema.json @@ -29,7 +29,8 @@ "$comment": "\"definitions\" has been replaced by \"$defs\".", "type": "object", "additionalProperties": { "$dynamicRef": "#meta" }, - "deprecated": true + "deprecated": true, + "default": {} }, "dependencies": { "$comment": "\"dependencies\" has been split and replaced by \"dependentSchemas\" and \"dependentRequired\" in order to serve their differing semantics.", @@ -40,7 +41,8 @@ { "$ref": "meta/validation#/$defs/stringArray" } ] }, - "deprecated": true + "deprecated": true, + "default": {} }, "$recursiveAnchor": { "$comment": "\"$recursiveAnchor\" has been replaced by \"$dynamicAnchor\".",