From 2065cac9e43f4491b53c3d989a7838d88896ce32 Mon Sep 17 00:00:00 2001 From: KateTretiak <92021119+KateTretiak@users.noreply.github.com> Date: Wed, 4 Mar 2026 18:47:35 +0200 Subject: [PATCH 1/5] add conditions to the schema --- client/schemas/blueprint-spec2-schema.json | 92 ++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/client/schemas/blueprint-spec2-schema.json b/client/schemas/blueprint-spec2-schema.json index f20967d..630180c 100644 --- a/client/schemas/blueprint-spec2-schema.json +++ b/client/schemas/blueprint-spec2-schema.json @@ -252,6 +252,9 @@ "aws-cdk" ] }, + "condition": { + "$ref": "#/definitions/GrainConditions" + }, "env-labels": { "$ref": "#/definitions/GrainLabels" }, @@ -797,6 +800,95 @@ } } }, + "GrainConditions": { + "type":"array", + "additionalProperties": false, + "maxLength": 1, + "items": { + "$ref": "#/definitions/GrainConditionObject" + } + }, + "GrainConditionObject": { + "type":"object", + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "enum": [ + "approval" + ] + }, + "message": { + "type": "string" + }, + "channels": { + "type": "array", + "additionalProperties": false, + "items": { + "$ref": "#/definitions/GrainConditionChannelObject" + } + } + }, + "required": [ + "type" + ], + "dependentRequired": { + "approval": [ + "channels" + ] + } + }, + "GrainConditionChannelObject": { + "type": "object", + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "enum": [ + "group", + "user", + "account_channels" + ] + } + }, + "groups": { + "$ref": "#/definitions/GrainConditionChannelApproversObject" + }, + "users": { + "$ref": "#/definitions/GrainConditionChannelApproversObject" + }, + "names": { + "$ref": "#/definitions/GrainConditionChannelApproversObject" + }, + "required": [ + "type" + ], + "dependentRequired": { + "group": [ + "groups" + ], + "user": [ + "users" + ], + "account_channels": [ + "names" + ] + } + }, + "GrainConditionChannelApproversObject": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string", + "maxLength": 250 + } + }, + { + "type": "string" + } + ] + }, "EnvironmentLabel": { "type": "object", "additionalProperties": false, From 871a7bc0993bb1dee7e0fd090c83d5ffb0d26515 Mon Sep 17 00:00:00 2001 From: KateTretiak <92021119+KateTretiak@users.noreply.github.com> Date: Wed, 4 Mar 2026 18:59:40 +0200 Subject: [PATCH 2/5] fix fields --- client/schemas/blueprint-spec2-schema.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/client/schemas/blueprint-spec2-schema.json b/client/schemas/blueprint-spec2-schema.json index 630180c..550f26b 100644 --- a/client/schemas/blueprint-spec2-schema.json +++ b/client/schemas/blueprint-spec2-schema.json @@ -849,17 +849,17 @@ "user", "account_channels" ] + }, + "groups": { + "$ref": "#/definitions/GrainConditionChannelApproversObject" + }, + "users": { + "$ref": "#/definitions/GrainConditionChannelApproversObject" + }, + "names": { + "$ref": "#/definitions/GrainConditionChannelApproversObject" } }, - "groups": { - "$ref": "#/definitions/GrainConditionChannelApproversObject" - }, - "users": { - "$ref": "#/definitions/GrainConditionChannelApproversObject" - }, - "names": { - "$ref": "#/definitions/GrainConditionChannelApproversObject" - }, "required": [ "type" ], From ff83c52f5dcd28587d5d21fdd8e912270b833fed Mon Sep 17 00:00:00 2001 From: KateTretiak <92021119+KateTretiak@users.noreply.github.com> Date: Wed, 4 Mar 2026 19:05:42 +0200 Subject: [PATCH 3/5] fix dependencies --- client/schemas/blueprint-spec2-schema.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/schemas/blueprint-spec2-schema.json b/client/schemas/blueprint-spec2-schema.json index 550f26b..aab2099 100644 --- a/client/schemas/blueprint-spec2-schema.json +++ b/client/schemas/blueprint-spec2-schema.json @@ -832,7 +832,7 @@ "required": [ "type" ], - "dependentRequired": { + "dependencies": { "approval": [ "channels" ] @@ -863,7 +863,7 @@ "required": [ "type" ], - "dependentRequired": { + "dependencies": { "group": [ "groups" ], From 2fbeef984b4bffbf1fd49b40cd4dbb361310df93 Mon Sep 17 00:00:00 2001 From: KateTretiak <92021119+KateTretiak@users.noreply.github.com> Date: Wed, 4 Mar 2026 20:29:36 +0200 Subject: [PATCH 4/5] add check for the types --- client/schemas/blueprint-spec2-schema.json | 56 ++++++++++++++++------ 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/client/schemas/blueprint-spec2-schema.json b/client/schemas/blueprint-spec2-schema.json index aab2099..b6a93b4 100644 --- a/client/schemas/blueprint-spec2-schema.json +++ b/client/schemas/blueprint-spec2-schema.json @@ -832,10 +832,15 @@ "required": [ "type" ], - "dependencies": { - "approval": [ - "channels" - ] + "if": { + "properties": { + "type": { + "const": "approval" + } + } + }, + "then": { + "required": ["channels"] } }, "GrainConditionChannelObject": { @@ -863,16 +868,39 @@ "required": [ "type" ], - "dependencies": { - "group": [ - "groups" - ], - "user": [ - "users" - ], - "account_channels": [ - "names" - ] + "if": { + "properties": { + "type": { + "const": "group" + } + } + }, + "then": { + "required": ["groups"] + }, + "else": { + "if": { + "properties": { + "type": { + "const": "user" + } + } + }, + "then": { + "required": ["users"] + }, + "else": { + "if": { + "properties": { + "type": { + "const": "account_channels" + } + } + }, + "then": { + "required": ["names"] + } + } } }, "GrainConditionChannelApproversObject": { From 0b0d5c359ef210a8a73a2d9fce659a56fb02e338 Mon Sep 17 00:00:00 2001 From: KateTretiak <92021119+KateTretiak@users.noreply.github.com> Date: Wed, 4 Mar 2026 20:36:29 +0200 Subject: [PATCH 5/5] not allow properties for wrong type --- client/schemas/blueprint-spec2-schema.json | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/client/schemas/blueprint-spec2-schema.json b/client/schemas/blueprint-spec2-schema.json index b6a93b4..7685831 100644 --- a/client/schemas/blueprint-spec2-schema.json +++ b/client/schemas/blueprint-spec2-schema.json @@ -876,7 +876,12 @@ } }, "then": { - "required": ["groups"] + "required": ["groups"], + "properties": { + "groups": true, + "users": false, + "names": false + } }, "else": { "if": { @@ -887,7 +892,12 @@ } }, "then": { - "required": ["users"] + "required": ["users"], + "properties": { + "groups": false, + "users": true, + "names": false + } }, "else": { "if": { @@ -898,7 +908,12 @@ } }, "then": { - "required": ["names"] + "required": ["names"], + "properties": { + "groups": false, + "users": false, + "names": true + } } } }