{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.baijimu.com/contracts/workflow-definition/7.0.0/schema.json",
  "title": "Workflow author definition 7.0.0",
  "description": "Engine 62 author contract: unique Start entry, Agent attempt retry and Workflow finally. Scope is internal; author status and startNodeId are removed.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1
    },
    "description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "inputSchema": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/paramDefinition"
      }
    },
    "outputSchema": {
      "anyOf": [
        {
          "$ref": "#/$defs/dataType"
        },
        {
          "type": "null"
        }
      ]
    },
    "nodes": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/workflowNode"
      },
      "contains": {
        "type": "object",
        "properties": {
          "type": {
            "const": "start"
          }
        },
        "required": [
          "type"
        ]
      },
      "minContains": 1,
      "maxContains": 1
    },
    "edges": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/workflowEdge"
      }
    },
    "graphLayout": true,
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "finally": {
      "anyOf": [
        {
          "$ref": "#/$defs/finallyGraph"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "name",
    "nodes"
  ],
  "$defs": {
    "nonEmptyString": {
      "type": "string",
      "minLength": 1,
      "pattern": "\\S"
    },
    "outgoingPolicy": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "mode"
      ],
      "properties": {
        "mode": {
          "enum": [
            "first_match",
            "all_matched",
            "all"
          ]
        },
        "onNoMatch": {
          "enum": [
            "error",
            "complete"
          ]
        }
      }
    },
    "retryPolicy": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "maxAttempts": {
          "type": "integer",
          "minimum": 0
        },
        "initialDelayMs": {
          "type": "integer",
          "minimum": 0
        },
        "maxDelayMs": {
          "type": "integer",
          "minimum": 0
        },
        "backoffMultiplier": {
          "type": "number"
        }
      },
      "required": []
    },
    "httpRequest": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "method",
        "url"
      ],
      "properties": {
        "method": {
          "$ref": "#/$defs/nonEmptyString"
        },
        "url": {
          "$ref": "#/$defs/nonEmptyString"
        },
        "destinationPolicy": {
          "const": "external",
          "default": "external"
        },
        "headers": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "default": {}
        },
        "body": true,
        "secretRefs": {
          "type": "array",
          "maxItems": 32,
          "items": {
            "$ref": "#/$defs/secretBinding"
          },
          "default": []
        },
        "timeoutSecs": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 1,
          "maximum": 86400
        },
        "retryPolicy": {
          "$ref": "#/$defs/retryPolicy"
        }
      }
    },
    "secretBinding": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "secretRef",
        "target"
      ],
      "properties": {
        "secretRef": {
          "type": "string",
          "pattern": "^secret://[A-Za-z0-9][A-Za-z0-9._/-]{0,190}$"
        },
        "target": {
          "oneOf": [
            {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "type",
                "name"
              ],
              "properties": {
                "type": {
                  "const": "header"
                },
                "name": {
                  "$ref": "#/$defs/nonEmptyString"
                }
              }
            },
            {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "type",
                "pointer"
              ],
              "properties": {
                "type": {
                  "const": "json_body"
                },
                "pointer": {
                  "type": "string"
                }
              }
            }
          ]
        }
      }
    },
    "backendResponse": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "backend_response_format": {
          "enum": [
            "cmodel",
            "plain",
            "passthrough"
          ]
        },
        "error_code_field": {
          "type": "string"
        },
        "error_message_field": {
          "type": "string"
        },
        "data_field": {
          "type": "string"
        },
        "success_expression": {
          "type": "string"
        },
        "error_code_expression": {
          "type": "string"
        },
        "error_message_expression": {
          "type": "string"
        },
        "data_expression": {
          "type": "string"
        }
      }
    },
    "nodeId": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]+$"
    },
    "dataType": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "@type": {
          "const": "JsonSchema"
        },
        "schema": {
          "anyOf": [
            {
              "type": "object"
            },
            {
              "type": "boolean"
            }
          ]
        }
      },
      "required": [
        "@type",
        "schema"
      ]
    },
    "paramDefinition": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1
        },
        "type": {
          "$ref": "#/$defs/dataType"
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "name",
        "type"
      ]
    },
    "workflowEdge": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "from": {
          "$ref": "#/$defs/nodeId"
        },
        "to": {
          "$ref": "#/$defs/nodeId"
        },
        "label": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "guard": {
          "anyOf": [
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "type": {
                  "const": "expression"
                },
                "expression": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "type",
                "expression"
              ]
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "from",
        "to"
      ]
    },
    "MODULEReference": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "resourceLocator": {
          "type": "string",
          "pattern": "^[^/\\s]+/[^/\\s]+/MODULE/[^/\\s]+$"
        }
      },
      "required": [
        "resourceLocator"
      ]
    },
    "AGENTReference": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "resourceLocator": {
          "type": "string",
          "pattern": "^[^/\\s]+/[^/\\s]+/AGENT/[^/\\s]+$"
        }
      },
      "required": [
        "resourceLocator"
      ]
    },
    "WORKFLOWReference": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "resourceLocator": {
          "type": "string",
          "pattern": "^[^/\\s]+/[^/\\s]+/WORKFLOW/[^/\\s]+$"
        }
      },
      "required": [
        "resourceLocator"
      ]
    },
    "serviceExpression": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "type": {
          "const": "service_reference_expression"
        },
        "contractVersion": {
          "const": "1.0.0"
        },
        "expression": {
          "type": "string",
          "minLength": 1
        },
        "references": {
          "type": "object",
          "minProperties": 1,
          "propertyNames": {
            "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
          },
          "additionalProperties": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "resourceLocator": {
                "type": "string",
                "pattern": "^[^/\\s]+/[^/\\s]+/MODULE/[^/\\s]+$"
              },
              "propertyName": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "resourceLocator",
              "propertyName"
            ]
          }
        }
      },
      "required": [
        "type",
        "contractVersion",
        "expression",
        "references"
      ]
    },
    "result": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "type": {
          "$ref": "#/$defs/dataType"
        }
      },
      "required": [
        "type"
      ]
    },
    "candidate": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "identityType": {
          "enum": [
            "user",
            "department",
            "group",
            "role"
          ]
        },
        "identityId": {
          "type": "string",
          "minLength": 1
        }
      },
      "required": [
        "identityType",
        "identityId"
      ]
    },
    "assignment": {
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "mode": {
              "const": "workspace_members"
            }
          },
          "required": [
            "mode"
          ]
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "mode": {
              "const": "candidates"
            },
            "candidates": {
              "oneOf": [
                {
                  "type": "string",
                  "pattern": "^\\{\\{\\s*(input|context)\\.[^{}]+\\}\\}$"
                },
                {
                  "type": "array",
                  "minItems": 1,
                  "items": {
                    "type": "string",
                    "pattern": "^[1-9][0-9]*$"
                  }
                },
                {
                  "type": "array",
                  "minItems": 1,
                  "items": {
                    "$ref": "#/$defs/candidate"
                  }
                }
              ]
            }
          },
          "required": [
            "mode",
            "candidates"
          ]
        }
      ]
    },
    "waitCondition": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "op": {
          "enum": [
            "eq",
            "ne",
            "in",
            "not_in",
            "exists",
            "not_exists",
            "gt",
            "gte",
            "lt",
            "lte",
            "contains"
          ]
        },
        "value": true
      },
      "required": [
        "op"
      ]
    },
    "waitState": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "type": {
          "enum": [
            "http",
            "runtime"
          ]
        },
        "request": {
          "anyOf": [
            {
              "$ref": "#/$defs/httpRequest"
            },
            {
              "type": "null"
            }
          ]
        },
        "path": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "valuePath": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "type"
      ]
    },
    "waitSignal": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "successSignalNames": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "failureSignalNames": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "cancellationSignalNames": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      },
      "required": []
    },
    "waitSchedule": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "intervalMillis": {
          "type": "integer",
          "minimum": 0
        },
        "maxIntervalMillis": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        },
        "backoffMultiplier": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": []
    },
    "startNode": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "$ref": "#/$defs/nodeId"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "outgoingPolicy": {
          "anyOf": [
            {
              "$ref": "#/$defs/outgoingPolicy"
            },
            {
              "type": "null"
            }
          ]
        },
        "type": {
          "const": "start"
        }
      },
      "required": [
        "type",
        "id"
      ]
    },
    "endNode": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "$ref": "#/$defs/nodeId"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "outgoingPolicy": {
          "anyOf": [
            {
              "$ref": "#/$defs/outgoingPolicy"
            },
            {
              "type": "null"
            }
          ]
        },
        "type": {
          "const": "end"
        },
        "output": true
      },
      "required": [
        "type",
        "id"
      ]
    },
    "joinNode": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "$ref": "#/$defs/nodeId"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "outgoingPolicy": {
          "anyOf": [
            {
              "$ref": "#/$defs/outgoingPolicy"
            },
            {
              "type": "null"
            }
          ]
        },
        "type": {
          "const": "join"
        },
        "joinPolicy": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "mode": {
              "enum": [
                "all",
                "any"
              ]
            }
          },
          "required": [
            "mode"
          ]
        },
        "output": true
      },
      "required": [
        "type",
        "id",
        "joinPolicy"
      ]
    },
    "httpNode": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "$ref": "#/$defs/nodeId"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "outgoingPolicy": {
          "anyOf": [
            {
              "$ref": "#/$defs/outgoingPolicy"
            },
            {
              "type": "null"
            }
          ]
        },
        "type": {
          "const": "http"
        },
        "request": {
          "$ref": "#/$defs/httpRequest"
        },
        "response": {
          "$ref": "#/$defs/backendResponse"
        },
        "result": {
          "$ref": "#/$defs/result"
        },
        "retryPolicy": {
          "anyOf": [
            {
              "$ref": "#/$defs/retryPolicy"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "type",
        "id",
        "request",
        "response",
        "result"
      ]
    },
    "waitNode": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "$ref": "#/$defs/nodeId"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "outgoingPolicy": {
          "anyOf": [
            {
              "$ref": "#/$defs/outgoingPolicy"
            },
            {
              "type": "null"
            }
          ]
        },
        "type": {
          "const": "wait"
        },
        "state": {
          "anyOf": [
            {
              "$ref": "#/$defs/waitState"
            },
            {
              "type": "null"
            }
          ]
        },
        "signal": {
          "anyOf": [
            {
              "$ref": "#/$defs/waitSignal"
            },
            {
              "type": "null"
            }
          ]
        },
        "until": {
          "anyOf": [
            {
              "$ref": "#/$defs/waitCondition"
            },
            {
              "type": "null"
            }
          ]
        },
        "failWhen": {
          "anyOf": [
            {
              "$ref": "#/$defs/waitCondition"
            },
            {
              "type": "null"
            }
          ]
        },
        "timeoutSecs": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        },
        "schedule": {
          "$ref": "#/$defs/waitSchedule"
        },
        "output": true
      },
      "required": [
        "type",
        "id"
      ]
    },
    "humanNode": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "$ref": "#/$defs/nodeId"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "outgoingPolicy": {
          "anyOf": [
            {
              "$ref": "#/$defs/outgoingPolicy"
            },
            {
              "type": "null"
            }
          ]
        },
        "type": {
          "const": "human"
        },
        "issueDefinitionReference": {
          "type": "string",
          "pattern": "^baijimu-issue://[^/\\s]+/[0-9a-fA-F-]{36}@[^#\\s]+#[^\\s]+$"
        },
        "input": true,
        "assignment": {
          "$ref": "#/$defs/assignment"
        },
        "executionPolicy": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "completionTimeoutSecs": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 1
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": []
        }
      },
      "required": [
        "type",
        "id",
        "issueDefinitionReference",
        "input",
        "assignment"
      ]
    },
    "agentNode": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "$ref": "#/$defs/nodeId"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "outgoingPolicy": {
          "anyOf": [
            {
              "$ref": "#/$defs/outgoingPolicy"
            },
            {
              "type": "null"
            }
          ]
        },
        "type": {
          "const": "agent"
        },
        "agent": {
          "$ref": "#/$defs/AGENTReference"
        },
        "message": {
          "type": "string"
        },
        "result": {
          "$ref": "#/$defs/result"
        },
        "executionPolicy": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "completionTimeoutSecs": {
              "type": "integer",
              "minimum": 0
            }
          },
          "required": []
        },
        "retryPolicy": {
          "anyOf": [
            {
              "$ref": "#/$defs/retryPolicy"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "type",
        "id",
        "agent",
        "message",
        "result"
      ]
    },
    "subflowNode": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "$ref": "#/$defs/nodeId"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "outgoingPolicy": {
          "anyOf": [
            {
              "$ref": "#/$defs/outgoingPolicy"
            },
            {
              "type": "null"
            }
          ]
        },
        "type": {
          "const": "subflow"
        },
        "workflow": {
          "$ref": "#/$defs/WORKFLOWReference"
        },
        "input": true,
        "metadata": {
          "anyOf": [
            {
              "type": "object"
            },
            {
              "type": "null"
            }
          ]
        },
        "timeoutSecs": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "type",
        "id",
        "workflow"
      ]
    },
    "for_eachNode": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "$ref": "#/$defs/nodeId"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "outgoingPolicy": {
          "anyOf": [
            {
              "$ref": "#/$defs/outgoingPolicy"
            },
            {
              "type": "null"
            }
          ]
        },
        "type": {
          "const": "for_each"
        },
        "itemsPath": {
          "type": "string",
          "minLength": 1
        },
        "itemName": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "indexName": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "mode": {
          "const": "sequential"
        },
        "maxIterations": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        },
        "onItemError": {
          "enum": [
            "fail",
            "continue"
          ]
        },
        "body": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/workflowNode"
          }
        },
        "itemOutput": true
      },
      "required": [
        "type",
        "id",
        "itemsPath"
      ]
    },
    "module_methodNode": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "$ref": "#/$defs/nodeId"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "outgoingPolicy": {
          "anyOf": [
            {
              "$ref": "#/$defs/outgoingPolicy"
            },
            {
              "type": "null"
            }
          ]
        },
        "type": {
          "const": "module_method"
        },
        "method": {
          "type": "string",
          "minLength": 1
        },
        "params": true,
        "retryPolicy": {
          "anyOf": [
            {
              "$ref": "#/$defs/retryPolicy"
            },
            {
              "type": "null"
            }
          ]
        },
        "module": {
          "$ref": "#/$defs/MODULEReference"
        },
        "service": {
          "$ref": "#/$defs/serviceExpression"
        },
        "timeoutSecs": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "type",
        "id",
        "method"
      ],
      "oneOf": [
        {
          "properties": {
            "module": true
          },
          "required": [
            "module"
          ]
        },
        {
          "properties": {
            "service": true
          },
          "required": [
            "service"
          ]
        }
      ]
    },
    "emit_eventNode": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "$ref": "#/$defs/nodeId"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "outgoingPolicy": {
          "anyOf": [
            {
              "$ref": "#/$defs/outgoingPolicy"
            },
            {
              "type": "null"
            }
          ]
        },
        "type": {
          "const": "emit_event"
        },
        "eventName": {
          "type": "string",
          "minLength": 1
        },
        "payload": true,
        "idempotencyKey": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "module": {
          "$ref": "#/$defs/MODULEReference"
        },
        "service": {
          "$ref": "#/$defs/serviceExpression"
        },
        "timeoutSecs": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "type",
        "id",
        "eventName"
      ],
      "oneOf": [
        {
          "properties": {
            "module": true
          },
          "required": [
            "module"
          ]
        },
        {
          "properties": {
            "service": true
          },
          "required": [
            "service"
          ]
        }
      ]
    },
    "workflowNode": {
      "oneOf": [
        {
          "$ref": "#/$defs/startNode"
        },
        {
          "$ref": "#/$defs/endNode"
        },
        {
          "$ref": "#/$defs/joinNode"
        },
        {
          "$ref": "#/$defs/httpNode"
        },
        {
          "$ref": "#/$defs/waitNode"
        },
        {
          "$ref": "#/$defs/humanNode"
        },
        {
          "$ref": "#/$defs/agentNode"
        },
        {
          "$ref": "#/$defs/subflowNode"
        },
        {
          "$ref": "#/$defs/for_eachNode"
        },
        {
          "$ref": "#/$defs/module_methodNode"
        },
        {
          "$ref": "#/$defs/emit_eventNode"
        }
      ]
    },
    "finallyGraph": {
      "type": "object",
      "properties": {
        "nodes": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/finallyNode"
          },
          "contains": {
            "type": "object",
            "properties": {
              "type": {
                "const": "start"
              }
            },
            "required": [
              "type"
            ]
          },
          "minContains": 1,
          "maxContains": 1
        },
        "edges": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/workflowEdge"
          }
        },
        "timeoutSecs": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 1,
              "maximum": 86400
            },
            {
              "type": "null"
            }
          ],
          "default": 300
        }
      },
      "required": [
        "nodes"
      ]
    },
    "finallyNode": {
      "oneOf": [
        {
          "$ref": "#/$defs/startNode"
        },
        {
          "$ref": "#/$defs/httpNode"
        },
        {
          "$ref": "#/$defs/module_methodNode"
        },
        {
          "$ref": "#/$defs/emit_eventNode"
        },
        {
          "$ref": "#/$defs/joinNode"
        },
        {
          "$ref": "#/$defs/subflowNode"
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/endNode"
            },
            {
              "type": "object",
              "properties": {
                "output": {
                  "type": "null"
                }
              }
            }
          ]
        }
      ]
    }
  }
}
