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-reference.md
+37-19Lines changed: 37 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -50,6 +50,7 @@
50
50
+[Duration](#duration)
51
51
+[HTTP Response](#http-response)
52
52
+[HTTP Request](#http-request)
53
+
+[URI Template](#uri-template)
53
54
54
55
## Abstract
55
56
@@ -83,7 +84,7 @@ Documents the workflow definition.
83
84
| dsl |`string`|`yes`| The version of the DSL used to define the workflow. |
84
85
| namespace |`string`|`yes`| The workflow's namespace.<br> |
85
86
| name |`string`|`yes`| The workflow's name.<br> |
86
-
| version | `string` | `yes` | The workflow's [semantic version]
87
+
| version |`string`|`yes`| The workflow's [semantic version](https://semver.org/)|
87
88
| title |`string`|`no`| The workflow's title. |
88
89
| summary |`string`|`no`| The workflow's Markdown summary. |
89
90
| tags |`map[string, string]`|`no`| A key/value mapping of the workflow's tags, if any. |
@@ -279,7 +280,7 @@ do:
279
280
280
281
Serverless Workflow defines several default functions that **MUST** be supported by all implementations and runtimes:
281
282
282
-
- [AsyncAPI](#asyncapi)
283
+
- [AsyncAPI](#asyncapi-call)
283
284
- [gRPC](#grpc-call)
284
285
- [HTTP](#http-call)
285
286
- [OpenAPI](#openapi-call)
@@ -529,9 +530,9 @@ Allows workflows to iterate over a collection of items, executing a defined set
529
530
| Name | Type | Required | Description|
530
531
|:--|:---:|:---:|:---|
531
532
| for.each | `string` | `no` | The name of the variable used to store the current item being enumerated.<br>Defaults to `item`. |
532
-
| for.in | `string` | `yes` | A [runtime expression](#runtime-expressions) used to get the collection to enumerate. |
533
+
| for.in | `string` | `yes` | A [runtime expression](./dsl.md/#runtime-expressions) used to get the collection to enumerate. |
533
534
| for.at | `string` | `no` | The name of the variable used to store the index of the current item being enumerated.<br>Defaults to `index`. |
534
-
| while | `string` | `no` | A [runtime expression](#runtime-expressions) that represents the condition, if any, that must be met for the iteration to continue. |
535
+
| while | `string` | `no` | A [runtime expression](./dsl.md/#runtime-expressions) that represents the condition, if any, that must be met for the iteration to continue. |
535
536
| do | [`task`](#task) | `yes` | The task to perform for each item in the collection. |
536
537
537
538
##### Examples
@@ -602,7 +603,6 @@ do:
602
603
room: ${ .room.number }
603
604
```
604
605
605
-
606
606
#### Listen
607
607
608
608
Provides a mechanism for workflows to await and react to external events, enabling event-driven behavior within workflow systems.
@@ -1074,7 +1074,7 @@ Defines an external resource.
1074
1074
| Property | Type | Required | Description |
1075
1075
|----------|:----:|:--------:|-------------|
1076
1076
| name | `string` | `no` | The name, if any, of the defined resource. |
1077
-
| uri | `string` | `yes` | The URI at which to get the defined resource. |
1077
+
| uri | [`uri-template`](#uri-template) | `yes` | The URI at which to get the defined resource. |
1078
1078
| authentication | [`authentication`](#authentication) | `no` | The authentication policy, or the name of the authentication policy, to use when fecthing the resource. |
1079
1079
1080
1080
##### Examples
@@ -1209,8 +1209,8 @@ Defines the fundamentals of an 'oauth2' authentication
1209
1209
1210
1210
| Property | Type | Required | Description |
1211
1211
|----------|:----:|:--------:|-------------|
1212
-
| authority | `string` | `yes` | The URI that references the OAuth2 authority to use. |
1213
-
| grant | `string` | `yes` | The grant type to use.
1212
+
| authority | [`uri-template`](#uri-template) | `yes` | The URI that references the OAuth2 authority to use. |
1213
+
| grant | `string` | `yes` | The grant type to use. |
1214
1214
| client.id | `string` | `yes` | The client id to use. |
1215
1215
| client.secret | `string` | `no` | The client secret to use, if any. |
1216
1216
| scopes | `string[]` | `no` | The scopes, if any, to request the token for. |
@@ -1347,7 +1347,7 @@ Defines the [Problem Details RFC](https://datatracker.ietf.org/doc/html/rfc7807)
1347
1347
1348
1348
| Property | Type | Required | Description |
1349
1349
|----------|:----:|:--------:|-------------|
1350
-
| type | `string` | `yes` | A URI reference that identifies the [`error`](#error) type. <br><u>For cross-compatibility concerns, it is strongly recommended to use [Standard Error Types](#standard-error-types) whenever possible.<u><br><u>Runtimes **MUST** ensure that the property has been set when raising or escalating the [`error`](#error).<u> |
1350
+
| type | [`uri-template`](#uri-template) | `yes` | A URI reference that identifies the [`error`](#error) type. <br><u>For cross-compatibility concerns, it is strongly recommended to use [Standard Error Types](#standard-error-types) whenever possible.<u><br><u>Runtimes **MUST** ensure that the property has been set when raising or escalating the [`error`](#error).<u> |
1351
1351
| status | `integer` | `yes` | The status code generated by the origin for this occurrence of the [`error`](#error).<br><u>For cross-compatibility concerns, it is strongly recommended to use [HTTP Status Codes](https://datatracker.ietf.org/doc/html/rfc7231#section-6) whenever possible.<u><br><u>Runtimes **MUST** ensure that the property has been set when raising or escalating the [`error`](#error).<u> |
1352
1352
| instance | `string` | `yes` | A [JSON Pointer](https://datatracker.ietf.org/doc/html/rfc6901) used to reference the component the [`error`](#error) originates from.<br><u>Runtimes **MUST** set the property when raising or escalating the [`error`](#error). Otherwise ignore.<u> |
1353
1353
| title | `string` | `no` | A short, human-readable summary of the [`error`](#error). |
@@ -1356,7 +1356,7 @@ Defines the [Problem Details RFC](https://datatracker.ietf.org/doc/html/rfc7807)
@@ -1367,14 +1367,14 @@ Standard error types serve the purpose of categorizing errors consistently acros
1367
1367
1368
1368
| Type | Status¹ | Description |
1369
1369
|------|:-------:|-------------|
1370
-
| [https://https://serverlessworkflow.io/spec/1.0.0/errors/configuration](#) | `400` | Errors resulting from incorrect or invalid configuration settings, such as missing or misconfigured environment variables, incorrect parameter values, or configuration file errors. |
1371
-
| [https://https://serverlessworkflow.io/spec/1.0.0/errors/validation](#) | `400` | Errors arising from validation processes, such as validation of input data, schema validation failures, or validation constraints not being met. These errors indicate that the provided data or configuration does not adhere to the expected format or requirements specified by the workflow. |
1372
-
| [https://https://serverlessworkflow.io/spec/1.0.0/errors/expression](#) | `400` | Errors occurring during the evaluation of runtime expressions, such as invalid syntax or unsupported operations. |
1373
-
| [https://https://serverlessworkflow.io/spec/1.0.0/errors/authentication](#) | `401` | Errors related to authentication failures. |
1374
-
| [https://https://serverlessworkflow.io/spec/1.0.0/errors/authorization](#) | `403` | Errors related to unauthorized access attempts or insufficient permissions to perform certain actions within the workflow. |
1375
-
| [https://https://serverlessworkflow.io/spec/1.0.0/errors/timeout](#) | `408` | Errors caused by timeouts during the execution of tasks or during interactions with external services. |
1376
-
| [https://https://serverlessworkflow.io/spec/1.0.0/errors/communication](#) | `500` | Errors encountered while communicating with external services, including network errors, service unavailable, or invalid responses. |
1377
-
| [https://https://serverlessworkflow.io/spec/1.0.0/errors/runtime](#) | `500` | Errors occurring during the runtime execution of a workflow, including unexpected exceptions, errors related to resource allocation, or failures in handling workflow tasks. These errors typically occur during the actual execution of workflow components and may require runtime-specific handling and resolution strategies. |
1370
+
| [https://serverlessworkflow.io/spec/1.0.0/errors/configuration](#) | `400` | Errors resulting from incorrect or invalid configuration settings, such as missing or misconfigured environment variables, incorrect parameter values, or configuration file errors. |
1371
+
| [https://serverlessworkflow.io/spec/1.0.0/errors/validation](#) | `400` | Errors arising from validation processes, such as validation of input data, schema validation failures, or validation constraints not being met. These errors indicate that the provided data or configuration does not adhere to the expected format or requirements specified by the workflow. |
1372
+
| [https://serverlessworkflow.io/spec/1.0.0/errors/expression](#) | `400` | Errors occurring during the evaluation of runtime expressions, such as invalid syntax or unsupported operations. |
1373
+
| [https://serverlessworkflow.io/spec/1.0.0/errors/authentication](#) | `401` | Errors related to authentication failures. |
1374
+
| [https://serverlessworkflow.io/spec/1.0.0/errors/authorization](#) | `403` | Errors related to unauthorized access attempts or insufficient permissions to perform certain actions within the workflow. |
1375
+
| [https://serverlessworkflow.io/spec/1.0.0/errors/timeout](#) | `408` | Errors caused by timeouts during the execution of tasks or during interactions with external services. |
1376
+
| [https://serverlessworkflow.io/spec/1.0.0/errors/communication](#) | `500` | Errors encountered while communicating with external services, including network errors, service unavailable, or invalid responses. |
1377
+
| [https://serverlessworkflow.io/spec/1.0.0/errors/runtime](#) | `500` | Errors occurring during the runtime execution of a workflow, including unexpected exceptions, errors related to resource allocation, or failures in handling workflow tasks. These errors typically occur during the actual execution of workflow components and may require runtime-specific handling and resolution strategies. |
1378
1378
1379
1379
¹ *Default value. The `status code` that best describe the error should always be used.*
1380
1380
@@ -1686,4 +1686,22 @@ method: get
1686
1686
uri: https://petstore.swagger.io/v2/pet/1
1687
1687
headers:
1688
1688
Content-Type: application/json
1689
-
```
1689
+
```
1690
+
1691
+
### URI Template
1692
+
1693
+
The DSL has limited support for URI template syntax as defined by [RFC 6570](https://datatracker.ietf.org/doc/html/rfc6570). Specifically, only the [Simple String Expansion](https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.2) is supported, which allows authors to embed variables in a URI.
1694
+
1695
+
To substitute a variable within a URI, use the `{}` syntax. The identifier inside the curly braces will be replaced with its value during runtime evaluation. If no value is found for the identifier, an empty string will be used.
1696
+
1697
+
This has the following limitations compared to runtime expressions:
1698
+
1699
+
- Only top-level properties can be interpolated within strings, thus identifiers are treated verbatim. This means that `{pet.id}` will be replaced with the value of the `"pet.id"` property, not the value of the `id` property of the `pet` property.
1700
+
- The referenced variable must be of type `string`, `number`, `boolean`, or `null`. If the variable is of a different type an error with type `https://https://serverlessworkflow.io/spec/1.0.0/errors/expression` and status `400` will be raised.
1701
+
- [Runtime expression arguments](./dsl.md#runtime-expression-arguments) are not available for string substitution.
Copy file name to clipboardExpand all lines: dsl.md
+29-6Lines changed: 29 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -196,17 +196,40 @@ Runtimes **may** optionally support other runtime expression languages, which au
196
196
197
197
CloudFlows defines [several arguments](#runtime-expression-arguments) that runtimes **must** provide during the evaluation of runtime expressions.
198
198
199
-
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`.
199
+
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`.
200
200
201
201
#### Runtime expression arguments
202
202
203
203
| Name | Type | Description |
204
204
|:-----|:----:|:------------|
205
-
| context |`map`| The task's context data. |
205
+
| context |`any`| The task's context data. |
206
206
| input |`any`| The task's filtered input. |
207
207
| 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. |
208
208
| task |[`taskDescriptor`](#task-descriptor)| Describes the current task. |
209
-
| workflow |[`workflowDescritor`](#workflow-descriptor)| Describes the current workflow. |
209
+
| workflow |[`workflowDescriptor`](#workflow-descriptor)| Describes the current workflow. |
210
+
211
+
##### Task Descriptor
212
+
213
+
| Name | Type | Description | Example |
214
+
|:-----|:----:|:------------|:--------|
215
+
| name |`string`| The task's name. |`getPet`|
216
+
| definition |`map`| The tasks definition (specified under the name) as a parsed object |`{ "call": "http", "with": { ... } }`|
217
+
| 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 `.`) | - |
218
+
| 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`|
219
+
| 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") |
220
+
| 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") |
221
+
222
+
##### Workflow Descriptor
223
+
224
+
225
+
| Name | Type | Description | Example |
226
+
|:-----|:----:|:------------|:--------|
227
+
| id |`string`| A unique id of the workflow execution. Now specific format is imposed | UUIDv4: `4a5c8422-5868-4e12-8dd9-220810d2b9ee`, ULID: `0000004JFGDSW1H037G7J7SFB9`|
228
+
| definition |`map`| The workflow's definition as a parsed object |`{ "document": { ... }, "do": [...] }`|
229
+
| input |`any`| The workflow's input *BEFORE* the `input.from` expression. For the result of `input.from` expression use the `$input` argument | - |
230
+
| 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`|
231
+
| 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") |
232
+
| 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") |
210
233
211
234
### Fault Tolerance
212
235
@@ -220,7 +243,7 @@ Errors in Serverless Workflow are described using the [Problem Details RFC](http
detail: The service is currently unavailable. Please try again later.
@@ -263,7 +286,7 @@ Workflows and tasks alike can be configured to timeout after a defined amount of
263
286
264
287
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).
265
288
266
-
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`.
289
+
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`.
267
290
268
291
### Interoperability
269
292
@@ -275,7 +298,7 @@ Serverless Workflow DSL is designed to seamlessly interact with a variety of ser
275
298
- [**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.
276
299
- [**OpenAPI**](dsl-reference.md#openapi-call): Enables communication with services that provide OpenAPI specifications, which is useful for defining and consuming RESTful APIs.
277
300
278
-
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.
301
+
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.
0 commit comments