UNPKG

@burgan-tech/vnext-schema

Version:

JSON Schema definitions for vNext vNext Workflow components validation

1,281 lines 32 kB
{ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://vnext.io/schemas/workflow-definition.schema.json", "title": "vNext Workflow Definition", "description": "Schema for vNext Workflow Component Definition JSON files (sys-flows flow)", "type": "object", "required": [ "key", "flow", "domain", "version", "tags", "attributes" ], "properties": { "$schema": { "type": "string", "description": "JSON Schema reference" }, "key": { "type": "string", "description": "Workflow key identifier", "pattern": "^[a-z0-9-]+$" }, "flow": { "type": "string", "description": "Flow identifier", "pattern": "^[a-z0-9-]+$" }, "flowVersion": { "type": "string", "description": "Flow version", "pattern": "^\\d+\\.\\d+\\.\\d+$" }, "domain": { "type": "string", "description": "Domain identifier", "pattern": "^[a-z0-9-]+$" }, "version": { "type": "string", "description": "Version in Major.Minor.Patch format", "pattern": "^\\d+\\.\\d+\\.\\d+$" }, "tags": { "type": "array", "description": "Workflow tags", "items": { "type": "string" } }, "_comment": { "type": "string", "description": "Comment about the workflow" }, "attributes": { "type": "object", "required": [ "type", "states", "startTransition", "labels" ], "properties": { "type": { "type": "string", "description": "Workflow type", "enum": [ "C", "F", "S", "P" ], "enumDescriptions": [ "Core", "Flow", "SubFlow", "Sub Process" ] }, "timeout": { "anyOf": [ { "type": "object", "description": "Timeout configuration for the workflow", "required": [ "key", "target", "versionStrategy", "timer" ], "properties": { "_comment": { "type": "string", "description": "Comment about the timeout" }, "key": { "type": "string", "description": "Timeout key identifier", "pattern": "^[a-z0-9-]+$" }, "target": { "type": "string", "description": "Target state for timeout", "pattern": "^[a-z0-9-]+$" }, "versionStrategy": { "$ref": "#/definitions/versionStrategy" }, "timer": { "$ref": "#/definitions/timerConfig" } } }, { "type": "null" } ] }, "labels": { "type": "array", "description": "Multi-language labels", "minItems": 1, "items": { "$ref": "#/definitions/languageLabel" } }, "functions": { "type": "array", "description": "Functions used in the workflow", "items": { "$ref": "#/definitions/reference" } }, "features": { "type": "array", "description": "Features (extensions) used in the workflow", "items": { "$ref": "#/definitions/reference" } }, "sharedTransitions": { "type": "array", "description": "Shared transitions available across multiple states", "items": { "$ref": "#/definitions/sharedTransition" } }, "extensions": { "type": "array", "description": "Extensions used in the workflow", "items": { "$ref": "#/definitions/reference" } }, "startTransition": { "$ref": "#/definitions/startTransition" }, "cancel": { "anyOf": [ { "$ref": "#/definitions/cancelTransition" }, { "type": "null" } ], "description": "Cancel transition definition. Only manual trigger (triggerType: 0) is allowed." }, "states": { "type": "array", "description": "States in the workflow. Only one initial state (stateType: 1) is allowed.", "items": { "$ref": "#/definitions/state" }, "contains": { "properties": { "stateType": { "const": 1 } }, "required": ["stateType"] } } } } }, "definitions": { "viewDefinition": { "anyOf": [ { "type": "object", "properties": { "extensions": { "type": "array", "items": { "type": "string" } }, "loadData": { "type": "boolean" }, "view": { "$ref": "#/definitions/reference" } }, "required": [ "view" ] }, { "type": "null" } ] }, "versionStrategy": { "type": "string", "enum": [ "None", "Patch", "Minor", "Major" ], "enumDescriptions": [ "No version update", "Patch version update", "Minor version update", "Major version update" ], "description": "Version strategy for updates" }, "triggerType": { "type": "integer", "enum": [ 0, 1, 2, 3 ], "enumDescriptions": [ "Manual trigger", "Automatic trigger", "Scheduled trigger", "Event trigger" ], "description": "Type of trigger for the transition" }, "triggerKind": { "type": "integer", "enum": [ 0, 10 ], "enumDescriptions": [ "Not applicable", "Default auto transition" ], "default": 0, "description": "Kind of trigger for automatic transitions" }, "stateType": { "type": "integer", "enum": [ 1, 2, 3, 4, 5 ], "enumDescriptions": [ "Initial state", "Intermediate state", "Final state", "SubFlow state", "Wizard state" ], "description": "Type of workflow state" }, "stateSubType": { "type": "integer", "enum": [ 0, 1, 2, 3, 4 ], "enumDescriptions": [ "No specific subtype", "Successful completion", "Error condition", "Manually terminated", "Temporarily suspended" ], "description": "Subtype of workflow state", "default": 0 }, "languageLabel": { "type": "object", "required": [ "label", "language" ], "properties": { "label": { "type": "string", "description": "Label text" }, "language": { "type": "string", "description": "Language code (ISO 639-1 with optional region code: en, en-US, tr, tr-TR)", "pattern": "^[a-z]{2}(-[A-Z]{2})?$" } } }, "timerConfig": { "type": "object", "required": [ "reset", "duration" ], "properties": { "reset": { "type": "string", "description": "Timer reset strategy" }, "duration": { "type": "string", "description": "Duration in ISO 8601 format", "pattern": "^P(?=\\d|T\\d)(\\d+Y)?(\\d+M)?(\\d+D)?(T(\\d+H)?(\\d+M)?(\\d+S)?)?$" } } }, "reference": { "description": "Generic reference - can be either explicit reference or ref", "oneOf": [ { "type": "object", "description": "Explicit reference", "required": [ "key", "domain", "flow", "version" ], "properties": { "key": { "type": "string" }, "id": { "type": "string" }, "domain": { "type": "string" }, "flow": { "type": "string" }, "version": { "type": "string" } }, "anyOf": [ { "required": [ "key" ] }, { "required": [ "id" ] } ] }, { "type": "object", "description": "Reference using ref", "required": [ "ref" ], "properties": { "ref": { "type": "string", "description": "Reference to component file" } }, "additionalProperties": false } ] }, "scriptCode": { "type": "object", "properties": { "type": { "type": "string", "enum": ["G", "L"], "enumDescriptions": [ "Global", "Local" ], "default": "L", "description": "Script type - Global or Local" }, "code": { "type": "string", "description": "Script code content" }, "location": { "type": "string", "description": "Location of the script file" }, "encoding": { "type": "string", "description": "Code encoding format", "enum": ["B64", "NAT"], "default": "B64" } }, "additionalProperties": false, "if": { "properties": { "type": { "const": "G" } } }, "then": { "required": [] }, "else": { "required": ["code"] } }, "subFlow": { "anyOf": [ { "type": "object", "required": [ "type", "process", "mapping" ], "properties": { "type": { "type": "string", "enum": [ "S", "P" ], "description": "SubFlow type. S=SubFlow, P=SubProcess", "maxLength": 10 }, "process": { "$ref": "#/definitions/reference", "description": "SubFlow process reference" }, "mapping": { "$ref": "#/definitions/scriptCode" }, "viewOverrides": { "type": "object", "description": "Dictionary of view overrides for subflow views. Key is the original view key, value is the reference to the new view definition.", "patternProperties": { "^[a-zA-Z0-9\\-]+$": { "$ref": "#/definitions/reference" } }, "additionalProperties": false } }, "additionalProperties": false }, { "type": "null" } ], "description": "Information about the sub-workflow to be called for SubFlow state type. Can be null if developer does not have a subflow definition." }, "onExecuteTask": { "type": "object", "required": [ "order", "task", "mapping" ], "properties": { "_comment": { "type": "string", "description": "Comment about the task" }, "order": { "type": "integer", "description": "Execution order", "minimum": 1 }, "task": { "$ref": "#/definitions/reference" }, "mapping": { "$ref": "#/definitions/scriptCode" } } }, "transition": { "type": "object", "required": [ "key", "target", "versionStrategy", "triggerType", "labels" ], "allOf": [ { "properties": { "_comment": { "type": "string", "description": "Comment about the transition" }, "key": { "type": "string", "description": "Transition key", "pattern": "^[a-z0-9-]+$" }, "target": { "type": "string", "description": "Target state key. Can be a state key or special keyword like $self", "pattern": "^(\\$self|[a-z0-9-]+)$" }, "from": { "type": "string", "description": "Source state key (optional for shared transitions)", "pattern": "^[a-z0-9-]+$" }, "versionStrategy": { "$ref": "#/definitions/versionStrategy" }, "triggerType": { "$ref": "#/definitions/triggerType" }, "triggerKind": { "$ref": "#/definitions/triggerKind" }, "schema": { "anyOf": [ { "$ref": "#/definitions/reference" }, { "type": "null" } ] }, "rule": { "anyOf": [ { "$ref": "#/definitions/scriptCode" }, { "type": "null" } ] }, "timer": { "anyOf": [ { "$ref": "#/definitions/scriptCode" }, { "type": "null" } ], "description": "Timer information if the transition should execute automatically" }, "labels": { "type": "array", "description": "Multi-language labels", "minItems": 1, "items": { "$ref": "#/definitions/languageLabel" } }, "view": { "$ref": "#/definitions/viewDefinition" }, "onExecutionTasks": { "type": "array", "description": "Tasks to execute during transition", "items": { "$ref": "#/definitions/onExecuteTask" } }, "mapping": { "anyOf": [ { "$ref": "#/definitions/scriptCode" }, { "type": "null" } ], "description": "Input mapping for the transition" } } }, { "if": { "properties": { "triggerType": { "const": 1 }, "triggerKind": { "const": 10 } } }, "then": { "properties": { "rule": { "anyOf": [ { "$ref": "#/definitions/scriptCode" }, { "type": "null" } ] }, "timer": { "type": "null" }, "schema": { "type": "null" }, "view": { "type": "null" }, "mapping": { "type": "null" } } } }, { "if": { "properties": { "triggerType": { "const": 1 } }, "not": { "properties": { "triggerKind": { "const": 10 } } } }, "then": { "required": ["rule"], "properties": { "rule": { "$ref": "#/definitions/scriptCode" }, "timer": { "type": "null" }, "schema": { "type": "null" }, "view": { "type": "null" }, "mapping": { "type": "null" } } } }, { "if": { "properties": { "triggerType": { "const": 2 } } }, "then": { "required": ["timer"], "properties": { "timer": { "$ref": "#/definitions/scriptCode" }, "rule": { "type": "null" }, "schema": { "type": "null" }, "view": { "type": "null" }, "mapping": { "type": "null" } } } }, { "if": { "properties": { "triggerType": { "anyOf": [ { "const": 0 }, { "const": 3 } ] } } }, "then": { "properties": { "timer": { "type": "null" }, "rule": { "type": "null" } } } }, { "if": { "properties": { "triggerType": { "const": 0 } } }, "then": { "properties": { "view": { "anyOf": [ { "$ref": "#/definitions/viewDefinition" }, { "type": "null" } ] } } }, "else": { "properties": { "view": { "type": "null" } } } } ] }, "sharedTransition": { "type": "object", "required": [ "key", "target", "versionStrategy", "triggerType", "labels" ], "allOf": [ { "properties": { "_comment": { "type": "string", "description": "Comment about the shared transition" }, "key": { "type": "string", "description": "Transition key", "pattern": "^[a-z0-9-]+$" }, "target": { "type": "string", "description": "Target state key. Can be a state key or special keyword like $self", "pattern": "^(\\$self|[a-z0-9-]+)$" }, "from": { "type": "string", "description": "Source state key (optional for shared transitions)", "pattern": "^[a-z0-9-]+$" }, "versionStrategy": { "$ref": "#/definitions/versionStrategy" }, "triggerType": { "$ref": "#/definitions/triggerType" }, "triggerKind": { "$ref": "#/definitions/triggerKind" }, "availableIn": { "type": "array", "description": "States where this shared transition is available", "items": { "type": "string" } }, "schema": { "anyOf": [ { "$ref": "#/definitions/reference" }, { "type": "null" } ] }, "rule": { "anyOf": [ { "$ref": "#/definitions/scriptCode" }, { "type": "null" } ] }, "timer": { "anyOf": [ { "$ref": "#/definitions/scriptCode" }, { "type": "null" } ], "description": "Timer information if the transition should execute automatically" }, "labels": { "type": "array", "description": "Multi-language labels", "minItems": 1, "items": { "$ref": "#/definitions/languageLabel" } }, "view": { "$ref": "#/definitions/viewDefinition" }, "onExecutionTasks": { "type": "array", "description": "Tasks to execute during transition", "items": { "$ref": "#/definitions/onExecuteTask" } }, "mapping": { "anyOf": [ { "$ref": "#/definitions/scriptCode" }, { "type": "null" } ], "description": "Input mapping for the transition" } } }, { "if": { "properties": { "triggerType": { "const": 1 }, "triggerKind": { "const": 10 } } }, "then": { "properties": { "rule": { "anyOf": [ { "$ref": "#/definitions/scriptCode" }, { "type": "null" } ] }, "timer": { "type": "null" }, "schema": { "type": "null" }, "view": { "type": "null" }, "mapping": { "type": "null" } } } }, { "if": { "properties": { "triggerType": { "const": 1 } }, "not": { "properties": { "triggerKind": { "const": 10 } } } }, "then": { "required": ["rule"], "properties": { "rule": { "$ref": "#/definitions/scriptCode" }, "timer": { "type": "null" }, "schema": { "type": "null" }, "view": { "type": "null" }, "mapping": { "type": "null" } } } }, { "if": { "properties": { "triggerType": { "const": 2 } } }, "then": { "required": ["timer"], "properties": { "timer": { "$ref": "#/definitions/scriptCode" }, "rule": { "type": "null" }, "schema": { "type": "null" }, "view": { "type": "null" }, "mapping": { "type": "null" } } } }, { "if": { "properties": { "triggerType": { "anyOf": [ { "const": 0 }, { "const": 3 } ] } } }, "then": { "properties": { "timer": { "type": "null" }, "rule": { "type": "null" } } } }, { "if": { "properties": { "triggerType": { "const": 0 } } }, "then": { "required": ["availableIn"], "properties": { "availableIn": { "type": "array", "description": "States where this shared transition is available", "items": { "type": "string" } }, "view": { "anyOf": [ { "$ref": "#/definitions/reference" }, { "type": "null" } ] } } }, "else": { "properties": { "view": { "type": "null" }, "availableIn": { "type": "null" } } } } ] }, "startTransition": { "type": "object", "required": [ "key", "target", "triggerType", "versionStrategy", "labels" ], "properties": { "key": { "type": "string", "description": "Transition key", "pattern": "^[a-z0-9-]+$" }, "target": { "type": "string", "description": "Target state key (must be an Initial state)", "pattern": "^[a-z0-9-]+$" }, "triggerType": { "type": "integer", "const": 0, "description": "Start transition must be manual trigger only" }, "versionStrategy": { "$ref": "#/definitions/versionStrategy" }, "labels": { "type": "array", "description": "Multi-language labels", "minItems": 1, "items": { "$ref": "#/definitions/languageLabel" } }, "onExecutionTasks": { "type": "array", "description": "Tasks to execute during transition", "items": { "$ref": "#/definitions/onExecuteTask" } }, "mapping": { "anyOf": [ { "$ref": "#/definitions/scriptCode" }, { "type": "null" } ], "description": "Input mapping for the transition" }, "schema": { "anyOf": [ { "$ref": "#/definitions/reference" }, { "type": "null" } ] } }, "additionalProperties": false }, "cancelTransition": { "type": "object", "required": [ "key", "target", "versionStrategy", "triggerType", "labels" ], "properties": { "_comment": { "type": "string", "description": "Comment about the cancel transition" }, "key": { "type": "string", "description": "Cancel transition key", "pattern": "^[a-z0-9-]+$" }, "target": { "type": "string", "description": "Target state key when cancel is executed", "pattern": "^[a-z0-9-]+$" }, "from": { "type": "string", "description": "Source state key", "pattern": "^[a-z0-9-]+$" }, "versionStrategy": { "$ref": "#/definitions/versionStrategy" }, "triggerType": { "type": "integer", "const": 0, "description": "Cancel transition must be manual trigger only" }, "availableIn": { "type": "array", "description": "List of states where this cancel transition can be used", "items": { "type": "string" } }, "schema": { "anyOf": [ { "$ref": "#/definitions/reference" }, { "type": "null" } ], "description": "Data schema reference that must be sent to execute the cancel transition" }, "labels": { "type": "array", "description": "Multi-language cancel transition labels", "items": { "$ref": "#/definitions/languageLabel" } }, "view": { "$ref": "#/definitions/viewDefinition" }, "onExecutionTasks": { "type": "array", "description": "Tasks to execute during cancel transition", "items": { "$ref": "#/definitions/onExecuteTask" } }, "mapping": { "anyOf": [ { "$ref": "#/definitions/scriptCode" }, { "type": "null" } ], "description": "Optional mapping definition for cancel transition input data transformation" } }, "additionalProperties": false }, "state": { "type": "object", "required": [ "key", "stateType", "versionStrategy", "labels" ], "if": { "properties": { "stateType": { "const": 5 } } }, "then": { "properties": { "transitions": { "type": "array", "maxItems": 1 } } }, "properties": { "_comment": { "type": "string", "description": "Comment about the state" }, "key": { "type": "string", "description": "State key", "pattern": "^[a-z0-9-]+$" }, "stateType": { "$ref": "#/definitions/stateType" }, "subType": { "$ref": "#/definitions/stateSubType" }, "versionStrategy": { "$ref": "#/definitions/versionStrategy" }, "labels": { "type": "array", "description": "Multi-language labels", "minItems": 1, "items": { "$ref": "#/definitions/languageLabel" } }, "view": { "$ref": "#/definitions/viewDefinition" }, "subFlow": { "anyOf": [ { "$ref": "#/definitions/subFlow" }, { "type": "null" } ] }, "transitions": { "type": "array", "description": "Transitions from this state", "items": { "$ref": "#/definitions/transition" } }, "onEntries": { "type": "array", "description": "Tasks to execute when entering the state", "items": { "$ref": "#/definitions/onExecuteTask" } }, "onExits": { "type": "array", "description": "Tasks to execute when exiting the state", "items": { "$ref": "#/definitions/onExecuteTask" } } } } } }