diff --git a/workflow/spec/schema/serverless-workflow-schema-01.json b/workflow/spec/schema/serverless-workflow-schema-01.json index 5a884e6..96e8367 100644 --- a/workflow/spec/schema/serverless-workflow-schema-01.json +++ b/workflow/spec/schema/serverless-workflow-schema-01.json @@ -7,7 +7,6 @@ "id": { "type": "string", "description": "Workflow unique identifier", - "pattern": "$[a-zA-Z0-9\\-\\.]+^", "minLength": 1 }, "name": { @@ -171,7 +170,7 @@ "$ref": "#/definitions/filter" } }, - "required": ["eventExpression", "timeout", "nextState"] + "required": ["eventExpression", "actions", "timeout", "nextState"] }, "action": { "type": "object", @@ -192,7 +191,8 @@ "filter": { "$ref": "#/definitions/filter" } - } + }, + "required": ["function"] }, "retry": { "type": "object", @@ -217,7 +217,8 @@ "description": "State to transition to when exceeding max-retry limit", "minLength": 1 } - } + }, + "required": ["match", "nextState"] }, "function": { "type": "object", @@ -238,7 +239,8 @@ "type": "object", "description": "Function parameters" } - } + }, + "required": ["name", "type"] }, "branch": { "type": "object", @@ -325,6 +327,17 @@ "type": "string", "description": "State to transition to after all the delay." } + }, + "if": { + "properties": { + "end": { "const": true } + } + }, + "then": { + "required": ["name", "type", "timeDelay", "end"] + }, + "else": { + "required": ["name", "type", "timeDelay", "nextState"] } }, "eventstate": { @@ -363,7 +376,8 @@ "$ref": "#/definitions/event" } } - } + }, + "required": ["name", "type", "events"] }, "operationstate": { "type": "object", @@ -413,6 +427,17 @@ "type": "string", "description": "State to transition to after all the actions have been successfully executed" } + }, + "if": { + "properties": { + "end": { "const": true } + } + }, + "then": { + "required": ["name", "type", "actionMode", "actions"] + }, + "else": { + "required": ["name", "type", "actionMode", "actions", "nextState"] } }, "parallelstate": { @@ -455,6 +480,17 @@ "type": "string", "description": "State to transition to after all branches have completed execution" } + }, + "if": { + "properties": { + "end": { "const": true } + } + }, + "then": { + "required": ["name", "type", "branches"] + }, + "else": { + "required": ["name", "type", "branches", "nextState"] } }, "switchstate": { @@ -514,6 +550,17 @@ "type": "string", "description": "Specifies the name of the next state if there is no match for any choices value" } + }, + "if": { + "properties": { + "end": { "const": true } + } + }, + "then": { + "required": ["name", "type", "choices"] + }, + "else": { + "required": ["name", "type", "choices", "default"] } }, "subflowstate": { @@ -530,8 +577,10 @@ "description": "State name" }, "type": { - "type" : "string", - "enum": ["SUBFLOW"], + "type": "string", + "enum": [ + "SUBFLOW" + ], "description": "State type" }, "end": { @@ -556,7 +605,17 @@ "description": "Specifies the name of the next state to transition to after sub-workflow has completed execution." } }, - "required": ["name", "type", "nextState", "workflowId"] + "if": { + "properties": { + "end": { "const": true } + } + }, + "then": { + "required": ["name", "type", "workflowId"] + }, + "else": { + "required": ["name", "type", "workflowId", "nextState"] + } }, "defaultchoice": { "type": "object", @@ -604,7 +663,8 @@ "type": "string", "description": "State to transition to if there is a value match" } - } + }, + "required": ["single", "nextState"] }, "andchoice": { "type": "object", @@ -622,7 +682,8 @@ "type": "string", "description": "State to transition to if there is a value match" } - } + }, + "required": ["and", "nextState"] }, "orchoice": { "type": "object", @@ -640,7 +701,8 @@ "type": "string", "description": "State to transition to if there is a value match" } - } + }, + "required": ["or", "nextState"] }, "notchoice": { "type": "object", @@ -655,7 +717,8 @@ "type": "string", "description": "State to transition to if there is a value match" } - } + }, + "required": ["not", "nextState"] } } } \ No newline at end of file diff --git a/workflow/spec/spec.md b/workflow/spec/spec.md index dbfe91d..56b15f2 100644 --- a/workflow/spec/spec.md +++ b/workflow/spec/spec.md @@ -306,7 +306,7 @@ We will start defining each individual state: "$ref": "#/definitions/filter" } }, - "required": ["name", "type", "events", "filter"] + "required": ["name", "type", "events"] } ``` @@ -362,7 +362,7 @@ Event state can hold one or more events definitions, so let's define those: "description": "State to transition to after all the actions for the matching event have been successfully executed" } }, - "required": ["event-expression", "actions", "filter", "nextState"] + "required": ["eventExpression", "actions", "nextState"] } ``` @@ -409,7 +409,7 @@ Each event state's event definition includes one or more actions. Let's define t "$ref": "#/definitions/filter" } }, - "required": ["function", "filter"] + "required": ["function"] } ``` @@ -513,7 +513,7 @@ as well as define parameters (key/value pairs). | actionMode |Should actions be executed sequentially or in parallel | string | yes | | [actions](#Action-Definition) |Array of actions | array | yes | | [filter](#Filter-Definition) |State data filter | object | yes | -| [nextState](#Transitions) |State to transition to after all the actions have been successfully executed | string | yes | +| [nextState](#Transitions) |State to transition to after all the actions have been successfully executed | string | yes (if end is set to false) |
Click to view JSON Schema @@ -562,7 +562,17 @@ as well as define parameters (key/value pairs). "description": "State to transition to after all the actions have been successfully executed" } }, - "required": ["name", "type", "actionMode", "actions", "filter", "nextState"] + "if": { + "properties": { + "end": { "const": true } + } + }, + "then": { + "required": ["name", "type", "actionMode", "actions"] + }, + "else": { + "required": ["name", "type", "actionMode", "actions", "nextState"] + } } ``` @@ -583,7 +593,7 @@ actions execute, a transition to "next state" happens. | end |Is this state an end start | boolean | no | | [choices](#switch-state-choices) |Ordered set of matching rules to determine which state to trigger next | array | yes | | [filter](#Filter-Definition) |State data filter | object | yes | -| default |Name of the next state if there is no match for any choices value | string | yes | +| default |Name of the next state if there is no match for any choices value | string | yes (if end is set to false) |
Click to view JSON Schema @@ -632,7 +642,17 @@ actions execute, a transition to "next state" happens. "description": "Specifies the name of the next state if there is no match for any choices value" } }, - "required": ["name", "type", "choices", "filter", "default"] + "if": { + "properties": { + "end": { "const": true } + } + }, + "then": { + "required": ["name", "type", "choices"] + }, + "else": { + "required": ["name", "type", "choices", "default"] + } } ``` @@ -839,7 +859,7 @@ There are found types of choices defined: | end |If this state an end state | boolean | no | | timeDelay |Amount of time (ISO 8601 format) to delay when in this state. For example: "PT15M" (delay 15 minutes), or "P2DT3H4M" (delay 2 days, 3 hours and 4 minutes) | integer | yes | | [filter](#Filter-Definition) |State data filter | object | yes | -| [nextState](#Transitions) |State to transition to after the delay | string | yes | +| [nextState](#Transitions) |State to transition to after the delay | string | yes (if end is set to false) |
Click to view JSON Schema @@ -879,7 +899,17 @@ There are found types of choices defined: "description": "Name of the next state to transition to after the delay" } }, - "required": ["name", "type", "timeDelay", "nextState"] + "if": { + "properties": { + "end": { "const": true } + } + }, + "then": { + "required": ["name", "type", "timeDelay", "end"] + }, + "else": { + "required": ["name", "type", "timeDelay", "nextState"] + } } ``` @@ -898,7 +928,7 @@ Delay state simple waits for a certain amount of time before transitioning to a | end |If this state and end state | boolean | no | | [branches](#parallel-state-branch) |List of branches for this parallel state| array | yes | | [filter](#Filter-Definition) |State data filter | object | yes | -| [nextState](#Transitions) |State to transition to after all branches have completed execution | string | yes | +| [nextState](#Transitions) |State to transition to after all branches have completed execution | string | yes (if end is set to false) |
Click to view JSON Schema @@ -942,7 +972,17 @@ Delay state simple waits for a certain amount of time before transitioning to a "description": "Specifies the name of the next state to transition to after all branches have completed execution" } }, - "required": ["name", "type", "branches", "filter", "nextState"] + "if": { + "properties": { + "end": { "const": true } + } + }, + "then": { + "required": ["name", "type", "branches"] + }, + "else": { + "required": ["name", "type", "branches", "nextState"] + } } ``` @@ -1024,7 +1064,7 @@ true, the branches parallel parent state must wait for this branch to finish bef | waitForCompletion |If workflow execution must wait for sub-workflow to finish before continuing | boolean | yes | | workflowId |Sub-workflow unique id | boolean | no | | [filter](#Filter-Definition) |State data filter | object | yes | -| [nextState](#Transitions) |State to transition to after subflow has completed | string | yes | +| [nextState](#Transitions) |State to transition to after subflow has completed | string | yes (if end is set to false) |
Click to view JSON Schema @@ -1070,7 +1110,17 @@ true, the branches parallel parent state must wait for this branch to finish bef "description": "State to transition to after subflow has completed." } }, - "required": ["name", "type", "nextState", "workflowId"] + "if": { + "properties": { + "end": { "const": true } + } + }, + "then": { + "required": ["name", "type", "workflowId"] + }, + "else": { + "required": ["name", "type", "workflowId", "nextState"] + } } ```