You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: dsl.md
+43-10Lines changed: 43 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -99,7 +99,7 @@ Workflows in the Serverless Workflow DSL can exist in several phases, each indic
99
99
100
100
Additionally, the flow of execution within a workflow can be controlled using [directives*](dsl-reference.md#flow-directive), which provide instructions to the workflow engine on how to manage and handle specific aspects of workflow execution.
101
101
102
-
**To learn more about flow directives and how they can be utilized to control the execution and behavior of workflows, please refer to [Flow Directives](dsl-reference.md#flow-directive).*
102
+
\**To learn more about flow directives and how they can be utilized to control the execution and behavior of workflows, please refer to [Flow Directives](dsl-reference.md#flow-directive).*
103
103
104
104
#### Components
105
105
@@ -120,14 +120,14 @@ The Serverless Workflow DSL defines several default [task](dsl-reference.md#task
120
120
121
121
-[Call](dsl-reference.md#call), used to call services and/or functions.
122
122
-[Do](dsl-reference.md#do), used to define one or more subtasks to perform in sequence.
123
-
-[Fork](dsl-reference.md#fork), used to define one or more two subtasks to perform in parallel.
124
123
-[Emit](dsl-reference.md#emit), used to emit [events](dsl-reference.md#event).
125
124
-[For](dsl-reference.md#for), used to iterate over a collection of items, and conditionally perform a task for each of them.
125
+
-[Fork](dsl-reference.md#fork), used to define one or more two subtasks to perform in parallel.
126
126
-[Listen](dsl-reference.md#listen), used to listen for an [event](dsl-reference.md#event) or more.
127
127
-[Raise](dsl-reference.md#raise), used to raise an [error](dsl-reference.md#error) and potentially fault the [workflow](dsl-reference.md#workflow).
128
128
-[Run](dsl-reference.md#run), used to run a [container](dsl-reference.md#container-process), a [script](dsl-reference.md#script-process), a [shell](dsl-reference.md#shell-process) command or even another [workflow](dsl-reference.md#workflow-process).
129
-
-[Switch](dsl-reference.md#switch), used to dynamically select and execute one of multiple alternative paths based on specified conditions
130
129
-[Set](dsl-reference.md#set), used to dynamically set or update the [workflow](dsl-reference.md#workflow)'s data during the its execution.
130
+
-[Switch](dsl-reference.md#switch), used to dynamically select and execute one of multiple alternative paths based on specified conditions
131
131
-[Try](dsl-reference.md#try), used to attempt executing a specified [task](dsl-reference.md#task), and to handle any resulting [errors](dsl-reference.md#error) gracefully, allowing the [workflow](dsl-reference.md#workflow) to continue without interruption.
132
132
-[Wait](dsl-reference.md#wait), used to pause or wait for a specified duration before proceeding to the next task.
133
133
@@ -156,7 +156,7 @@ A workflow begins with the first task defined.
156
156
157
157
Once the task has been executed, different things can happen:
158
158
159
-
-`continue`: the task ran to completion, and the next task, if any, should be executed. The task to run next is implictly the next in declaration order, or explicitly defined by the `then` property of the executed task. If the executed task is the last task, then the workflow's execution gracefully ends.
159
+
-`continue`: the task ran to completion, and the next task, if any, should be executed. The task to run next is implicitly the next in declaration order, or explicitly defined by the `then` property of the executed task. If the executed task is the last task, then the workflow's execution gracefully ends.
160
160
-`fault`: the task raised an uncaught error, which abruptly halts the workflow's execution and makes it transition to `faulted`[status phase](#status-phases).
161
161
-`end`: the task explicitly and gracefully ends the workflow's execution.
162
162
@@ -214,17 +214,50 @@ Runtimes **may** optionally support other runtime expression languages, which au
214
214
215
215
CloudFlows defines [several arguments](#runtime-expression-arguments) that runtimes **must** provide during the evaluation of runtime expressions.
216
216
217
-
When the evaluation of an expression fails, runtimes **must** raise an error with type `https://https://serverlessworkflow.io/spec/1.0.0/errors/expression` and status `400`.
217
+
When the evaluation of an expression fails, runtimes **must** raise an error with type `https://serverlessworkflow.io/spec/1.0.0/errors/expression` and status `400`.
218
218
219
219
#### Runtime expression arguments
220
220
221
221
| Name | Type | Description |
222
222
|:-----|:----:|:------------|
223
-
| context |`map`| The task's context data. |
223
+
| context |`any`| The task's context data. |
224
224
| input |`any`| The task's filtered input. |
225
225
| secrets |`map`| A key/value map of the workflow secrets.<br>To avoid unintentional bleeding, secrets can only be used in the `input.from` runtime expression. |
226
226
| task |[`taskDescriptor`](#task-descriptor)| Describes the current task. |
227
-
| workflow |[`workflowDescritor`](#workflow-descriptor)| Describes the current workflow. |
227
+
| workflow |[`workflowDescriptor`](#workflow-descriptor)| Describes the current workflow. |
228
+
| runtime |[`runtimeDescriptor`](#runtime-descriptor)| Describes the runtime. |
229
+
230
+
##### Runtime Descriptor
231
+
232
+
This argument contains information about the runtime executing the workflow.
233
+
234
+
| Name | Type | Description | Example |
235
+
|:-----|:----:|:------------| ------- |
236
+
| name |`string`| A human friendly name for the runtime. |`Synapse`, `Sonata`|
237
+
| version |`string`| The version of the runtime. This can be an arbitrary string | a incrementing positive integer (`362`), semantic version (`1.4.78`), commit hash (`04cd3be6da98fc35422c8caa821e0aa1ef6b2c02`) or container image label (`v0.7.43-alpine`) |
238
+
| metadata |`map`| An object/map of implementation specific key-value pairs. This can be chosen by runtime implementors and usage of this argument signals that a given workflow definition might not be runtime agnostic | A Software as a Service (SaaS) provider might choose to expose information about the tenant the workflow is executed for e.g. `{ "organization": { "id": "org-ff51cff2-fc83-4d70-9af1-8dacdbbce0be", "name": "example-corp" }, "featureFlags": ["fastZip", "arm64"] }`. |
239
+
240
+
##### Task Descriptor
241
+
242
+
| Name | Type | Description | Example |
243
+
|:-----|:----:|:------------|:--------|
244
+
| name |`string`| The task's name. |`getPet`|
245
+
| definition |`map`| The tasks definition (specified under the name) as a parsed object |`{ "call": "http", "with": { ... } }`|
246
+
| input |`any`| The task's input *BEFORE* the `input.from` expression. For the result of `input.from` expression use the context of the runtime expression (for jq `.`) | - |
247
+
| startedAt.iso8601 |`string`| The start time of the task as a ISO 8601 date time string. It uses `T` as the date-time delimiter, either UTC (`Z`) or a time zone offset (`+01:00`). The precision can be either seconds, milliseconds or nanoseconds |`2022-01-01T12:00:00Z`, `2022-01-01T12:00:00.123456Z`, `2022-01-01T12:00:00.123+01:00`|
248
+
| startedAt.epochMillis |`integer`| The start time of the task as a integer value of milliseconds since midnight of 1970-01-01 UTC |`1641024000123` (="2022-01-01T08:00:00.123Z") |
249
+
| startedAt.epochNanos |`integer`| The start time of the task as a integer value of nanoseconds since midnight of 1970-01-01 UTC |`1641024000123456` (="2022-01-01T08:00:00.123456Z") |
250
+
251
+
##### Workflow Descriptor
252
+
253
+
| Name | Type | Description | Example |
254
+
|:-----|:----:|:------------|:--------|
255
+
| id |`string`| A unique id of the workflow execution. Now specific format is imposed | UUIDv4: `4a5c8422-5868-4e12-8dd9-220810d2b9ee`, ULID: `0000004JFGDSW1H037G7J7SFB9`|
256
+
| definition |`map`| The workflow's definition as a parsed object |`{ "document": { ... }, "do": [...] }`|
257
+
| input |`any`| The workflow's input *BEFORE* the `input.from` expression. For the result of `input.from` expression use the `$input` argument | - |
258
+
| startedAt.iso8601 |`string`| The start time of the execution as a ISO 8601 date time string. It uses `T` as the date-time delimiter, either UTC (`Z`) or a time zone offset (`+01:00`). The precision can be either seconds, milliseconds or nanoseconds |`2022-01-01T12:00:00Z`, `2022-01-01T12:00:00.123456Z`, `2022-01-01T12:00:00.123+01:00`|
259
+
| startedAt.epochMillis |`integer`| The start time of the execution as a integer value of milliseconds since midnight of 1970-01-01 UTC |`1641024000123` (="2022-01-01T08:00:00.123Z") |
260
+
| startedAt.epochNanos |`integer`| The start time of the execution as a integer value of nanoseconds since midnight of 1970-01-01 UTC |`1641024000123456` (="2022-01-01T08:00:00.123456Z") |
228
261
229
262
### Fault Tolerance
230
263
@@ -238,7 +271,7 @@ Errors in Serverless Workflow are described using the [Problem Details RFC](http
detail: The service is currently unavailable. Please try again later.
@@ -281,7 +314,7 @@ Workflows and tasks alike can be configured to timeout after a defined amount of
281
314
282
315
When a timeout occur, runtimes **must** abruptly interrupt the execution of the workflow/task, and **must** raise an error that, if uncaught, force the workflow/task to transition to the [`faulted` status phase](#status-phases).
283
316
284
-
A timeout error **must** have its `type` set to `https://https://serverlessworkflow.io/spec/1.0.0/errors/timeout` and **should** have its `status` set to `408`.
317
+
A timeout error **must** have its `type` set to `https://serverlessworkflow.io/spec/1.0.0/errors/timeout` and **should** have its `status` set to `408`.
285
318
286
319
### Interoperability
287
320
@@ -293,7 +326,7 @@ Serverless Workflow DSL is designed to seamlessly interact with a variety of ser
293
326
- [**AsyncAPI**](dsl-reference.md#asyncapi-call): Facilitates interaction with asynchronous messaging protocols. AsyncAPI is designed for event-driven architectures, allowing workflows to publish and subscribe to events.
294
327
- [**OpenAPI**](dsl-reference.md#openapi-call): Enables communication with services that provide OpenAPI specifications, which is useful for defining and consuming RESTful APIs.
295
328
296
-
Runtimes **must** raise an error with type `https://https://serverlessworkflow.io/spec/1.0.0/errors/communication` if and when a problem occurs during a call.
329
+
Runtimes **must** raise an error with type `https://serverlessworkflow.io/spec/1.0.0/errors/communication` if and when a problem occurs during a call.
description: A name/value mapping of the headers, if any, of the HTTP request to perform.
267
268
body:
268
269
description: The body, if any, of the HTTP request to perform.
270
+
query:
271
+
type: object
272
+
additionalProperties: true
273
+
description: A name/value mapping of the query parameters, if any, of the HTTP request to perform.
269
274
output:
270
275
type: string
271
276
enum: [ raw, content, response ]
@@ -365,37 +370,9 @@ $defs:
365
370
event:
366
371
type: object
367
372
properties:
368
-
id:
369
-
type: string
370
-
description: The event's unique identifier
371
-
source:
372
-
description: Identifies the context in which an event happened
373
-
oneOf:
374
-
- title: LiteralSource
375
-
type: string
376
-
format: uri-template
377
-
- $ref: '#/$defs/runtimeExpression'
378
-
type:
379
-
type: string
380
-
description: This attribute contains a value describing the type of event related to the originating occurrence.
381
-
time:
382
-
oneOf:
383
-
- title: LiteralTime
384
-
type: string
385
-
format: date-time
386
-
- $ref: '#/$defs/runtimeExpression'
387
-
subject:
388
-
type: string
389
-
datacontenttype:
390
-
type: string
391
-
description: Content type of data value. This attribute enables data to carry any type of content, whereby format and encoding might differ from that of the chosen event format.
392
-
dataschema:
393
-
oneOf:
394
-
- title: LiteralDataSchema
395
-
type: string
396
-
format: uri-template
397
-
- $ref: '#/$defs/runtimeExpression'
398
-
required: [ source, type ]
373
+
with:
374
+
$ref: '#/$defs/eventProperties'
375
+
required: [ source, type ]
399
376
additionalProperties: true
400
377
required: [ event ]
401
378
forTask:
@@ -504,11 +481,16 @@ $defs:
504
481
language:
505
482
type: string
506
483
description: The language of the script to run.
484
+
arguments:
485
+
title: ScriptArguments
486
+
type: object
487
+
additionalProperties: true
488
+
description: A key/value mapping of the arguments, if any, to use when running the configured script.
507
489
environment:
508
490
title: ScriptEnvironment
509
491
type: object
510
492
additionalProperties: true
511
-
description: A key/value mapping of the environment variables, if any, to use when running the configured process.
493
+
description: A key/value mapping of the environment variables, if any, to use when running the configured script process.
512
494
oneOf:
513
495
- title: ScriptInline
514
496
properties:
@@ -730,7 +712,7 @@ $defs:
730
712
properties:
731
713
authority:
732
714
type: string
733
-
format: uri
715
+
format: uri-template
734
716
description: The URI that references the OAuth2 authority to use.
735
717
grant:
736
718
type: string
@@ -848,6 +830,40 @@ $defs:
848
830
$ref: '#/$defs/referenceableAuthenticationPolicy'
849
831
description: The authentication policy to use.
850
832
required: [ uri ]
833
+
eventProperties:
834
+
type: object
835
+
properties:
836
+
id:
837
+
type: string
838
+
description: The event's unique identifier
839
+
source:
840
+
description: Identifies the context in which an event happened
841
+
oneOf:
842
+
- title: LiteralSource
843
+
type: string
844
+
format: uri-template
845
+
- $ref: '#/$defs/runtimeExpression'
846
+
type:
847
+
type: string
848
+
description: This attribute contains a value describing the type of event related to the originating occurrence.
849
+
time:
850
+
oneOf:
851
+
- title: LiteralTime
852
+
type: string
853
+
format: date-time
854
+
- $ref: '#/$defs/runtimeExpression'
855
+
subject:
856
+
type: string
857
+
datacontenttype:
858
+
type: string
859
+
description: Content type of data value. This attribute enables data to carry any type of content, whereby format and encoding might differ from that of the chosen event format.
860
+
dataschema:
861
+
oneOf:
862
+
- title: LiteralDataSchema
863
+
type: string
864
+
format: uri-template
865
+
- $ref: '#/$defs/runtimeExpression'
866
+
additionalProperties: true
851
867
eventConsumptionStrategy:
852
868
type: object
853
869
unevaluatedProperties: false
@@ -880,28 +896,8 @@ $defs:
880
896
properties:
881
897
with:
882
898
title: WithEvent
883
-
type: object
899
+
$ref: '#/$defs/eventProperties'
884
900
minProperties: 1
885
-
properties:
886
-
id:
887
-
type: string
888
-
description: The event's unique identifier
889
-
source:
890
-
type: string
891
-
description: Identifies the context in which an event happened
892
-
type:
893
-
type: string
894
-
description: This attribute contains a value describing the type of event related to the originating occurrence.
895
-
time:
896
-
type: string
897
-
subject:
898
-
type: string
899
-
datacontenttype:
900
-
type: string
901
-
description: Content type of data value. This attribute enables data to carry any type of content, whereby format and encoding might differ from that of the chosen event format.
902
-
dataschema:
903
-
type: string
904
-
additionalProperties: true
905
901
description: An event filter is a mechanism used to selectively process or handle events based on predefined criteria, such as event type, source, or specific attributes.
0 commit comments