138 lines
4.4 KiB
JSON
138 lines
4.4 KiB
JSON
{
|
|
"$schema": "../../shared/schemas/conductor-project.schema.json",
|
|
"schemaVersion": "0.1.0",
|
|
"project": {
|
|
"id": "proj_variable_binding_demo",
|
|
"name": "Variable Binding Demo",
|
|
"description": "Demonstrates cross-action data flow via a runtime variable. Step 1 fetches a value and stores it in a variable. Step 2 uses that variable in its request template.",
|
|
|
|
"pages": [
|
|
{
|
|
"id": "page_main",
|
|
"name": "Main Page",
|
|
"order": 0,
|
|
"components": [
|
|
{
|
|
"id": "cmp_btn_step1",
|
|
"type": "Button",
|
|
"name": "btnFetch",
|
|
"position": { "x": 24, "y": 24 },
|
|
"size": { "width": 180, "height": 44 },
|
|
"properties": {
|
|
"label": "Step 1 — Fetch value",
|
|
"visible": true,
|
|
"disabled": false
|
|
},
|
|
"events": [
|
|
{ "event": "onClick", "actionId": "action_step1" }
|
|
]
|
|
},
|
|
{
|
|
"id": "cmp_btn_step2",
|
|
"type": "Button",
|
|
"name": "btnUseVariable",
|
|
"position": { "x": 216, "y": 24 },
|
|
"size": { "width": 220, "height": 44 },
|
|
"properties": {
|
|
"label": "Step 2 — Use variable",
|
|
"visible": true,
|
|
"disabled": false
|
|
},
|
|
"events": [
|
|
{ "event": "onClick", "actionId": "action_step2" }
|
|
]
|
|
},
|
|
{
|
|
"id": "cmp_step1_result",
|
|
"type": "JsonViewer",
|
|
"name": "step1Result",
|
|
"position": { "x": 24, "y": 84 },
|
|
"size": { "width": 580, "height": 160 },
|
|
"properties": {
|
|
"label": "Step 1 raw response",
|
|
"visible": true,
|
|
"disabled": false
|
|
},
|
|
"events": []
|
|
},
|
|
{
|
|
"id": "cmp_step2_result",
|
|
"type": "JsonViewer",
|
|
"name": "step2Result",
|
|
"position": { "x": 24, "y": 260 },
|
|
"size": { "width": 580, "height": 160 },
|
|
"properties": {
|
|
"label": "Step 2 response (used variable in request)",
|
|
"visible": true,
|
|
"disabled": false
|
|
},
|
|
"events": []
|
|
}
|
|
]
|
|
}
|
|
],
|
|
|
|
"actions": [
|
|
{
|
|
"id": "action_step1",
|
|
"name": "Step 1 — GET /get",
|
|
"description": "Fetches a value from the mock server via GET /get. Sends a fixed query parameter 'value=captured-from-step-1'. The response body.args.value field is stored in the runtime variable capturedId.",
|
|
"method": "GET",
|
|
"url": "http://host.docker.internal:8787/get",
|
|
"headers": { "Accept": "application/json" },
|
|
"queryParameters": {
|
|
"value": "captured-from-step-1"
|
|
},
|
|
"pathParameters": {},
|
|
"bodyTemplate": "",
|
|
"authenticationType": "anonymous"
|
|
},
|
|
{
|
|
"id": "action_step2",
|
|
"name": "Step 2 — GET /get using variable",
|
|
"description": "Calls GET /get with capturedId as the 'id' query parameter. Click Step 1 first to populate the variable. The mock server echoes the query parameters back under response.body.args.",
|
|
"method": "GET",
|
|
"url": "http://host.docker.internal:8787/get",
|
|
"headers": { "Accept": "application/json" },
|
|
"queryParameters": {
|
|
"id": "{{variables.capturedId}}"
|
|
},
|
|
"pathParameters": {},
|
|
"bodyTemplate": "",
|
|
"authenticationType": "anonymous"
|
|
}
|
|
],
|
|
|
|
"bindings": [
|
|
{
|
|
"id": "binding_step1_to_viewer",
|
|
"source": "actions.action_step1.response.body",
|
|
"target": "components.step1Result.value",
|
|
"trigger": "onSuccess"
|
|
},
|
|
{
|
|
"id": "binding_step1_to_variable",
|
|
"source": "actions.action_step1.response.body.args.value",
|
|
"target": "variables.capturedId",
|
|
"trigger": "onSuccess"
|
|
},
|
|
{
|
|
"id": "binding_step2_to_viewer",
|
|
"source": "actions.action_step2.response.body",
|
|
"target": "components.step2Result.value",
|
|
"trigger": "onSuccess"
|
|
}
|
|
],
|
|
|
|
"variables": {
|
|
"capturedId": {
|
|
"type": "string",
|
|
"defaultValue": "",
|
|
"description": "Populated by Step 1's response binding. Used as the 'id' query parameter in Step 2's request template {{variables.capturedId}}."
|
|
}
|
|
},
|
|
|
|
"settings": {}
|
|
}
|
|
}
|