From 005eb0a3d88477f10825bfdd25e4a74781ce15c0 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Thu, 14 Jul 2022 13:26:40 +1200 Subject: [PATCH 1/5] proposal to add keyword metadata to vocabularies by defining a new vocabulary --- meta/applicator.json | 95 ++++++++++++++++++++++++++++++++++++- meta/content.json | 8 +++- meta/format-annotation.json | 6 ++- meta/format-assertion.json | 7 ++- meta/meta-data.json | 12 ++++- meta/unevaluated.json | 15 +++++- meta/validation.json | 24 +++++++++- meta/vocabulary.json | 66 ++++++++++++++++++++++++++ 8 files changed, 226 insertions(+), 7 deletions(-) create mode 100644 meta/vocabulary.json diff --git a/meta/applicator.json b/meta/applicator.json index 1b2f8c2e..18cffe7d 100644 --- a/meta/applicator.json +++ b/meta/applicator.json @@ -2,7 +2,8 @@ "$schema": "https://json-schema.org/draft/next/schema", "$id": "https://json-schema.org/draft/next/meta/applicator", "$vocabulary": { - "https://json-schema.org/draft/next/vocab/applicator": true + "https://json-schema.org/draft/next/vocab/applicator": true, + "https://json-schema.org/draft/next/vocab/vocabulary": true }, "$dynamicAnchor": "meta", @@ -47,11 +48,103 @@ "oneOf": { "$ref": "#/$defs/schemaArray" }, "not": { "$dynamicRef": "#meta" } }, + "applicators": { + "prefixItems": "arrayChild", + "items": "arrayChild", + "contains": [ "objectChild", "arrayChild" ], + "additionalProperties": "objectChild", + "properties": "objectChild", + "patternProperties": "objectChild", + "dependentSchemas": "inPlace", + "propertyDependencies": "inPlace", + "propertyNames": "objectChild", + "if": "inPlace", + "then": "inPlace", + "else": "inPlace", + "allOf": "inPlace", + "anyOf": "inPlace", + "oneOf": "inPlace", + "not": "inPlace" + }, + "assertions": [ + "prefixItems", + "items", + "contains", + "additionalProperties", + "properties", + "patternProperties", + "dependentSchemas", + "propertyDependencies", + "propertyNames", + "then", + "else", + "allOf", + "anyOf", + "oneOf", + "not" + ], + "annotations": { + "prefixItems": { + "kind": [ "producer", "collector" ], + "producedValue": { + "oneOf": [ + { "$ref": "#/$defs/nonNegativeInteger" }, + { "type": "boolean" } + ] + } + }, + "items": { + "kind": [ "producer", "collector" ], + "producedValue": { "const": true } + }, + "contains": { + "kind": [ "producer", "collector" ], + "producedValue": { + "type": "array", + "items": { "$ref": "#/$defs/nonNegativeInteger" } + } + }, + "additionalProperties": { + "kind": [ "producer", "collector" ], + "producedValue": { + "type": "array", + "items": { "type": "string" } + } + }, + "properties": { + "kind": [ "producer", "collector" ], + "producedValue": { + "type": "array", + "items": { "type": "string" } + } + }, + "patternProperties": { + "kind": [ "producer", "collector" ], + "producedValue": { + "type": "array", + "items": { "type": "string" } + } + }, + "dependentSchemas": { "kind": "collector" }, + "propertyDependencies": { "kind": "collector" }, + "propertyNames": { "kind": "collector" }, + "if": { "kind": "collector" }, + "then": { "kind": "collector" }, + "else": { "kind": "collector" }, + "allOf": { "kind": "collector" }, + "anyOf": { "kind": "collector" }, + "oneOf": { "kind": "collector" }, + "not": { "kind": "collector" } + }, "$defs": { "schemaArray": { "type": "array", "minItems": 1, "items": { "$dynamicRef": "#meta" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 } } } diff --git a/meta/content.json b/meta/content.json index 2c29ee50..0dae9a3a 100644 --- a/meta/content.json +++ b/meta/content.json @@ -2,7 +2,8 @@ "$schema": "https://json-schema.org/draft/next/schema", "$id": "https://json-schema.org/draft/next/meta/content", "$vocabulary": { - "https://json-schema.org/draft/next/vocab/content": true + "https://json-schema.org/draft/next/vocab/content": true, + "https://json-schema.org/draft/next/vocab/vocabulary": true }, "$dynamicAnchor": "meta", @@ -13,5 +14,10 @@ "contentEncoding": { "type": "string" }, "contentMediaType": { "type": "string" }, "contentSchema": { "$dynamicRef": "#meta" } + }, + "annotations": { + "contentEncoding": { "kind": "producer" }, + "contentMediaType": { "kind": "producer" }, + "contentSchema": { "kind": "producer" } } } diff --git a/meta/format-annotation.json b/meta/format-annotation.json index 562f78f8..9b89fd94 100644 --- a/meta/format-annotation.json +++ b/meta/format-annotation.json @@ -2,7 +2,8 @@ "$schema": "https://json-schema.org/draft/next/schema", "$id": "https://json-schema.org/draft/next/meta/format-annotation", "$vocabulary": { - "https://json-schema.org/draft/next/vocab/format-annotation": true + "https://json-schema.org/draft/next/vocab/format-annotation": true, + "https://json-schema.org/draft/next/vocab/vocabulary": true }, "$dynamicAnchor": "meta", @@ -10,5 +11,8 @@ "type": ["object", "boolean"], "properties": { "format": { "type": "string" } + }, + "annotations": { + "format": { "kind": "producer" } } } diff --git a/meta/format-assertion.json b/meta/format-assertion.json index d60ead96..171b5efb 100644 --- a/meta/format-assertion.json +++ b/meta/format-assertion.json @@ -2,7 +2,8 @@ "$schema": "https://json-schema.org/draft/next/schema", "$id": "https://json-schema.org/draft/next/meta/format-assertion", "$vocabulary": { - "https://json-schema.org/draft/next/vocab/format-assertion": true + "https://json-schema.org/draft/next/vocab/format-assertion": true, + "https://json-schema.org/draft/next/vocab/vocabulary": true }, "$dynamicAnchor": "meta", @@ -10,5 +11,9 @@ "type": ["object", "boolean"], "properties": { "format": { "type": "string" } + }, + "assertions": [ "format" ], + "annotations": { + "format": { "kind": "producer" } } } diff --git a/meta/meta-data.json b/meta/meta-data.json index 345a6916..1de8b942 100644 --- a/meta/meta-data.json +++ b/meta/meta-data.json @@ -2,7 +2,8 @@ "$schema": "https://json-schema.org/draft/next/schema", "$id": "https://json-schema.org/draft/next/meta/meta-data", "$vocabulary": { - "https://json-schema.org/draft/next/vocab/meta-data": true + "https://json-schema.org/draft/next/vocab/meta-data": true, + "https://json-schema.org/draft/next/vocab/vocabulary": true }, "$dynamicAnchor": "meta", @@ -33,5 +34,14 @@ "type": "array", "items": true } + }, + "annotations": { + "title": { "kind": "producer" }, + "description": { "kind": "producer" }, + "default": { "kind": "producer" }, + "deprecated": { "kind": "producer" }, + "readOnly": { "kind": "producer" }, + "writeOnly": { "kind": "producer" }, + "examples": { "kind": "producer" } } } diff --git a/meta/unevaluated.json b/meta/unevaluated.json index 58b411dd..42711837 100644 --- a/meta/unevaluated.json +++ b/meta/unevaluated.json @@ -2,7 +2,8 @@ "$schema": "https://json-schema.org/draft/next/schema", "$id": "https://json-schema.org/draft/next/meta/unevaluated", "$vocabulary": { - "https://json-schema.org/draft/next/vocab/unevaluated": true + "https://json-schema.org/draft/next/vocab/unevaluated": true, + "https://json-schema.org/draft/next/vocab/vocabulary": true }, "$dynamicAnchor": "meta", @@ -11,5 +12,17 @@ "properties": { "unevaluatedItems": { "$dynamicRef": "#meta" }, "unevaluatedProperties": { "$dynamicRef": "#meta" } + }, + "applicators": { + "unevaluatedItems": "arrayChild", + "unevaluatedProperties": "objectChild" + }, + "assertions": [ + "unevaluatedItems", + "unevaluatedProperties" + ], + "annotations": { + "unevaluatedItems": { "kind": "collector" }, + "unevaluatedProperties": { "kind": "collector" } } } diff --git a/meta/validation.json b/meta/validation.json index 69d52e95..fb890bb2 100644 --- a/meta/validation.json +++ b/meta/validation.json @@ -2,7 +2,8 @@ "$schema": "https://json-schema.org/draft/next/schema", "$id": "https://json-schema.org/draft/next/meta/validation", "$vocabulary": { - "https://json-schema.org/draft/next/vocab/validation": true + "https://json-schema.org/draft/next/vocab/validation": true, + "https://json-schema.org/draft/next/vocab/vocabulary": true }, "$dynamicAnchor": "meta", @@ -68,6 +69,27 @@ } } }, + "assertions": [ + "type", + "const", + "multipleOf", + "maximum", + "exclusiveMaximum", + "minimum", + "exclusiveMinimum", + "maxLength", + "minLength", + "pattern", + "maxItems", + "minItems", + "uniqueItems", + "maxContains", + "minContains", + "maxProperties", + "minProperties", + "required", + "dependentRequired" + ], "$defs": { "nonNegativeInteger": { "type": "integer", diff --git a/meta/vocabulary.json b/meta/vocabulary.json new file mode 100644 index 00000000..df78a175 --- /dev/null +++ b/meta/vocabulary.json @@ -0,0 +1,66 @@ +{ + "$schema": "https://json-schema.org/draft/next/schema", + "$id": "https://json-schema.org/draft/next/meta/vocabulary", + "$vocabulary": { + "https://json-schema.org/draft/next/vocab/core": true, + "https://json-schema.org/draft/next/vocab/vocabulary": true, + }, + + "title": "Vocabulary meta-data vocabulary meta-schema", + "description": "Defines keywords for use in vocabulary meta-schemas to provide additional information for their keywords", + "type": [ "object", "boolean" ], + "properties": { + "applicators": { + "type": "object", + "additionalProperties": { + "oneOf": [ + {"$ref": "#/$defs/applicatorKind"}, + { + "type": "array", + "items": { "$ref": "#/$defs/applicatorKind" }, + "minItems": 1, + "uniqueItems": true + } + ], + } + }, + "assertions": { + "type": "array", + "items": { "type": "string" } + }, + "annotations": { + "type": "object", + "properties": { + "kind": { + "type": "object", + "additionalProperties": { + "oneOf": [ + { "$ref": "#/$defs/annotationKind" }, + { + "type": "array", + "items": { "$ref": "#/$defs/annotationKind" }, + "minItems": 1, + "uniqueItems": true + } + ], + } + }, + "producedValue": true + }, + "required": [ "kind" ] + } + }, + "annotations": { + "applicators": { "kind": "producer" }, + "assertions": { "kind": "producer" }, + "annotations": { "kind": "producer" } + }, + "$defs": { + "applicatorKind": { + "enum": [ "objectChild", "arrayChild", "inPlace" ] + }, + "annotationKind": { + "enum": [ "producer", "collector" ] + } + } +} \ No newline at end of file From 56cb798ee1b8315f0c170f39e7c943f4e1a39302 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Thu, 14 Jul 2022 13:49:00 +1200 Subject: [PATCH 2/5] set the vocab vocab requirement to false --- meta/applicator.json | 2 +- meta/content.json | 2 +- meta/format-annotation.json | 2 +- meta/format-assertion.json | 2 +- meta/meta-data.json | 2 +- meta/unevaluated.json | 2 +- meta/validation.json | 2 +- meta/vocabulary.json | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/meta/applicator.json b/meta/applicator.json index 18cffe7d..10253425 100644 --- a/meta/applicator.json +++ b/meta/applicator.json @@ -3,7 +3,7 @@ "$id": "https://json-schema.org/draft/next/meta/applicator", "$vocabulary": { "https://json-schema.org/draft/next/vocab/applicator": true, - "https://json-schema.org/draft/next/vocab/vocabulary": true + "https://json-schema.org/draft/next/vocab/vocabulary": false }, "$dynamicAnchor": "meta", diff --git a/meta/content.json b/meta/content.json index 0dae9a3a..0fbf2219 100644 --- a/meta/content.json +++ b/meta/content.json @@ -3,7 +3,7 @@ "$id": "https://json-schema.org/draft/next/meta/content", "$vocabulary": { "https://json-schema.org/draft/next/vocab/content": true, - "https://json-schema.org/draft/next/vocab/vocabulary": true + "https://json-schema.org/draft/next/vocab/vocabulary": false }, "$dynamicAnchor": "meta", diff --git a/meta/format-annotation.json b/meta/format-annotation.json index 9b89fd94..7996a4a2 100644 --- a/meta/format-annotation.json +++ b/meta/format-annotation.json @@ -3,7 +3,7 @@ "$id": "https://json-schema.org/draft/next/meta/format-annotation", "$vocabulary": { "https://json-schema.org/draft/next/vocab/format-annotation": true, - "https://json-schema.org/draft/next/vocab/vocabulary": true + "https://json-schema.org/draft/next/vocab/vocabulary": false }, "$dynamicAnchor": "meta", diff --git a/meta/format-assertion.json b/meta/format-assertion.json index 171b5efb..76aef23f 100644 --- a/meta/format-assertion.json +++ b/meta/format-assertion.json @@ -3,7 +3,7 @@ "$id": "https://json-schema.org/draft/next/meta/format-assertion", "$vocabulary": { "https://json-schema.org/draft/next/vocab/format-assertion": true, - "https://json-schema.org/draft/next/vocab/vocabulary": true + "https://json-schema.org/draft/next/vocab/vocabulary": false }, "$dynamicAnchor": "meta", diff --git a/meta/meta-data.json b/meta/meta-data.json index 1de8b942..ec194631 100644 --- a/meta/meta-data.json +++ b/meta/meta-data.json @@ -3,7 +3,7 @@ "$id": "https://json-schema.org/draft/next/meta/meta-data", "$vocabulary": { "https://json-schema.org/draft/next/vocab/meta-data": true, - "https://json-schema.org/draft/next/vocab/vocabulary": true + "https://json-schema.org/draft/next/vocab/vocabulary": false }, "$dynamicAnchor": "meta", diff --git a/meta/unevaluated.json b/meta/unevaluated.json index 42711837..7d4b9be0 100644 --- a/meta/unevaluated.json +++ b/meta/unevaluated.json @@ -3,7 +3,7 @@ "$id": "https://json-schema.org/draft/next/meta/unevaluated", "$vocabulary": { "https://json-schema.org/draft/next/vocab/unevaluated": true, - "https://json-schema.org/draft/next/vocab/vocabulary": true + "https://json-schema.org/draft/next/vocab/vocabulary": false }, "$dynamicAnchor": "meta", diff --git a/meta/validation.json b/meta/validation.json index fb890bb2..1b767c5c 100644 --- a/meta/validation.json +++ b/meta/validation.json @@ -3,7 +3,7 @@ "$id": "https://json-schema.org/draft/next/meta/validation", "$vocabulary": { "https://json-schema.org/draft/next/vocab/validation": true, - "https://json-schema.org/draft/next/vocab/vocabulary": true + "https://json-schema.org/draft/next/vocab/vocabulary": false }, "$dynamicAnchor": "meta", diff --git a/meta/vocabulary.json b/meta/vocabulary.json index df78a175..a75b6e85 100644 --- a/meta/vocabulary.json +++ b/meta/vocabulary.json @@ -3,7 +3,7 @@ "$id": "https://json-schema.org/draft/next/meta/vocabulary", "$vocabulary": { "https://json-schema.org/draft/next/vocab/core": true, - "https://json-schema.org/draft/next/vocab/vocabulary": true, + "https://json-schema.org/draft/next/vocab/vocabulary": false }, "title": "Vocabulary meta-data vocabulary meta-schema", From 390c728d7d1bda1054d13500c41d48434a9651c8 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Thu, 14 Jul 2022 14:22:04 +1200 Subject: [PATCH 3/5] the value of producedValue is a schema --- meta/vocabulary.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/vocabulary.json b/meta/vocabulary.json index a75b6e85..1264090d 100644 --- a/meta/vocabulary.json +++ b/meta/vocabulary.json @@ -45,7 +45,7 @@ ], } }, - "producedValue": true + "producedValue": { "$dynamicRef": "#meta" } }, "required": [ "kind" ] } From 39aaea77927aacec30d30c92375deb889bd1e960 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Thu, 14 Jul 2022 14:22:27 +1200 Subject: [PATCH 4/5] remove trailing commas --- meta/vocabulary.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/vocabulary.json b/meta/vocabulary.json index 1264090d..d4250bf7 100644 --- a/meta/vocabulary.json +++ b/meta/vocabulary.json @@ -21,7 +21,7 @@ "minItems": 1, "uniqueItems": true } - ], + ] } }, "assertions": { @@ -42,7 +42,7 @@ "minItems": 1, "uniqueItems": true } - ], + ] } }, "producedValue": { "$dynamicRef": "#meta" } From 6ae0b07bf986c1daa2fcc3c67245a161154e9f72 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Fri, 30 Sep 2022 10:57:34 +1300 Subject: [PATCH 5/5] use vocab metaschemas right --- meta/applicator.json | 5 ++--- meta/content.json | 5 ++--- meta/format-annotation.json | 5 ++--- meta/format-assertion.json | 5 ++--- meta/meta-data.json | 5 ++--- meta/unevaluated.json | 5 ++--- meta/validation.json | 5 ++--- meta/vocabulary.json | 6 ++++++ 8 files changed, 20 insertions(+), 21 deletions(-) diff --git a/meta/applicator.json b/meta/applicator.json index 10253425..db15f364 100644 --- a/meta/applicator.json +++ b/meta/applicator.json @@ -1,9 +1,8 @@ { - "$schema": "https://json-schema.org/draft/next/schema", + "$schema": "https://json-schema.org/draft/next/meta/vocabulary", "$id": "https://json-schema.org/draft/next/meta/applicator", "$vocabulary": { - "https://json-schema.org/draft/next/vocab/applicator": true, - "https://json-schema.org/draft/next/vocab/vocabulary": false + "https://json-schema.org/draft/next/vocab/applicator": true }, "$dynamicAnchor": "meta", diff --git a/meta/content.json b/meta/content.json index 0fbf2219..32295cde 100644 --- a/meta/content.json +++ b/meta/content.json @@ -1,9 +1,8 @@ { - "$schema": "https://json-schema.org/draft/next/schema", + "$schema": "https://json-schema.org/draft/next/meta/vocabulary", "$id": "https://json-schema.org/draft/next/meta/content", "$vocabulary": { - "https://json-schema.org/draft/next/vocab/content": true, - "https://json-schema.org/draft/next/vocab/vocabulary": false + "https://json-schema.org/draft/next/vocab/content": true }, "$dynamicAnchor": "meta", diff --git a/meta/format-annotation.json b/meta/format-annotation.json index 7996a4a2..a13d6650 100644 --- a/meta/format-annotation.json +++ b/meta/format-annotation.json @@ -1,9 +1,8 @@ { - "$schema": "https://json-schema.org/draft/next/schema", + "$schema": "https://json-schema.org/draft/next/meta/vocabulary", "$id": "https://json-schema.org/draft/next/meta/format-annotation", "$vocabulary": { - "https://json-schema.org/draft/next/vocab/format-annotation": true, - "https://json-schema.org/draft/next/vocab/vocabulary": false + "https://json-schema.org/draft/next/vocab/format-annotation": true }, "$dynamicAnchor": "meta", diff --git a/meta/format-assertion.json b/meta/format-assertion.json index 76aef23f..8730c532 100644 --- a/meta/format-assertion.json +++ b/meta/format-assertion.json @@ -1,9 +1,8 @@ { - "$schema": "https://json-schema.org/draft/next/schema", + "$schema": "https://json-schema.org/draft/next/meta/vocabulary", "$id": "https://json-schema.org/draft/next/meta/format-assertion", "$vocabulary": { - "https://json-schema.org/draft/next/vocab/format-assertion": true, - "https://json-schema.org/draft/next/vocab/vocabulary": false + "https://json-schema.org/draft/next/vocab/format-assertion": true }, "$dynamicAnchor": "meta", diff --git a/meta/meta-data.json b/meta/meta-data.json index ec194631..a4aa8386 100644 --- a/meta/meta-data.json +++ b/meta/meta-data.json @@ -1,9 +1,8 @@ { - "$schema": "https://json-schema.org/draft/next/schema", + "$schema": "https://json-schema.org/draft/next/meta/vocabulary", "$id": "https://json-schema.org/draft/next/meta/meta-data", "$vocabulary": { - "https://json-schema.org/draft/next/vocab/meta-data": true, - "https://json-schema.org/draft/next/vocab/vocabulary": false + "https://json-schema.org/draft/next/vocab/meta-data": true }, "$dynamicAnchor": "meta", diff --git a/meta/unevaluated.json b/meta/unevaluated.json index 7d4b9be0..4a5263a2 100644 --- a/meta/unevaluated.json +++ b/meta/unevaluated.json @@ -1,9 +1,8 @@ { - "$schema": "https://json-schema.org/draft/next/schema", + "$schema": "https://json-schema.org/draft/next/meta/vocabulary", "$id": "https://json-schema.org/draft/next/meta/unevaluated", "$vocabulary": { - "https://json-schema.org/draft/next/vocab/unevaluated": true, - "https://json-schema.org/draft/next/vocab/vocabulary": false + "https://json-schema.org/draft/next/vocab/unevaluated": true }, "$dynamicAnchor": "meta", diff --git a/meta/validation.json b/meta/validation.json index 1b767c5c..e6d5ccff 100644 --- a/meta/validation.json +++ b/meta/validation.json @@ -1,9 +1,8 @@ { - "$schema": "https://json-schema.org/draft/next/schema", + "$schema": "https://json-schema.org/draft/next/meta/vocabulary", "$id": "https://json-schema.org/draft/next/meta/validation", "$vocabulary": { - "https://json-schema.org/draft/next/vocab/validation": true, - "https://json-schema.org/draft/next/vocab/vocabulary": false + "https://json-schema.org/draft/next/vocab/validation": true }, "$dynamicAnchor": "meta", diff --git a/meta/vocabulary.json b/meta/vocabulary.json index d4250bf7..c04a44c2 100644 --- a/meta/vocabulary.json +++ b/meta/vocabulary.json @@ -3,6 +3,12 @@ "$id": "https://json-schema.org/draft/next/meta/vocabulary", "$vocabulary": { "https://json-schema.org/draft/next/vocab/core": true, + "https://json-schema.org/draft/next/vocab/applicator": true, + "https://json-schema.org/draft/next/vocab/unevaluated": true, + "https://json-schema.org/draft/next/vocab/validation": true, + "https://json-schema.org/draft/next/vocab/meta-data": true, + "https://json-schema.org/draft/next/vocab/format-annotation": true, + "https://json-schema.org/draft/next/vocab/content": true, "https://json-schema.org/draft/next/vocab/vocabulary": false },