209 lines
5.6 KiB
JSON
209 lines
5.6 KiB
JSON
{
|
|
"id": "test-workflow-001",
|
|
"name": "端到端测试工作流",
|
|
"description": "用于测试节点间输入输出映射的工作流",
|
|
"version": "1.0",
|
|
"nodes": [
|
|
{
|
|
"id": "start",
|
|
"type": "start",
|
|
"name": "开始",
|
|
"position": { "x": 100, "y": 200 },
|
|
"config": {},
|
|
"inputMapping": {},
|
|
"outputSchema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"workflow": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": { "type": "string" },
|
|
"executionId": { "type": "string" },
|
|
"startTime": { "type": "string" }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"id": "nodeA",
|
|
"type": "http_request",
|
|
"name": "节点A - HTTP请求",
|
|
"position": { "x": 300, "y": 200 },
|
|
"config": {
|
|
"url": "https://httpbin.org/json",
|
|
"method": "GET",
|
|
"headers": {}
|
|
},
|
|
"inputMapping": {
|
|
"url": "https://httpbin.org/json",
|
|
"method": "GET"
|
|
},
|
|
"outputSchema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"httpStatusCode": { "type": "integer" },
|
|
"responseBody": { "type": "object" },
|
|
"responseHeaders": { "type": "object" },
|
|
"requestUrl": { "type": "string" }
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"id": "nodeB",
|
|
"type": "http_request",
|
|
"name": "节点B - 处理A的输出",
|
|
"position": { "x": 500, "y": 200 },
|
|
"config": {
|
|
"url": "https://httpbin.org/post",
|
|
"method": "POST",
|
|
"headers": {
|
|
"Content-Type": "application/json"
|
|
}
|
|
},
|
|
"inputMapping": {
|
|
"url": "https://httpbin.org/post",
|
|
"method": "POST",
|
|
"body": "${nodes.nodeA.output.responseBody}",
|
|
"headers": {
|
|
"Content-Type": "application/json",
|
|
"X-Source-Status": "${nodes.nodeA.output.httpStatusCode}"
|
|
}
|
|
},
|
|
"outputSchema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"httpStatusCode": { "type": "integer" },
|
|
"responseBody": { "type": "object" },
|
|
"sourceData": { "type": "object" },
|
|
"processedAt": { "type": "string" }
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"id": "nodeC",
|
|
"type": "http_request",
|
|
"name": "节点C - 聚合AB数据",
|
|
"position": { "x": 700, "y": 200 },
|
|
"config": {
|
|
"url": "https://httpbin.org/put",
|
|
"method": "PUT",
|
|
"headers": {
|
|
"Content-Type": "application/json"
|
|
}
|
|
},
|
|
"inputMapping": {
|
|
"url": "https://httpbin.org/put",
|
|
"method": "PUT",
|
|
"body": {
|
|
"nodeA_result": "${nodes.nodeA.output}",
|
|
"nodeB_result": "${nodes.nodeB.output}",
|
|
"combined_status": "${nodes.nodeA.output.httpStatusCode + nodes.nodeB.output.httpStatusCode}"
|
|
},
|
|
"headers": {
|
|
"Content-Type": "application/json",
|
|
"X-Node-A-Status": "${nodes.nodeA.output.httpStatusCode}",
|
|
"X-Node-B-Status": "${nodes.nodeB.output.httpStatusCode}"
|
|
}
|
|
},
|
|
"outputSchema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"httpStatusCode": { "type": "integer" },
|
|
"responseBody": { "type": "object" },
|
|
"aggregatedData": { "type": "object" },
|
|
"finalResult": { "type": "string" }
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"id": "nodeD",
|
|
"type": "http_request",
|
|
"name": "节点D - 最终处理",
|
|
"position": { "x": 900, "y": 200 },
|
|
"config": {
|
|
"url": "https://httpbin.org/patch",
|
|
"method": "PATCH",
|
|
"headers": {
|
|
"Content-Type": "application/json"
|
|
}
|
|
},
|
|
"inputMapping": {
|
|
"url": "https://httpbin.org/patch",
|
|
"method": "PATCH",
|
|
"body": {
|
|
"workflow_summary": {
|
|
"nodeA_status": "${nodes.nodeA.output.httpStatusCode}",
|
|
"nodeB_status": "${nodes.nodeB.output.httpStatusCode}",
|
|
"nodeC_status": "${nodes.nodeC.output.httpStatusCode}",
|
|
"total_requests": 4,
|
|
"execution_chain": "Start → A → B → C → D"
|
|
}
|
|
},
|
|
"headers": {
|
|
"Content-Type": "application/json",
|
|
"X-Final-Step": "true"
|
|
}
|
|
},
|
|
"outputSchema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"httpStatusCode": { "type": "integer" },
|
|
"responseBody": { "type": "object" },
|
|
"workflowSummary": { "type": "object" },
|
|
"completed": { "type": "boolean" }
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"id": "end",
|
|
"type": "end",
|
|
"name": "结束",
|
|
"position": { "x": 1100, "y": 200 },
|
|
"config": {},
|
|
"inputMapping": {
|
|
"finalResult": "${nodes.nodeD.output}",
|
|
"workflowComplete": true
|
|
},
|
|
"outputSchema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"workflowResult": { "type": "object" },
|
|
"completed": { "type": "boolean" }
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"edges": [
|
|
{
|
|
"id": "start-to-nodeA",
|
|
"source": "start",
|
|
"target": "nodeA",
|
|
"condition": null
|
|
},
|
|
{
|
|
"id": "nodeA-to-nodeB",
|
|
"source": "nodeA",
|
|
"target": "nodeB",
|
|
"condition": "${nodes.nodeA.output.httpStatusCode == 200}"
|
|
},
|
|
{
|
|
"id": "nodeB-to-nodeC",
|
|
"source": "nodeB",
|
|
"target": "nodeC",
|
|
"condition": "${nodes.nodeB.output.httpStatusCode == 200}"
|
|
},
|
|
{
|
|
"id": "nodeC-to-nodeD",
|
|
"source": "nodeC",
|
|
"target": "nodeD",
|
|
"condition": "${nodes.nodeC.output.httpStatusCode == 200}"
|
|
},
|
|
{
|
|
"id": "nodeD-to-end",
|
|
"source": "nodeD",
|
|
"target": "end",
|
|
"condition": null
|
|
}
|
|
]
|
|
} |