Skip to main content

Understanding the DSL

Zigflow is built upon the CNCF's Serverless Workflow project. This provides a solid foundation of a comprehensive and vendor-neutral framework. The specification is well documented and acts as the inspiration behind this project.

Zigflow supports Serverless Workflow v1.0.0 and above.

By design, some aspects of the specification will not be implemented, may diverge from the Serverless Workflow specification, or will implement additional aspects. These will be documented.

Workflow

A workflow serves as a blueprint outlining the series of tasks required to execute a specific business operation. It details the sequence in which tasks must be completed, guiding users through the process from start to finish, and helps streamline operations, ensure consistency, and optimise efficiency within an organisation.

Properties

NameTypeRequiredDescription
documentdocumentyesDocuments the defined workflow.
domap[string, task]yesThe task(s) that must be performed by the workflow.
inputinputnoConfigures the workflow's input.
timeouttimeoutnoThe configuration of the workflow's activity Start-To-Close timeout. Defaults to 5 minutes
scheduleschedulenoConfigures the workflow's schedule, if any.

Document

Documents the workflow definition.

NameTypeRequiredDescription
dslstringyesThe version of the DSL used to define the workflow.
namespacestringyesThe Temporal Task Queue.

IMPORTANT: this does not map to the Temporal namespace, which is part of the connection information set at runtime.
namestringyesThe Temporal workflow's name. This will be ignored if multiple do are set and the workflow names will be taken from the step name
versionstringyesThe workflow's semantic version
titlestringnoThe workflow's title.
summarystringnoThe workflow's Markdown summary.
tagsmap[string, string]noA key/value mapping of the workflow's tags, if any.
metadatamapnoAdditional information about the workflow.

Input

Documents the structure - and optionally configures the transformation of - workflow/task input data.

It's crucial for authors to document the schema of input data whenever feasible. This documentation empowers consuming applications to provide contextual auto-suggestions when handling runtime expressions.

When set, runtimes must validate raw input data against the defined schema before applying transformations, unless defined otherwise.

Properties

PropertyTypeRequiredDescription
schemaschemanoThe JSON schema used to describe and validate raw input data.

Even though the schema is not required, it is strongly encouraged to document it, whenever feasible. The input will be validated against this schema, returning an error if the given input does not match.

Examples

schema:
format: json
document:
type: object
properties:
order:
type: object
required:
- pet
properties:
pet:
type: object
required:
- id
properties:
id:
type: string

Timeout

Defines a workflow or task timeout.

Properties

PropertyTypeRequiredDescription
afterdurationyesThe duration after which the workflow or task times out.

Examples

document:
dsl: '1.0.2'
namespace: default
name: timeout-example
version: '0.1.0'
do:
- waitAMinute:
wait:
seconds: 60
timeout:
after:
seconds: 30

Duration

Defines a duration. Durations can be defined through properties, with an ISO 8601 string or with a runtime expression that is evaluated to an ISO 8601 string

Properties

PropertyTypeRequiredDescription
DaysintegernoNumber of days, if any.
HoursintegernoNumber of hours, if any.
MinutesintegernoNumber of minutes, if any.
SecondsintegernoNumber of seconds, if any.
MillisecondsintegernoNumber of milliseconds, if any.

Examples

Example of a duration of 2 hours, 15 minutes and 30 seconds:

hours: 2
minutes: 15
seconds: 30

Schedule

Configures the schedule of a workflow.

NameTypeRequiredDescription
everydurationnoSpecifies the duration of the interval at which the workflow should be executed. Unlike after, this option will run the workflow regardless of whether the previous run is still in progress.
Required when no other property has been set.
cronstringnoSpecifies the schedule using a CRON expression, e.g., 0 0 * * * for daily at midnight.
Required when no other property has been set.

Metadata

Additional options can be configured by setting metadata in the Document. This configures a Temporal schedule.

NameTypeRequiredDescription
scheduleWorkflowNamestringyesSet the workflow name to trigger - this will either be the document.name or the Do task
scheduleIdstringnoSet the schedule ID. If not set, this will to zigflow_<workflow.document.name>
scheduleInputany[]noSet the input