Lemline documentation Help

DSL Syntax Reference

Lemline reads Open Workflow DSL definitions in YAML and JSON. See Supported Features for the subset the runner executes.

Workflow structure

A definition contains a document with its identity and a do list of named tasks. The optional input and output sections describe data validation and transformation.

document: dsl: '1.0.3' namespace: examples name: validate-and-route-order version: '1.0.0' input: schema: format: json document: type: object required: [orderId, total] properties: orderId: type: string total: type: number minimum: 0 do: - routeOrder: switch: - largeOrder: when: ${ .total >= 1000 } then: requestReview - automatic: then: acceptOrder - requestReview: set: status: needs-review then: exit - acceptOrder: set: status: accepted output: as: '${ { orderId: $workflow.input.orderId, status: .status } }'

Data and expressions

Write a jq expression as ${ expression }. Within a task, . is the current input, $workflow.input is the original workflow input, and $context is the data shared by tasks through export.as.

document: dsl: '1.0.3' namespace: examples name: transform-workflow-data version: '1.0.0' input: from: '${ { customer: .user, items: .payload.items } }' do: - summarize: set: customerId: ${ .customer.id } itemCount: ${ .items | length } output: as: '${ { customerId, itemCount } }'

Shared resources

Declare reusable authentication policies, errors, functions, retries, timeouts and catalogs under use. Tasks can refer to these resources by their declared names.

document: dsl: '1.0.3' namespace: examples name: retry-and-fallback version: '1.0.0' use: retries: transient: delay: PT2S backoff: exponential: {} limit: attempt: count: 3 do: - fetchInventory: try: - requestInventory: call: http with: method: get endpoint: http://127.0.0.1:8787/stock query: fail: '503' failTimes: ${ .failures // 0 | tostring } key: ${ $workflow.id } catch: errors: with: type: https://open-workflow-specification.org/spec/1.0.0/errors/communication status: 503 retry: transient do: - useCachedInventory: set: inventory: [] stale: true

Task and flow structure

A task list contains maps with one named task each. Constructs such as for, fork, switch and try control flow inside the list. Use then to change the default sequential flow.

document: dsl: '1.0.3' namespace: examples name: map-order-items version: '1.0.0' do: - calculateTotals: for: each: item in: ${ .items } at: index do: - calculateLine: set: itemId: ${ $item.id } index: ${ $index } lineTotal: ${ $item.quantity * $item.price }

See Task Types for individual constructs, Authentication for credential placement, and How to Define a Workflow for the main authoring steps.

Run the Examples

Every example on this page is a complete workflow. Complete the SQLite setup, save each example under the file name used below, and run the commands from the setup directory. With the JAR, substitute java -jar lemline.jar for bin/lemline.

Start the tutorial shop from the root of the Lemline source checkout:

docker compose -f examples/tutorial-services/compose.yaml up -d

Keep the setup worker running and use a second terminal in the setup directory.

bin/lemline definition post -f validate-and-route-order.yaml bin/lemline instance start examples validate-and-route-order --input '{"orderId":"ORD-301","total":250}' bin/lemline definition post -f transform-workflow-data.yaml bin/lemline instance start examples transform-workflow-data --input '{"user":{"id":"C-100"},"payload":{"items":[{"id":"SKU-1"},{"id":"SKU-2"}]}}' bin/lemline definition post -f retry-and-fallback.yaml bin/lemline instance start examples retry-and-fallback --input '{"failures":1}' bin/lemline definition post -f map-order-items.yaml bin/lemline instance start examples map-order-items --input '{"items":[{"id":"SKU-1","quantity":2,"price":25},{"id":"SKU-2","quantity":1,"price":12}]}'

Example

Expected result

validate-and-route-order

{"orderId":"ORD-301","status":"accepted"}

transform-workflow-data

{"customerId":"C-100","itemCount":2}

retry-and-fallback

The stock, after one retry

map-order-items

The last line, {"itemId":"SKU-2","index":1,"lineTotal":12}

Stop the shop when you are done:

docker compose -f examples/tutorial-services/compose.yaml down
25 November 2026