From cce4daaf4c5a7c3aa192f50df045719376f418a2 Mon Sep 17 00:00:00 2001 From: xibz Date: Wed, 11 Feb 2026 12:39:52 -0600 Subject: [PATCH] update(link): Relax link schemas to support domain-level identifiers This change updates all link schemas (START, END, RELATION, and embedded variants) to allow references to either a CDEvent contextId, a domainId, or both. Previously, links could only reference event context IDs. This limited cross-system connectivity and encouraged embedding execution identifiers in customData purely for graph reconstruction. By allowing domainId alongside contextId: - Links can represent relationships between domain executions (e.g., pipelinerun) as well as individual events. - Connectivity metadata no longer needs to be embedded in event payloads. - Chain-first modeling constraints are relaxed, enabling relation-first graph modeling. - The change remains backward compatible. At least one of contextId or domainId is now required for link endpoints. AdditionalProperties are restricted to prevent schema drift. This preserves existing semantics while improving flexibility and reducing customData pollution. Signed-off-by: xibz --- schemas/links/embeddedlinkend.json | 20 +++++++------ schemas/links/embeddedlinkpath.json | 21 ++++++++------ schemas/links/embeddedlinkrelation.json | 21 +++++++++----- schemas/links/linkend.json | 37 +++++++++++++++---------- schemas/links/linkrelation.json | 36 +++++++++++++++--------- schemas/links/linkstart.json | 26 +++++++++-------- 6 files changed, 100 insertions(+), 61 deletions(-) diff --git a/schemas/links/embeddedlinkend.json b/schemas/links/embeddedlinkend.json index f9a4bf4..6a94ac6 100644 --- a/schemas/links/embeddedlinkend.json +++ b/schemas/links/embeddedlinkend.json @@ -1,24 +1,30 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://cdevents.dev/0.6.0-draft/schema/links/embeddedlinkend", + "type": "object", + "additionalProperties": false, "properties": { "linkType": { "type": "string", - "enum": [ - "END" - ] + "enum": ["END"] }, "from": { - "description": "When consuming a CDEvent, you are consuming a parent event. So, when looking at the 'from' key, this is the parent's parent.", + "description": "Identifies the upstream entity of the END link. May reference a CDEvent context ID, a domain execution ID, or both.", "type": "object", + "additionalProperties": false, "properties": { "contextId": { "type": "string", "minLength": 1 + }, + "domainId": { + "type": "string", + "minLength": 1 } }, - "required": [ - "contextId" + "anyOf": [ + { "required": ["contextId"] }, + { "required": ["domainId"] } ] }, "tags": { @@ -26,8 +32,6 @@ "additionalProperties": true } }, - "additionalProperties": false, - "type": "object", "required": [ "linkType" ] diff --git a/schemas/links/embeddedlinkpath.json b/schemas/links/embeddedlinkpath.json index d783aa4..41fa4d8 100644 --- a/schemas/links/embeddedlinkpath.json +++ b/schemas/links/embeddedlinkpath.json @@ -1,24 +1,30 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://cdevents.dev/0.6.0-draft/schema/links/embeddedlinkpath", + "type": "object", + "additionalProperties": false, "properties": { "linkType": { "type": "string", - "enum": [ - "PATH" - ] + "enum": ["PATH"] }, "from": { - "description": "When consuming a CDEvent, you are consuming a parent event. So, when looking at the 'from' key, this is the parent's parent.", + "description": "Identifies the upstream parent in the path. May reference a CDEvent context ID, a domain execution ID, or both.", "type": "object", + "additionalProperties": false, "properties": { "contextId": { "type": "string", "minLength": 1 + }, + "domainId": { + "type": "string", + "minLength": 1 } }, - "required": [ - "contextId" + "anyOf": [ + { "required": ["contextId"] }, + { "required": ["domainId"] } ] }, "tags": { @@ -26,10 +32,9 @@ "additionalProperties": true } }, - "additionalProperties": false, - "type": "object", "required": [ "linkType", "from" ] } + diff --git a/schemas/links/embeddedlinkrelation.json b/schemas/links/embeddedlinkrelation.json index aa5d438..5b4de33 100644 --- a/schemas/links/embeddedlinkrelation.json +++ b/schemas/links/embeddedlinkrelation.json @@ -1,34 +1,41 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://cdevents.dev/0.6.0-draft/schema/links/embeddedlinkrelation", + "type": "object", + "additionalProperties": false, "properties": { "linkType": { "type": "string", - "enum": [ - "RELATION" - ] + "enum": ["RELATION"] }, "linkKind": { "type": "string", "minLength": 1 }, "target": { - "description": "", + "description": "Identifies the target of the relation. May reference a CDEvent context ID, a domain execution ID, or both.", "type": "object", + "additionalProperties": false, "properties": { "contextId": { "type": "string", "minLength": 1 + }, + "domainId": { + "type": "string", + "minLength": 1 } - } + }, + "anyOf": [ + { "required": ["contextId"] }, + { "required": ["domainId"] } + ] }, "tags": { "type": "object", "additionalProperties": true } }, - "additionalProperties": false, - "type": "object", "required": [ "linkType", "linkKind", diff --git a/schemas/links/linkend.json b/schemas/links/linkend.json index 6bc3904..cc79826 100644 --- a/schemas/links/linkend.json +++ b/schemas/links/linkend.json @@ -1,47 +1,59 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://cdevents.dev/0.6.0-draft/schema/links/linkend", + "type": "object", + "additionalProperties": false, "properties": { "chainId": { - "description": "This represents the full lifecycles of a series of events in CDEvents", + "description": "Represents the lifecycle grouping of a series of related events.", "type": "string", "minLength": 1 }, "linkType": { - "description": "The type associated with the link. In this case, 'END', suggesting the end of some CI/CD lifecycle", + "description": "The type associated with the link. In this case, 'END', suggesting the end of some CI/CD lifecycle.", "type": "string", - "enum": [ - "END" - ] + "enum": ["END"] }, "timestamp": { "type": "string", "format": "date-time" }, "from": { - "description": "This is the context ID of the producing CDEvent.", + "description": "Identifies the producing entity of the END link. May reference a CDEvent context ID, a domain execution ID, or both.", "type": "object", + "additionalProperties": false, "properties": { "contextId": { "type": "string", "minLength": 1 + }, + "domainId": { + "type": "string", + "minLength": 1 } }, - "required": [ - "contextId" + "anyOf": [ + { "required": ["contextId"] }, + { "required": ["domainId"] } ] }, "end": { - "description": "This is the context ID of the final CDEvent in the chain", + "description": "Identifies the final entity in the lifecycle. May reference a CDEvent context ID, a domain execution ID, or both.", "type": "object", + "additionalProperties": false, "properties": { "contextId": { "type": "string", "minLength": 1 + }, + "domainId": { + "type": "string", + "minLength": 1 } }, - "required": [ - "contextId" + "anyOf": [ + { "required": ["contextId"] }, + { "required": ["domainId"] } ] }, "tags": { @@ -49,10 +61,7 @@ "additionalProperties": true } }, - "additionalProperties": false, - "type": "object", "required": [ - "chainId", "linkType", "timestamp", "from", diff --git a/schemas/links/linkrelation.json b/schemas/links/linkrelation.json index d597264..9890eb4 100644 --- a/schemas/links/linkrelation.json +++ b/schemas/links/linkrelation.json @@ -1,17 +1,17 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://cdevents.dev/0.6.0-draft/schema/links/linkrelation", + "type": "object", + "additionalProperties": false, "properties": { "chainId": { - "description": "This represents the full lifecycles of a series of events in CDEvents", + "description": "Represents the lifecycle grouping of a series of related events.", "type": "string", "minLength": 1 }, "linkType": { "type": "string", - "enum": [ - "RELATION" - ] + "enum": ["RELATION"] }, "linkKind": { "type": "string", @@ -22,29 +22,41 @@ "format": "date-time" }, "source": { - "description": "", + "description": "Identifies the source of the relation. May reference a CDEvent context ID, a domain execution ID, or both.", "type": "object", + "additionalProperties": false, "properties": { "contextId": { "type": "string", "minLength": 1 + }, + "domainId": { + "type": "string", + "minLength": 1 } }, - "required": [ - "contextId" + "anyOf": [ + { "required": ["contextId"] }, + { "required": ["domainId"] } ] }, "target": { - "description": "", + "description": "Identifies the target of the relation. May reference a CDEvent context ID, a domain execution ID, or both.", "type": "object", + "additionalProperties": false, "properties": { "contextId": { "type": "string", "minLength": 1 + }, + "domainId": { + "type": "string", + "minLength": 1 } }, - "required": [ - "contextId" + "anyOf": [ + { "required": ["contextId"] }, + { "required": ["domainId"] } ] }, "tags": { @@ -52,13 +64,11 @@ "additionalProperties": true } }, - "additionalProperties": false, - "type": "object", "required": [ - "chainId", "linkType", "timestamp", "source", "target" ] } + diff --git a/schemas/links/linkstart.json b/schemas/links/linkstart.json index 1a60021..b6572d5 100644 --- a/schemas/links/linkstart.json +++ b/schemas/links/linkstart.json @@ -1,34 +1,40 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://cdevents.dev/0.6.0-draft/schema/links/linkstart", + "type": "object", + "additionalProperties": false, "properties": { "chainId": { - "description": "This represents the full lifecycles of a series of events in CDEvents", + "description": "Represents the lifecycle grouping of a series of related events.", "type": "string", "minLength": 1 }, "linkType": { - "description": "The type associated with the link. In this case, 'START', suggesting the start of some CI/CD lifecycle", + "description": "The type associated with the link. In this case, 'START', suggesting the start of some lifecycle.", "type": "string", - "enum": [ - "START" - ] + "enum": ["START"] }, "timestamp": { "type": "string", "format": "date-time" }, "start": { - "description": "This is the context ID of the starting CDEvent in the chain.", + "description": "Identifies the starting point of the link. May reference a CDEvent context ID, a domain execution ID, or both.", "type": "object", + "additionalProperties": false, "properties": { "contextId": { "type": "string", "minLength": 1 + }, + "domainId": { + "type": "string", + "minLength": 1 } }, - "required": [ - "contextId" + "anyOf": [ + { "required": ["contextId"] }, + { "required": ["domainId"] } ] }, "tags": { @@ -36,12 +42,10 @@ "additionalProperties": true } }, - "additionalProperties": false, - "type": "object", "required": [ - "chainId", "linkType", "timestamp", "start" ] } +