From 8426e4eed5dc9c392565f95aeba84cc4e47e438e Mon Sep 17 00:00:00 2001 From: Clemens Vasters Date: Thu, 13 Aug 2026 09:29:40 +0200 Subject: [PATCH] Require type keyword in if/then/else example; fix $uses key name to JSONStructureConditionalComposition --- draft-vasters-json-structure-cond-composition.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/draft-vasters-json-structure-cond-composition.md b/draft-vasters-json-structure-cond-composition.md index 60d6053..e8595dd 100644 --- a/draft-vasters-json-structure-cond-composition.md +++ b/draft-vasters-json-structure-cond-composition.md @@ -262,18 +262,21 @@ Consider the following schema: ~~~json { "if": { + "type": "object", "properties": { "a": { "type": "string" } }, "required": ["a"] }, "then": { + "type": "object", "properties": { "b": { "type": "number" } }, "required": ["b"] }, "else": { + "type": "object", "properties": { "c": { "type": "boolean" } }, @@ -282,6 +285,12 @@ Consider the following schema: } ~~~ +As with every other schema object introduced by this document (`allOf`, +`anyOf`, `oneOf`, `not`), each of `if`, `then`, and `else` is itself a schema +object under JSON Structure Core {{JSTRUCT-CORE}} and MUST carry a `type` +keyword; `properties` alone does not establish that the node is constrained +to be an `object`. + Here, a JSON node evaluates to `true` if it is an object with a property `a` that is a string; then it must also have a property `b` that is a number: ~~~json @@ -311,7 +320,7 @@ or ## Enabling the Extensions {#enabling-the-extensions} The conditional composition extensions can be enabled in a schema or meta-schema -by adding the `JSONSchemaConditionalComposition` key to the `$uses` clause when +by adding the `JSONStructureConditionalComposition` key to the `$uses` clause when referencing the extended meta-schema: ~~~ json @@ -319,7 +328,7 @@ referencing the extended meta-schema: "$schema": "https://json-structure.org/meta/extended/v0/#", "$id": "myschema", "$uses": [ - "JSONSchemaConditionalComposition" + "JSONStructureConditionalComposition" ], "oneOf" : [ { "type": "string" },