Skip to main content

Explicit Dependencies

In Rumour, explicit dependencies are declared inside a Consumer's Request Node using the [dependencies] TOML block. This block tells the execution engine which upstream Producer nodes must be executed first, and which extracted variables the Consumer expects to receive.

Syntax Formats​

Rumour supports two distinct syntax formats for defining dependencies depending on your specific use-case.

The Map format is the most concise way to declare dependencies. It uses a standard TOML dictionary where the key is the path to the producer file, and the value is the variable name (or a list of variable names) you wish to extract.

[dependencies]
# Extract a single variable
"../../producer/requests/producer_node.toml" = "token"

# Extract multiple variables from the same producer
"../../producer/requests/producer_node.toml" = ["token", "user_id"]

2. The List Format​

For users who prefer explicitly typed arrays or need to attach future metadata to a specific dependency declaration, the List format using TOML's array-of-tables syntax ([[dependencies]]) is available.

[[dependencies]]
producer_id = "../../producer/requests/producer_node.toml"
consumer_var = "token"

[[dependencies]]
producer_id = "../../producer/requests/producer_node.toml"
consumer_var = "user_id"
note

Both formats are functionally identical under the hood. The Map format is highly recommended for readability.

Execution Trace Example​

When a Consumer declares a dependency, Rumour guarantees that the Producer will be executed before the Consumer is allowed to run.

1. Setup Environment​

To set up a test environment from scratch and replicate the workspace example, follow these steps:

mkdir dependency_example
cd dependency_example
rumour init
rumour new producer
rumour new consumer

2. File Contents​

Here are the complete contents for each relevant file in this setup:

workspace.env.toml​

Defines base variables and global environment definitions.

# workspace.env.toml
[variables]
base_url = "http://localhost:4000"

producer/requests/producer_node.toml​

Performs authentication and extracts the returned session_token from the JSON body payload.

# producer/requests/producer_node.toml
[request]
method = "POST"
url = "{{base_url}}/post"

[body]
type = "json"
raw = '{"session_token": "abc_123_xyz"}'

[extract]
token = "json.session_token"

consumer/requests/consumer_node.toml​

Consumes the token extracted by producer_node.toml by declaring an explicit dependency path.

# consumer/requests/consumer_node.toml
[dependencies]
"../../producer/requests/producer_node.toml" = "token"

[request]
method = "GET"
url = "{{base_url}}/headers"

[headers]
Authorization = "Bearer {{token}}"

3. Run the Requests & Outputs​

To run the execution of the consumer request, execute the following command. The runner automatically detects the dependency on producer_node.toml, executes it, extracts the token, and passes it to consumer_node.toml:

Command​

rumour run consumer/requests/consumer_node.toml -tv

Output Trace​

POST http://localhost:4000/post
URL: http://localhost:4000/post
Body (json): {"session_token": "abc_123_xyz"}
✓ SUCCESS: /home/bugsfounder/workspace/testing/dependency_example/producer/requests/producer_node.toml (2347ms)

GET http://localhost:4000/headers
Header: Authorization: Bearer abc_123_xyz
URL: http://localhost:4000/headers
✓ SUCCESS: /home/bugsfounder/workspace/testing/dependency_example/consumer/requests/consumer_node.toml (785ms)
✓ dependency_example/consumer/requests/consumer_node.toml → PASS (2 Pass, 0 Fail, 0 Skip)
╭──────────────────────────────────────────────────────────────────────────╮
│ RUMOUR EXECUTION REPORT │
├──────────────────────────────────────────────────────────────────────────┤
│ Total Requests: 2 │
│ Successful: 2 │
│ Failed: 0 │
│ Skipped: 0 │
│ Success Rate: 100.0% │
│ Total Time: 3140ms │
╰──────────────────────────────────────────────────────────────────────────╯

✓ Successful Requests:
- /home/bugsfounder/workspace/testing/dependency_example/producer/requests/producer_node.toml [200] [2353ms]
- /home/bugsfounder/workspace/testing/dependency_example/consumer/requests/consumer_node.toml [200] [787ms]

Actionable Recommendations:
→ Run with --json to export this report for your CI/CD pipeline.

Notice how consumer_node.toml correctly injects the abc_123_xyz token into its Authorization header after waiting for the upstream producer.