UNPKG

@burgan-tech/vnext-schema

Version:

JSON Schema definitions for vNext vNext Workflow components validation

634 lines 16.4 kB
{ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://vnext.com/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" } }, "attributes": { "type": "object", "required": [ "type", "startTransition", "states" ], "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": { "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", "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/transition" } }, "extensions": { "type": "array", "description": "Extensions used in the workflow", "items": { "$ref": "#/definitions/reference" } }, "startTransition": { "$ref": "#/definitions/transition" }, "states": { "type": "array", "description": "States in the workflow", "items": { "$ref": "#/definitions/state" } } } } }, "definitions": { "versionStrategy": { "type": "string", "enum": [ "Major", "Minor" ], "enumDescriptions": [ "Major version update", "Minor version update" ], "description": "Version strategy for updates" }, "triggerType": { "type": "integer", "enum": [ 0, 1, 2, 3 ], "enumDescriptions": [ "Manual trigger", "Automatic trigger", "Timeout trigger", "Event trigger" ], "description": "Type of trigger for the transition" }, "stateType": { "type": "integer", "enum": [ 1, 2, 3, 4 ], "enumDescriptions": [ "Initial state", "Intermediate state", "Final state", "SubFlow state" ], "description": "Type of workflow state" }, "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", "format": "uuid" }, "domain": { "type": "string" }, "flow": { "type": "string" }, "version": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+$" } }, "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", "required": [ "code", "location" ], "properties": { "code": { "type": "string", "description": "Script code content" }, "location": { "type": "string", "description": "Location of the script file" } } }, "subFlow": { "anyOf": [ { "type": "object", "required": [ "type", "process" ], "properties": { "type": { "type": "string", "enum": [ "S", "P" ], "description": "SubFlow type. S=SubFlow, P=SubProcess", "maxLength": 10 }, "process": { "type": "object", "properties": { "key": { "type": "string", "description": "Key value of the referenced record (readable identifier)", "pattern": "^[a-zA-Z0-9\\-]+$", "maxLength": 255 }, "domain": { "type": "string", "description": "Domain where the referenced record is located (required for cross-domain references)", "pattern": "^[a-zA-Z\\-]+$", "maxLength": 100, "examples": [ "core", "idm", "banking", "payment" ] }, "flow": { "type": "string", "description": "Flow name where the referenced record is located", "pattern": "^[a-z\\-]+$", "maxLength": 100 }, "version": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+$", "description": "Version information of the referenced record (semantic versioning MAJOR.MINOR.PATCH format)", "maxLength": 50 } }, "required": [ "key", "domain", "flow", "version" ], "additionalProperties": false, "examples": [ { "key": "user-authentication-workflow", "domain": "idm", "flow": "user-authentication", "version": "1.0.0" }, { "key": "user-login-state", "domain": "core", "flow": "authentication", "version": "2.1.0" }, { "key": "payment-validation-task", "domain": "banking", "flow": "payment-process", "version": "1.2.3" } ], "description": "SubFlow process reference" }, "mapping": { "anyOf": [ { "type": "object", "required": [ "code", "location" ], "properties": { "code": { "type": "string", "description": "SubFlow mapping code" }, "location": { "type": "string", "description": "Location of the mapping code file" } }, "additionalProperties": false }, { "type": "null" } ], "description": "Mapping definition for data exchange with SubFlow" } }, "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": { "order": { "type": "integer", "description": "Execution order", "minimum": 1 }, "task": { "$ref": "#/definitions/reference" }, "mapping": { "$ref": "#/definitions/scriptCode" } } }, "transition": { "type": "object", "required": [ "key", "target", "versionStrategy", "triggerType" ], "properties": { "key": { "type": "string", "description": "Transition key", "pattern": "^[a-z0-9-]+$" }, "target": { "type": "string", "description": "Target state key", "pattern": "^[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" }, "availableIn": { "type": "array", "description": "States where this transition is available", "items": { "type": "string" } }, "schema": { "anyOf": [ { "$ref": "#/definitions/reference" }, { "type": "null" } ] }, "rule": { "anyOf": [ { "$ref": "#/definitions/scriptCode" }, { "type": "null" } ] }, "timer": { "anyOf": [ { "type": "object", "required": [ "code", "location" ], "properties": { "code": { "type": "string", "description": "Timer rule code" }, "location": { "type": "string", "description": "Location of the code file" } }, "additionalProperties": false }, { "type": "null" } ], "description": "Timer information if the transition should execute automatically" }, "labels": { "type": "array", "description": "Multi-language labels", "items": { "$ref": "#/definitions/languageLabel" } }, "view": { "anyOf": [ { "$ref": "#/definitions/reference" }, { "type": "null" } ] }, "onExecutionTasks": { "type": "array", "description": "Tasks to execute during transition", "items": { "$ref": "#/definitions/onExecuteTask" } } } }, "state": { "type": "object", "required": [ "key", "stateType", "versionStrategy", "labels" ], "properties": { "key": { "type": "string", "description": "State key", "pattern": "^[a-z0-9-]+$" }, "stateType": { "$ref": "#/definitions/stateType" }, "versionStrategy": { "$ref": "#/definitions/versionStrategy" }, "labels": { "type": "array", "description": "Multi-language labels", "items": { "$ref": "#/definitions/languageLabel" } }, "view": { "anyOf": [ { "$ref": "#/definitions/reference" }, { "type": "null" } ] }, "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" } } } } } }