From cd0d4bfc93eba799803dc0b57cb47ac9adf46783 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Sun, 22 Jun 2025 12:26:51 +1200 Subject: [PATCH 1/5] re-unite meta-schema --- specs/meta/applicator.json | 63 ---------- specs/meta/content.json | 14 --- specs/meta/core.json | 48 -------- specs/meta/format-annotation.json | 11 -- specs/meta/format-assertion.json | 11 -- specs/meta/meta-data.json | 34 ------ specs/meta/meta.json | 187 ++++++++++++++++++++++++++++++ specs/meta/unevaluated.json | 12 -- specs/meta/validation.json | 90 -------------- 9 files changed, 187 insertions(+), 283 deletions(-) delete mode 100644 specs/meta/applicator.json delete mode 100644 specs/meta/content.json delete mode 100644 specs/meta/core.json delete mode 100644 specs/meta/format-annotation.json delete mode 100644 specs/meta/format-assertion.json delete mode 100644 specs/meta/meta-data.json create mode 100644 specs/meta/meta.json delete mode 100644 specs/meta/unevaluated.json delete mode 100644 specs/meta/validation.json diff --git a/specs/meta/applicator.json b/specs/meta/applicator.json deleted file mode 100644 index cbb25392..00000000 --- a/specs/meta/applicator.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/next/schema", - "$id": "https://json-schema.org/draft/next/meta/applicator", - "$dynamicAnchor": "meta", - - "title": "Applicator vocabulary meta-schema", - "type": ["object", "boolean"], - "properties": { - "prefixItems": { "$ref": "#/$defs/schemaArray" }, - "items": { "$dynamicRef": "#meta" }, - "maxContains": { "$ref": "#/$defs/nonNegativeInteger" }, - "minContains": { - "$ref": "#/$defs/nonNegativeInteger", - "default": 1 - }, - "contains": { "$dynamicRef": "#meta" }, - "additionalProperties": { "$dynamicRef": "#meta" }, - "properties": { - "type": "object", - "additionalProperties": { "$dynamicRef": "#meta" }, - "default": {} - }, - "patternProperties": { - "type": "object", - "additionalProperties": { "$dynamicRef": "#meta" }, - "propertyNames": { "format": "regex" }, - "default": {} - }, - "dependentSchemas": { - "type": "object", - "additionalProperties": { "$dynamicRef": "#meta" }, - "default": {} - }, - "propertyDependencies": { - "type": "object", - "additionalProperties": { - "type": "object", - "additionalProperties": { "$dynamicRef": "#meta" }, - "default": {} - }, - "default": {} - }, - "propertyNames": { "$dynamicRef": "#meta" }, - "if": { "$dynamicRef": "#meta" }, - "then": { "$dynamicRef": "#meta" }, - "else": { "$dynamicRef": "#meta" }, - "allOf": { "$ref": "#/$defs/schemaArray" }, - "anyOf": { "$ref": "#/$defs/schemaArray" }, - "oneOf": { "$ref": "#/$defs/schemaArray" }, - "not": { "$dynamicRef": "#meta" } - }, - "$defs": { - "nonNegativeInteger": { - "type": "integer", - "minimum": 0 - }, - "schemaArray": { - "type": "array", - "minItems": 1, - "items": { "$dynamicRef": "#meta" } - } - } -} diff --git a/specs/meta/content.json b/specs/meta/content.json deleted file mode 100644 index f9b754e1..00000000 --- a/specs/meta/content.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/next/schema", - "$id": "https://json-schema.org/draft/next/meta/content", - "$dynamicAnchor": "meta", - - "title": "Content vocabulary meta-schema", - - "type": ["object", "boolean"], - "properties": { - "contentEncoding": { "type": "string" }, - "contentMediaType": { "type": "string" }, - "contentSchema": { "$dynamicRef": "#meta" } - } -} diff --git a/specs/meta/core.json b/specs/meta/core.json deleted file mode 100644 index 473927c3..00000000 --- a/specs/meta/core.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/next/schema", - "$id": "https://json-schema.org/draft/next/meta/core", - "$dynamicAnchor": "meta", - - "title": "Core vocabulary meta-schema", - "type": ["object", "boolean"], - "properties": { - "$id": { - "$ref": "#/$defs/iriReferenceString", - "$comment": "Fragments not allowed.", - "pattern": "^[^#]*$" - }, - "$schema": { "$ref": "#/$defs/iriString" }, - "$ref": { "$ref": "#/$defs/iriReferenceString" }, - "$anchor": { "$ref": "#/$defs/anchorString" }, - "$dynamicRef": { "$ref": "#/$defs/iriReferenceString" }, - "$dynamicAnchor": { "$ref": "#/$defs/anchorString" }, - "$vocabulary": { - "type": "object", - "propertyNames": { "$ref": "#/$defs/iriString" }, - "additionalProperties": { - "type": "boolean" - } - }, - "$comment": { - "type": "string" - }, - "$defs": { - "type": "object", - "additionalProperties": { "$dynamicRef": "#meta" } - } - }, - "$defs": { - "anchorString": { - "type": "string", - "pattern": "^[A-Za-z_][-A-Za-z0-9._]*$" - }, - "iriString": { - "type": "string", - "format": "iri" - }, - "iriReferenceString": { - "type": "string", - "format": "iri-reference" - } - } -} diff --git a/specs/meta/format-annotation.json b/specs/meta/format-annotation.json deleted file mode 100644 index 5f657b6c..00000000 --- a/specs/meta/format-annotation.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/next/schema", - "$id": "https://json-schema.org/draft/next/meta/format-annotation", - "$dynamicAnchor": "meta", - - "title": "Format vocabulary meta-schema for annotation results", - "type": ["object", "boolean"], - "properties": { - "format": { "type": "string" } - } -} diff --git a/specs/meta/format-assertion.json b/specs/meta/format-assertion.json deleted file mode 100644 index 3e8cf47f..00000000 --- a/specs/meta/format-assertion.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/next/schema", - "$id": "https://json-schema.org/draft/next/meta/format-assertion", - "$dynamicAnchor": "meta", - - "title": "Format vocabulary meta-schema for assertion results", - "type": ["object", "boolean"], - "properties": { - "format": { "type": "string" } - } -} diff --git a/specs/meta/meta-data.json b/specs/meta/meta-data.json deleted file mode 100644 index 3359227f..00000000 --- a/specs/meta/meta-data.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/next/schema", - "$id": "https://json-schema.org/draft/next/meta/meta-data", - "$dynamicAnchor": "meta", - - "title": "Meta-data vocabulary meta-schema", - - "type": ["object", "boolean"], - "properties": { - "title": { - "type": "string" - }, - "description": { - "type": "string" - }, - "default": true, - "deprecated": { - "type": "boolean", - "default": false - }, - "readOnly": { - "type": "boolean", - "default": false - }, - "writeOnly": { - "type": "boolean", - "default": false - }, - "examples": { - "type": "array", - "items": true - } - } -} diff --git a/specs/meta/meta.json b/specs/meta/meta.json new file mode 100644 index 00000000..860aaa89 --- /dev/null +++ b/specs/meta/meta.json @@ -0,0 +1,187 @@ +{ + "$schema": "https://json-schema.org/version/year/meta", + "$id": "https://json-schema.org/version/year/meta", + "$dynamicAnchor": "meta", + + "title": "JSON Schema Core and Validation specification meta-schema", + "type": ["object", "boolean"], + "properties": { + "$id": { + "$ref": "#/$defs/iriReferenceString", + "$comment": "Fragments not allowed.", + "pattern": "^[^#]*$" + }, + "$schema": { "$ref": "#/$defs/iriString" }, + "$ref": { "$ref": "#/$defs/iriReferenceString" }, + "$anchor": { "$ref": "#/$defs/anchorString" }, + "$dynamicRef": { "$ref": "#/$defs/iriReferenceString" }, + "$dynamicAnchor": { "$ref": "#/$defs/anchorString" }, + "$comment": { + "type": "string" + }, + "$defs": { + "type": "object", + "additionalProperties": { "$dynamicRef": "#meta" } + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "deprecated": { + "type": "boolean", + "default": false + }, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "prefixItems": { "$ref": "#/$defs/schemaArray" }, + "items": { "$dynamicRef": "#meta" }, + "maxContains": { "$ref": "#/$defs/nonNegativeInteger" }, + "minContains": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 1 + }, + "contains": { "$dynamicRef": "#meta" }, + "additionalProperties": { "$dynamicRef": "#meta" }, + "properties": { + "type": "object", + "additionalProperties": { "$dynamicRef": "#meta" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$dynamicRef": "#meta" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependentSchemas": { + "type": "object", + "additionalProperties": { "$dynamicRef": "#meta" }, + "default": {} + }, + "propertyNames": { "$dynamicRef": "#meta" }, + "if": { "$dynamicRef": "#meta" }, + "then": { "$dynamicRef": "#meta" }, + "else": { "$dynamicRef": "#meta" }, + "allOf": { "$ref": "#/$defs/schemaArray" }, + "anyOf": { "$ref": "#/$defs/schemaArray" }, + "oneOf": { "$ref": "#/$defs/schemaArray" }, + "not": { "$dynamicRef": "#meta" }, + "unevaluatedItems": { "$dynamicRef": "#meta" }, + "unevaluatedProperties": { "$dynamicRef": "#meta" }, + "type": { + "anyOf": [ + { "$ref": "#/$defs/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/$defs/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "const": true, + "enum": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/$defs/nonNegativeInteger" }, + "minLength": { "$ref": "#/$defs/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "maxItems": { "$ref": "#/$defs/nonNegativeInteger" }, + "minItems": { "$ref": "#/$defs/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "maxProperties": { "$ref": "#/$defs/nonNegativeInteger" }, + "minProperties": { "$ref": "#/$defs/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/$defs/stringArray" }, + "dependentRequired": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/stringArray" + } + }, + "format": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentSchema": { "$dynamicRef": "#meta" }, + + "$vocabulary": { + "$comment": "Proposed keyword: https://github.com/json-schema-org/json-schema-spec/blob/main/specs/proposals/vocabularies.md" + }, + "propertyDependencies": { + "$comment": "Proposed keyword: https://github.com/json-schema-org/json-schema-spec/blob/main/specs/proposals/propertyDependencies.md" + } + }, + "$defs": { + "anchorString": { + "type": "string", + "pattern": "^[A-Za-z_][-A-Za-z0-9._]*$" + }, + "iriString": { + "type": "string", + "format": "iri" + }, + "iriReferenceString": { + "type": "string", + "format": "iri-reference" + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 0 + }, + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$dynamicRef": "#meta" } + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + } + } +} diff --git a/specs/meta/unevaluated.json b/specs/meta/unevaluated.json deleted file mode 100644 index 1d283fbd..00000000 --- a/specs/meta/unevaluated.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/next/schema", - "$id": "https://json-schema.org/draft/next/meta/unevaluated", - "$dynamicAnchor": "meta", - - "title": "Unevaluated applicator vocabulary meta-schema", - "type": ["object", "boolean"], - "properties": { - "unevaluatedItems": { "$dynamicRef": "#meta" }, - "unevaluatedProperties": { "$dynamicRef": "#meta" } - } -} diff --git a/specs/meta/validation.json b/specs/meta/validation.json deleted file mode 100644 index 51afc7cb..00000000 --- a/specs/meta/validation.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/next/schema", - "$id": "https://json-schema.org/draft/next/meta/validation", - "$dynamicAnchor": "meta", - - "title": "Validation vocabulary meta-schema", - "type": ["object", "boolean"], - "properties": { - "type": { - "anyOf": [ - { "$ref": "#/$defs/simpleTypes" }, - { - "type": "array", - "items": { "$ref": "#/$defs/simpleTypes" }, - "minItems": 1, - "uniqueItems": true - } - ] - }, - "const": true, - "enum": { - "type": "array", - "items": true - }, - "multipleOf": { - "type": "number", - "exclusiveMinimum": 0 - }, - "maximum": { - "type": "number" - }, - "exclusiveMaximum": { - "type": "number" - }, - "minimum": { - "type": "number" - }, - "exclusiveMinimum": { - "type": "number" - }, - "maxLength": { "$ref": "#/$defs/nonNegativeInteger" }, - "minLength": { "$ref": "#/$defs/nonNegativeIntegerDefault0" }, - "pattern": { - "type": "string", - "format": "regex" - }, - "maxItems": { "$ref": "#/$defs/nonNegativeInteger" }, - "minItems": { "$ref": "#/$defs/nonNegativeIntegerDefault0" }, - "uniqueItems": { - "type": "boolean", - "default": false - }, - "maxProperties": { "$ref": "#/$defs/nonNegativeInteger" }, - "minProperties": { "$ref": "#/$defs/nonNegativeIntegerDefault0" }, - "required": { "$ref": "#/$defs/stringArray" }, - "dependentRequired": { - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/stringArray" - } - } - }, - "$defs": { - "nonNegativeInteger": { - "type": "integer", - "minimum": 0 - }, - "nonNegativeIntegerDefault0": { - "$ref": "#/$defs/nonNegativeInteger", - "default": 0 - }, - "simpleTypes": { - "enum": [ - "array", - "boolean", - "integer", - "null", - "number", - "object", - "string" - ] - }, - "stringArray": { - "type": "array", - "items": { "type": "string" }, - "uniqueItems": true, - "default": [] - } - } -} From 44c5c0e5e29f7c32f424f9d35b38c5e34861b8f5 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Sun, 22 Jun 2025 16:24:15 +1200 Subject: [PATCH 2/5] allow for x- properties --- specs/meta/meta.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/specs/meta/meta.json b/specs/meta/meta.json index 860aaa89..218e3bed 100644 --- a/specs/meta/meta.json +++ b/specs/meta/meta.json @@ -146,6 +146,9 @@ "$comment": "Proposed keyword: https://github.com/json-schema-org/json-schema-spec/blob/main/specs/proposals/propertyDependencies.md" } }, + "patternProperties": { + "^x-": true + }, "$defs": { "anchorString": { "type": "string", From 33d7241e6a745d85ae17ca689ad0c3ef0c9a03b7 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Sun, 22 Jun 2025 16:48:53 +1200 Subject: [PATCH 3/5] disallow other $* keywrods --- specs/meta/meta.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/specs/meta/meta.json b/specs/meta/meta.json index 218e3bed..151b542a 100644 --- a/specs/meta/meta.json +++ b/specs/meta/meta.json @@ -147,7 +147,8 @@ } }, "patternProperties": { - "^x-": true + "^x-": true, + "^(?!(?:\\$id|\\$schema|\\$ref|\\$anchor|\\$dynamicRef|\\$dynamicAnchor|\\$comment|\\$defs)$).*": false }, "$defs": { "anchorString": { From 154b863eddcbebc711d555ae36ccada48af646e7 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Sun, 22 Jun 2025 16:51:29 +1200 Subject: [PATCH 4/5] disallow other $* keywords (fix) --- specs/meta/meta.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/meta/meta.json b/specs/meta/meta.json index 151b542a..4048fdd8 100644 --- a/specs/meta/meta.json +++ b/specs/meta/meta.json @@ -148,7 +148,7 @@ }, "patternProperties": { "^x-": true, - "^(?!(?:\\$id|\\$schema|\\$ref|\\$anchor|\\$dynamicRef|\\$dynamicAnchor|\\$comment|\\$defs)$).*": false + "^(?!(?:\\$id|\\$schema|\\$ref|\\$anchor|\\$dynamicRef|\\$dynamicAnchor|\\$comment|\\$defs)$)\\$.*": false }, "$defs": { "anchorString": { From bba80a7dd72e46517f07b5f37e3a924d8482267b Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Sun, 13 Jul 2025 15:35:22 +1200 Subject: [PATCH 5/5] use propertyNames to restrict $-keywords --- specs/meta/meta.json | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/specs/meta/meta.json b/specs/meta/meta.json index 4048fdd8..168f85b3 100644 --- a/specs/meta/meta.json +++ b/specs/meta/meta.json @@ -1,6 +1,6 @@ { - "$schema": "https://json-schema.org/version/year/meta", - "$id": "https://json-schema.org/version/year/meta", + "$schema": "https://json-schema.org/1/2025", + "$id": "https://json-schema.org/1/2025", "$dynamicAnchor": "meta", "title": "JSON Schema Core and Validation specification meta-schema", @@ -147,8 +147,10 @@ } }, "patternProperties": { - "^x-": true, - "^(?!(?:\\$id|\\$schema|\\$ref|\\$anchor|\\$dynamicRef|\\$dynamicAnchor|\\$comment|\\$defs)$)\\$.*": false + "^x-": true + }, + "propertyNames": { + "pattern": "^[^$]|^\\$(id|schema|ref|anchor|dynamicRef|dynamicAnchor|comment|defs)$" }, "$defs": { "anchorString": { @@ -186,6 +188,12 @@ "object", "string" ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] } } }