From 0bff4c8a28618e3513bd790ac96c055b84dfae9b Mon Sep 17 00:00:00 2001 From: Simon Heimler Date: Tue, 29 Apr 2025 15:33:10 +0200 Subject: [PATCH 1/2] Add id keyword to objects to state primary IDs Signed-off-by: Simon Heimler --- draft-vasters-json-structure-core.md | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/draft-vasters-json-structure-core.md b/draft-vasters-json-structure-core.md index 769a613..61e5252 100644 --- a/draft-vasters-json-structure-core.md +++ b/draft-vasters-json-structure-core.md @@ -1051,6 +1051,35 @@ schema definition, including in type unions. `$ref` is NOT permitted in other attributes and MUST NOT be used inside the `type` of the root object. +### `id` Keyword {#object-id-keyword} + +The `id` keyword is only applicable on objects and states the properties that +make up the primary ID(s) of the object. Providing more than one ID indicates +a composite primary ID, not a list of alternative IDs. + +Example: + +~~~ json +{ + "$schema": "https://json-structure.org/meta/core/v0/#", + "$id": "https://schemas.vasters.com/TypeName", + "definitions": { + "Namespace": { + "TypeName": { + "name": "TypeName", + "type": "object", + "id": ["ID"], + "properties": { + "ID": { "type": "string" } + } + } + } + } +} +~~~ + +The `id` MUST only be used on objects. + ### Cross-references {#cross-references} In JSON Structure documents, the `$schema` keyword references the meta-schema of From 240f7c05cbb9a898b10161c838bff9276682ed81 Mon Sep 17 00:00:00 2001 From: Simon Heimler Date: Tue, 29 Apr 2025 15:42:30 +0200 Subject: [PATCH 2/2] Update draft-vasters-json-structure-core.md --- draft-vasters-json-structure-core.md | 1 + 1 file changed, 1 insertion(+) diff --git a/draft-vasters-json-structure-core.md b/draft-vasters-json-structure-core.md index 61e5252..32f7041 100644 --- a/draft-vasters-json-structure-core.md +++ b/draft-vasters-json-structure-core.md @@ -1079,6 +1079,7 @@ Example: ~~~ The `id` MUST only be used on objects. +The value MUST be an array of property names of the current object. ### Cross-references {#cross-references}