886 lines
21 KiB
JSON
886 lines
21 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"title": "Flow definition DSL v1",
|
|
"type": "object",
|
|
"properties": {
|
|
"schemaVersion": {
|
|
"const": 1
|
|
},
|
|
"flowKey": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
},
|
|
"version": {
|
|
"type": "integer",
|
|
"minimum": 1
|
|
},
|
|
"initialState": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
},
|
|
"dataSchema": {
|
|
"$ref": "#/$defs/InlineSchema"
|
|
},
|
|
"initialDataSchema": {
|
|
"$ref": "#/$defs/InlineSchema"
|
|
},
|
|
"states": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/$defs/State"
|
|
},
|
|
"minItems": 1,
|
|
"maxItems": 200
|
|
},
|
|
"events": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/$defs/Event"
|
|
},
|
|
"minItems": 0,
|
|
"maxItems": 500
|
|
},
|
|
"transitions": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/$defs/Transition"
|
|
},
|
|
"minItems": 0,
|
|
"maxItems": 500
|
|
},
|
|
"decisions": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/$defs/Decision"
|
|
},
|
|
"minItems": 0,
|
|
"maxItems": 500
|
|
},
|
|
"tasks": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/$defs/Task"
|
|
},
|
|
"minItems": 0,
|
|
"maxItems": 500
|
|
}
|
|
},
|
|
"required": [
|
|
"schemaVersion",
|
|
"flowKey",
|
|
"version",
|
|
"initialState",
|
|
"states",
|
|
"events",
|
|
"transitions",
|
|
"decisions",
|
|
"tasks"
|
|
],
|
|
"additionalProperties": false,
|
|
"$defs": {
|
|
"Key": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
},
|
|
"ContextPath": {
|
|
"type": "string",
|
|
"pattern": "^/(?:request/data|event/data|results|actor)(?:/(?:[^~/]|~[01])*)*$"
|
|
},
|
|
"DataPointer": {
|
|
"type": "string",
|
|
"pattern": "^/(?:[^~/]|~[01])+(?:/(?:[^~/]|~[01])*)*$"
|
|
},
|
|
"Value": {
|
|
"oneOf": [
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"path": {
|
|
"type": "string",
|
|
"pattern": "^/(?:request/data|event/data|results|actor)(?:/(?:[^~/]|~[01])*)*$"
|
|
}
|
|
},
|
|
"required": [
|
|
"path"
|
|
],
|
|
"additionalProperties": false
|
|
},
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"literal": {}
|
|
},
|
|
"required": [
|
|
"literal"
|
|
],
|
|
"additionalProperties": false
|
|
}
|
|
]
|
|
},
|
|
"InlineSchema": {
|
|
"oneOf": [
|
|
{
|
|
"type": "boolean"
|
|
},
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"type": {
|
|
"oneOf": [
|
|
{
|
|
"type": "string",
|
|
"enum": [
|
|
"object",
|
|
"array",
|
|
"string",
|
|
"number",
|
|
"integer",
|
|
"boolean",
|
|
"null"
|
|
]
|
|
},
|
|
{
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string",
|
|
"enum": [
|
|
"object",
|
|
"array",
|
|
"string",
|
|
"number",
|
|
"integer",
|
|
"boolean",
|
|
"null"
|
|
]
|
|
},
|
|
"minItems": 1,
|
|
"uniqueItems": true,
|
|
"maxItems": 7
|
|
}
|
|
]
|
|
},
|
|
"title": {
|
|
"type": "string",
|
|
"maxLength": 200
|
|
},
|
|
"description": {
|
|
"type": "string",
|
|
"maxLength": 2000
|
|
},
|
|
"properties": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"$ref": "#/$defs/InlineSchema"
|
|
}
|
|
},
|
|
"required": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"minItems": 0,
|
|
"uniqueItems": true,
|
|
"maxItems": 200
|
|
},
|
|
"additionalProperties": {
|
|
"$ref": "#/$defs/InlineSchema"
|
|
},
|
|
"items": {
|
|
"$ref": "#/$defs/InlineSchema"
|
|
},
|
|
"enum": {
|
|
"type": "array",
|
|
"items": {},
|
|
"minItems": 1,
|
|
"uniqueItems": true,
|
|
"maxItems": 1000
|
|
},
|
|
"const": {},
|
|
"minLength": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"maxLength": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"pattern": {
|
|
"type": "string",
|
|
"maxLength": 1000
|
|
},
|
|
"format": {
|
|
"type": "string",
|
|
"enum": [
|
|
"uuid",
|
|
"date-time",
|
|
"date",
|
|
"email",
|
|
"uri"
|
|
]
|
|
},
|
|
"minimum": {
|
|
"type": "number"
|
|
},
|
|
"maximum": {
|
|
"type": "number"
|
|
},
|
|
"exclusiveMinimum": {
|
|
"type": "number"
|
|
},
|
|
"exclusiveMaximum": {
|
|
"type": "number"
|
|
},
|
|
"multipleOf": {
|
|
"type": "number",
|
|
"exclusiveMinimum": 0
|
|
},
|
|
"minItems": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"maxItems": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"uniqueItems": {
|
|
"type": "boolean"
|
|
},
|
|
"minProperties": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"maxProperties": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"allOf": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/$defs/InlineSchema"
|
|
},
|
|
"minItems": 1,
|
|
"maxItems": 100
|
|
},
|
|
"anyOf": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/$defs/InlineSchema"
|
|
},
|
|
"minItems": 1,
|
|
"maxItems": 100
|
|
},
|
|
"oneOf": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/$defs/InlineSchema"
|
|
},
|
|
"minItems": 1,
|
|
"maxItems": 100
|
|
},
|
|
"not": {
|
|
"$ref": "#/$defs/InlineSchema"
|
|
},
|
|
"if": {
|
|
"$ref": "#/$defs/InlineSchema"
|
|
},
|
|
"then": {
|
|
"$ref": "#/$defs/InlineSchema"
|
|
},
|
|
"else": {
|
|
"$ref": "#/$defs/InlineSchema"
|
|
}
|
|
},
|
|
"required": [],
|
|
"additionalProperties": false
|
|
}
|
|
]
|
|
},
|
|
"Condition": {
|
|
"oneOf": [
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"op": {
|
|
"type": "string",
|
|
"enum": [
|
|
"EQ",
|
|
"NEQ",
|
|
"GT",
|
|
"GTE",
|
|
"LT",
|
|
"LTE",
|
|
"IN"
|
|
]
|
|
},
|
|
"left": {
|
|
"$ref": "#/$defs/Value"
|
|
},
|
|
"right": {
|
|
"$ref": "#/$defs/Value"
|
|
}
|
|
},
|
|
"required": [
|
|
"op",
|
|
"left",
|
|
"right"
|
|
],
|
|
"additionalProperties": false
|
|
},
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"op": {
|
|
"const": "EXISTS"
|
|
},
|
|
"value": {
|
|
"type": "object",
|
|
"properties": {
|
|
"path": {
|
|
"type": "string",
|
|
"pattern": "^/(?:request/data|event/data|results|actor)(?:/(?:[^~/]|~[01])*)*$"
|
|
}
|
|
},
|
|
"required": [
|
|
"path"
|
|
],
|
|
"additionalProperties": false
|
|
}
|
|
},
|
|
"required": [
|
|
"op",
|
|
"value"
|
|
],
|
|
"additionalProperties": false
|
|
},
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"op": {
|
|
"type": "string",
|
|
"enum": [
|
|
"AND",
|
|
"OR"
|
|
]
|
|
},
|
|
"args": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/$defs/Condition"
|
|
},
|
|
"minItems": 2,
|
|
"maxItems": 1000
|
|
}
|
|
},
|
|
"required": [
|
|
"op",
|
|
"args"
|
|
],
|
|
"additionalProperties": false
|
|
},
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"op": {
|
|
"const": "NOT"
|
|
},
|
|
"arg": {
|
|
"$ref": "#/$defs/Condition"
|
|
}
|
|
},
|
|
"required": [
|
|
"op",
|
|
"arg"
|
|
],
|
|
"additionalProperties": false
|
|
}
|
|
]
|
|
},
|
|
"RetryPolicy": {
|
|
"type": "object",
|
|
"properties": {
|
|
"maxAttempts": {
|
|
"type": "integer",
|
|
"minimum": 1,
|
|
"maximum": 3
|
|
},
|
|
"initialBackoffMs": {
|
|
"type": "integer",
|
|
"minimum": 100,
|
|
"maximum": 60000
|
|
},
|
|
"maxBackoffMs": {
|
|
"type": "integer",
|
|
"minimum": 100,
|
|
"maximum": 120000
|
|
}
|
|
},
|
|
"required": [
|
|
"maxAttempts"
|
|
],
|
|
"additionalProperties": false
|
|
},
|
|
"Action": {
|
|
"oneOf": [
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
},
|
|
"resultKey": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
},
|
|
"retry": {
|
|
"$ref": "#/$defs/RetryPolicy"
|
|
},
|
|
"type": {
|
|
"const": "INVOKE_INTEGRATION"
|
|
},
|
|
"integrationKey": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
},
|
|
"contractVersion": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 100
|
|
},
|
|
"profile": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
},
|
|
"profileVersion": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 100
|
|
},
|
|
"inputs": {
|
|
"type": "object",
|
|
"propertyNames": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
},
|
|
"additionalProperties": {
|
|
"$ref": "#/$defs/Value"
|
|
},
|
|
"maxProperties": 200
|
|
}
|
|
},
|
|
"required": [
|
|
"id",
|
|
"type",
|
|
"integrationKey",
|
|
"inputs",
|
|
"resultKey"
|
|
],
|
|
"additionalProperties": false,
|
|
"dependentRequired": {
|
|
"profileVersion": [
|
|
"profile"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
},
|
|
"resultKey": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
},
|
|
"retry": {
|
|
"$ref": "#/$defs/RetryPolicy"
|
|
},
|
|
"type": {
|
|
"const": "REGISTER_DOCUMENT"
|
|
},
|
|
"documentType": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
},
|
|
"inputs": {
|
|
"type": "object",
|
|
"properties": {
|
|
"documentId": {
|
|
"$ref": "#/$defs/Value"
|
|
}
|
|
},
|
|
"required": [
|
|
"documentId"
|
|
],
|
|
"additionalProperties": false
|
|
}
|
|
},
|
|
"required": [
|
|
"id",
|
|
"type",
|
|
"documentType",
|
|
"inputs",
|
|
"resultKey"
|
|
],
|
|
"additionalProperties": false
|
|
},
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
},
|
|
"type": {
|
|
"const": "NO_OP"
|
|
},
|
|
"resultKey": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
},
|
|
"output": {
|
|
"type": "object"
|
|
}
|
|
},
|
|
"required": [
|
|
"id",
|
|
"type",
|
|
"resultKey"
|
|
],
|
|
"additionalProperties": false
|
|
}
|
|
],
|
|
"description": "Tipos del MVP. NO_OP sólo simulación; publicación fija versiones de contrato/perfil desde catálogo confiable."
|
|
},
|
|
"State": {
|
|
"type": "object",
|
|
"properties": {
|
|
"key": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
},
|
|
"terminal": {
|
|
"type": "boolean"
|
|
}
|
|
},
|
|
"required": [
|
|
"key",
|
|
"terminal"
|
|
],
|
|
"additionalProperties": false
|
|
},
|
|
"Event": {
|
|
"type": "object",
|
|
"properties": {
|
|
"key": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
},
|
|
"inputSchema": {
|
|
"$ref": "#/$defs/InlineSchema"
|
|
}
|
|
},
|
|
"required": [
|
|
"key",
|
|
"inputSchema"
|
|
],
|
|
"additionalProperties": false
|
|
},
|
|
"Update": {
|
|
"type": "object",
|
|
"properties": {
|
|
"target": {
|
|
"type": "string",
|
|
"pattern": "^/(?:[^~/]|~[01])+(?:/(?:[^~/]|~[01])*)*$"
|
|
},
|
|
"value": {
|
|
"$ref": "#/$defs/Value"
|
|
}
|
|
},
|
|
"required": [
|
|
"target",
|
|
"value"
|
|
],
|
|
"additionalProperties": false,
|
|
"description": "target es relativo a request.data, nunca a la solicitud completa."
|
|
},
|
|
"Transition": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
},
|
|
"from": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
},
|
|
"event": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
},
|
|
"allowedRoles": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
},
|
|
"minItems": 1,
|
|
"uniqueItems": true,
|
|
"maxItems": 100
|
|
},
|
|
"guard": {
|
|
"$ref": "#/$defs/Condition"
|
|
},
|
|
"actions": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/$defs/Action"
|
|
},
|
|
"minItems": 0,
|
|
"maxItems": 50
|
|
},
|
|
"decision": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
},
|
|
"destinations": {
|
|
"type": "object",
|
|
"propertyNames": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
},
|
|
"additionalProperties": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
},
|
|
"minProperties": 1
|
|
},
|
|
"to": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
},
|
|
"outcome": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
},
|
|
"updates": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/$defs/Update"
|
|
},
|
|
"minItems": 0,
|
|
"maxItems": 200
|
|
}
|
|
},
|
|
"required": [
|
|
"id",
|
|
"from",
|
|
"event",
|
|
"allowedRoles",
|
|
"actions"
|
|
],
|
|
"additionalProperties": false,
|
|
"oneOf": [
|
|
{
|
|
"required": [
|
|
"to",
|
|
"outcome"
|
|
],
|
|
"not": {
|
|
"anyOf": [
|
|
{
|
|
"required": [
|
|
"decision"
|
|
]
|
|
},
|
|
{
|
|
"required": [
|
|
"destinations"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"required": [
|
|
"decision",
|
|
"destinations"
|
|
],
|
|
"not": {
|
|
"anyOf": [
|
|
{
|
|
"required": [
|
|
"to"
|
|
]
|
|
},
|
|
{
|
|
"required": [
|
|
"outcome"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"Rule": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
},
|
|
"when": {
|
|
"$ref": "#/$defs/Condition"
|
|
},
|
|
"output": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
}
|
|
},
|
|
"required": [
|
|
"id",
|
|
"when",
|
|
"output"
|
|
],
|
|
"additionalProperties": false
|
|
},
|
|
"Decision": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
},
|
|
"hitPolicy": {
|
|
"type": "string",
|
|
"enum": [
|
|
"UNIQUE",
|
|
"FIRST"
|
|
]
|
|
},
|
|
"rules": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/$defs/Rule"
|
|
},
|
|
"minItems": 1,
|
|
"maxItems": 1000
|
|
},
|
|
"defaultOutput": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
}
|
|
},
|
|
"required": [
|
|
"id",
|
|
"hitPolicy",
|
|
"rules",
|
|
"defaultOutput"
|
|
],
|
|
"additionalProperties": false
|
|
},
|
|
"Ui": {
|
|
"oneOf": [
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"component": {
|
|
"const": "DOCUMENT_UPLOAD"
|
|
},
|
|
"title": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 200
|
|
},
|
|
"documentType": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
},
|
|
"acceptedMimeTypes": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z0-9.+-]+/[A-Za-z0-9.+-]+$"
|
|
},
|
|
"minItems": 1,
|
|
"uniqueItems": true,
|
|
"maxItems": 20
|
|
},
|
|
"maxBytes": {
|
|
"type": "integer",
|
|
"minimum": 1,
|
|
"maximum": 104857600
|
|
}
|
|
},
|
|
"required": [
|
|
"component",
|
|
"title",
|
|
"documentType",
|
|
"acceptedMimeTypes",
|
|
"maxBytes"
|
|
],
|
|
"additionalProperties": false
|
|
},
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"component": {
|
|
"const": "FORM"
|
|
},
|
|
"title": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 200
|
|
},
|
|
"fieldOrder": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"minItems": 0,
|
|
"uniqueItems": true,
|
|
"maxItems": 200
|
|
}
|
|
},
|
|
"required": [
|
|
"component",
|
|
"title"
|
|
],
|
|
"additionalProperties": false
|
|
}
|
|
]
|
|
},
|
|
"Task": {
|
|
"type": "object",
|
|
"properties": {
|
|
"state": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
},
|
|
"event": {
|
|
"type": "string",
|
|
"pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,99}$"
|
|
},
|
|
"ui": {
|
|
"$ref": "#/$defs/Ui"
|
|
},
|
|
"inputSchema": {
|
|
"$ref": "#/$defs/InlineSchema"
|
|
}
|
|
},
|
|
"required": [
|
|
"state",
|
|
"event",
|
|
"ui",
|
|
"inputSchema"
|
|
],
|
|
"additionalProperties": false
|
|
}
|
|
}
|
|
}
|