diff --git a/client/schemas/blueprint-spec2-schema.json b/client/schemas/blueprint-spec2-schema.json index f20967d..7685831 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,138 @@ } } }, + "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" + ], + "if": { + "properties": { + "type": { + "const": "approval" + } + } + }, + "then": { + "required": ["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" + ], + "if": { + "properties": { + "type": { + "const": "group" + } + } + }, + "then": { + "required": ["groups"], + "properties": { + "groups": true, + "users": false, + "names": false + } + }, + "else": { + "if": { + "properties": { + "type": { + "const": "user" + } + } + }, + "then": { + "required": ["users"], + "properties": { + "groups": false, + "users": true, + "names": false + } + }, + "else": { + "if": { + "properties": { + "type": { + "const": "account_channels" + } + } + }, + "then": { + "required": ["names"], + "properties": { + "groups": false, + "users": false, + "names": true + } + } + } + } + }, + "GrainConditionChannelApproversObject": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string", + "maxLength": 250 + } + }, + { + "type": "string" + } + ] + }, "EnvironmentLabel": { "type": "object", "additionalProperties": false,