Skip to content

Commit 4f17742

Browse files
committed
Added the schedule top level property to the workflow
Signed-off-by: Charles d'Avernas <[email protected]>
1 parent 3dcdcd8 commit 4f17742

File tree

2 files changed

+78
-36
lines changed

2 files changed

+78
-36
lines changed

dsl-reference.md

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
+ [Error](#error)
3838
+ [Error Filter](#error-filter)
3939
+ [Retry Policy](#retry-policy)
40-
+ [Input Data Model](#input-data-model)
41-
+ [Output Data Model](#output-data-model)
40+
+ [Input](#input)
41+
+ [Output](#output)
4242
+ [Timeout](#timeout)
4343
+ [Duration](#duration)
4444
+ [HTTP Response](#http-response)
@@ -58,18 +58,38 @@ A [workflow](#workflow) serves as a blueprint outlining the series of [tasks](#t
5858

5959
| Name | Type | Required | Description|
6060
|:--|:---:|:---:|:---|
61-
| document.dsl | `string` | `yes` | The version of the DSL used by the workflow. |
62-
| document.namespace | `string` | `yes` | The workflow's namespace.<br> |
63-
| document.name | `string` | `yes` | The workflow's name.<br> |
64-
| document.version | `string` | `yes` | The workflow's [semantic version](#semantic-version). |
65-
| document.title | `string` | `no` | The workflow's title. |
66-
| document.summary | `string` | `no` | The workflow's Markdown summary. |
67-
| document.tags | `map[string, string]` | `no` | A key/value mapping of the workflow's tags, if any. |
68-
| input | [`inputDataModel`](#input-data-model) | `no` | Configures the workflow's input. |
61+
| document | [`document`](#document) | `yes` | Documents the defined workflow. |
62+
| input | [`inputDataModel`](#input) | `no` | Configures the workflow's input. |
6963
| use | [`componentCollection`](#component-collection) | `no` | A collection containing the workflow's reusable components. |
7064
| do | [`map[string, task]`](#task) | `yes` | The [task(s)](#task) that must be performed by the [workflow](#workflow). |
7165
| timeout | [`timeout`](#timeout) | `no` | The configuration, if any, of the workflow's timeout. |
72-
| output | [`outputDataModel`](#output-data-model) | `no` | Configures the workflow's output. |
66+
| output | [`outputDataModel`](#output) | `no` | Configures the workflow's output. |
67+
| schedule | [`schedule`](#schedule) | `no` | Configures the workflow's schedule, if any. |
68+
69+
#### Document
70+
71+
Documents the workflow definition.
72+
73+
| Name | Type | Required | Description|
74+
|:--|:---:|:---:|:---|
75+
| dsl | `string` | `yes` | The version of the DSL used to define the workflow. |
76+
| namespace | `string` | `yes` | The workflow's namespace.<br> |
77+
| name | `string` | `yes` | The workflow's name.<br> |
78+
| version | `string` | `yes` | The workflow's [semantic version]
79+
| title | `string` | `no` | The workflow's title. |
80+
| summary | `string` | `no` | The workflow's Markdown summary. |
81+
| tags | `map[string, string]` | `no` | A key/value mapping of the workflow's tags, if any. |
82+
83+
#### Schedule
84+
85+
Configures a workflow's schedule.
86+
87+
| Name | Type | Required | Description|
88+
|:--|:---:|:---:|:---|
89+
| every | [`duration`](#duration) | `no` | Specifies 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.<br>*Required when no other property has been set.* |
90+
| cron | `string` | `no` | Specifies the schedule using a CRON expression, e.g., '0 0 * * *' for daily at midnight.<br>*Required when no other property has been set.* |
91+
| after | [`duration`](#duration) | `no` | Specifies a delay duration that the workflow must wait before starting again after it completes. In other words, when this workflow completes, it should run again after the specified amount of time.<br>*Required when no other property has been set.* |
92+
| on | [`eventConsumptionStrategy`](#event-consumption-strategy) | `no` | Specifies the events that trigger the workflow execution.<br>*Required when no other property has been set.* |
7393

7494
#### Examples
7595

@@ -182,8 +202,8 @@ The Serverless Workflow DSL defines a list of [tasks](#task) that **must be** su
182202

183203
| Name | Type | Required | Description|
184204
|:--|:---:|:---:|:---|
185-
| input | [`inputDataModel`](#input-data-model) | `no` | An object used to customize the task's input and to document its schema, if any. |
186-
| output | [`outputDataModel`](#output-data-model) | `no` | An object used to customize the task's output and to document its schema, if any. |
205+
| input | [`inputDataModel`](#input) | `no` | An object used to customize the task's input and to document its schema, if any. |
206+
| output | [`outputDataModel`](#output) | `no` | An object used to customize the task's output and to document its schema, if any. |
187207
| timeout | [`timeout`](#timeout) | `no` | The configuration of the task's timeout, if any. |
188208
| then | [`flowDirective`](#flow-directive) | `no` | The flow directive to execute next.<br>*If not set, defaults to `continue`.* |
189209

@@ -855,7 +875,7 @@ Serves as a mechanism within workflows to handle errors gracefully, potentially
855875
| Name | Type | Required | Description|
856876
|:--|:---:|:---:|:---|
857877
| try | [`task`](#task) | `yes` | The task to perform. |
858-
| catch | [`catchClause`](#catch-clause) | `yes` | Configures the errors to catch and how to handle them. |
878+
| catch | [`catch`](#catch) | `yes` | Configures the errors to catch and how to handle them. |
859879

860880
##### Examples
861881

@@ -888,9 +908,9 @@ do:
888908
count: 5
889909
```
890910

891-
##### Catch Clause
911+
##### Catch
892912

893-
Defines the configuration of a concept used to catch errors
913+
Defines the configuration of a catch clause, which a concept used to catch errors.
894914

895915
###### Properties
896916

@@ -1292,7 +1312,7 @@ Represents the definition of the parameters that control the randomness or varia
12921312
12931313
```
12941314

1295-
### Input Data Model
1315+
### Input
12961316

12971317
Documents the structure - and optionally configures the filtering of - workflow/task input data.
12981318

@@ -1321,7 +1341,7 @@ schema:
13211341
from: .order.pet
13221342
```
13231343

1324-
### Output Data Model
1344+
### Output
13251345

13261346
Documents the structure - and optionally configures the filtering of - workflow/task output data.
13271347

schema/workflow.yaml

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,22 @@ properties:
8383
output:
8484
$ref: '#/$defs/output'
8585
description: Configures the workflow's output.
86+
schedule:
87+
type: object
88+
properties:
89+
every:
90+
$ref: '#/$defs/duration'
91+
description: Specifies the duration of the interval at which the workflow should be executed.
92+
cron:
93+
type: string
94+
description: Specifies the schedule using a cron expression, e.g., '0 0 * * *' for daily at midnight."
95+
after:
96+
$ref: '#/$defs/duration'
97+
description: Specifies a delay duration that the workflow must wait before starting again after it completes.
98+
on:
99+
$ref: '#/$defs/eventConsumptionStrategy'
100+
description: Specifies the events that trigger the workflow execution.
101+
description: Schedules the workflow
86102
$defs:
87103
task:
88104
type: object
@@ -343,24 +359,8 @@ $defs:
343359
type: object
344360
properties:
345361
to:
346-
type: object
347-
oneOf:
348-
- properties:
349-
all:
350-
type: array
351-
items:
352-
$ref: '#/$defs/eventFilter'
353-
required: [ all ]
354-
- properties:
355-
any:
356-
type: array
357-
items:
358-
$ref: '#/$defs/eventFilter'
359-
required: [ any ]
360-
- properties:
361-
one:
362-
$ref: '#/$defs/eventFilter'
363-
required: [ one ]
362+
$ref: '#/$defs/eventConsumptionStrategy'
363+
description: Defines the event(s) to listen to.
364364
required: [ to ]
365365
required: [ listen ]
366366
description: Provides a mechanism for workflows to await and react to external events, enabling event-driven behavior within workflow systems.
@@ -668,6 +668,28 @@ $defs:
668668
$ref: '#/$defs/authenticationPolicy'
669669
description: The authentication policy to use.
670670
required: [ uri ]
671+
eventConsumptionStrategy:
672+
type: object
673+
oneOf:
674+
- properties:
675+
all:
676+
type: array
677+
items:
678+
$ref: '#/$defs/eventFilter'
679+
description: A list containing all the events that must be consumed.
680+
required: [ all ]
681+
- properties:
682+
any:
683+
type: array
684+
items:
685+
$ref: '#/$defs/eventFilter'
686+
description: A list containing any of the events to consume.
687+
required: [ any ]
688+
- properties:
689+
one:
690+
$ref: '#/$defs/eventFilter'
691+
description: The single event to consume.
692+
required: [ one ]
671693
eventFilter:
672694
type: object
673695
properties:

0 commit comments

Comments
 (0)