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
+38-19Lines changed: 38 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)
@@ -371,6 +372,7 @@ The [HTTP Call](#http-call) enables workflows to interact with external services
371
372
| endpoint | [`endpoint`](#endpoint) | `yes` | An URI or an object that describes the HTTP endpoint to call. |
372
373
| headers | `map` | `no` | A name/value mapping of the HTTP headers to use, if any. |
373
374
| body | `any` | `no` | The HTTP request body, if any. |
375
+
| query | `map[string, any]` | `no` | A name/value mapping of the query parameters to use, if any. |
374
376
| output | `string` | `no` | The http call's output format.<br>*Supported values are:*<br>*- `raw`, which output's the base-64 encoded [http response](#http-response) content, if any.*<br>*- `content`, which outputs the content of [http response](#http-response), possibly deserialized.*<br>*- `response`, which outputs the [http response](#http-response).*<br>*Defaults to `content`.* |
375
377
376
378
###### Examples
@@ -528,9 +530,9 @@ Allows workflows to iterate over a collection of items, executing a defined set
528
530
| Name | Type | Required | Description|
529
531
|:--|:---:|:---:|:---|
530
532
| for.each | `string` | `no` | The name of the variable used to store the current item being enumerated.<br>Defaults to `item`. |
531
-
| 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. |
532
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`. |
533
-
| 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. |
534
536
| do | [`task`](#task) | `yes` | The task to perform for each item in the collection. |
535
537
536
538
##### Examples
@@ -601,7 +603,6 @@ do:
601
603
room: ${ .room.number }
602
604
```
603
605
604
-
605
606
#### Listen
606
607
607
608
Provides a mechanism for workflows to await and react to external events, enabling event-driven behavior within workflow systems.
@@ -1073,7 +1074,7 @@ Defines an external resource.
1073
1074
| Property | Type | Required | Description |
1074
1075
|----------|:----:|:--------:|-------------|
1075
1076
| name | `string` | `no` | The name, if any, of the defined resource. |
1076
-
| 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. |
1077
1078
| authentication | [`authentication`](#authentication) | `no` | The authentication policy, or the name of the authentication policy, to use when fecthing the resource. |
1078
1079
1079
1080
##### Examples
@@ -1208,8 +1209,8 @@ Defines the fundamentals of an 'oauth2' authentication
1208
1209
1209
1210
| Property | Type | Required | Description |
1210
1211
|----------|:----:|:--------:|-------------|
1211
-
| authority | `string` | `yes` | The URI that references the OAuth2 authority to use. |
1212
-
| 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. |
1213
1214
| client.id | `string` | `yes` | The client id to use. |
1214
1215
| client.secret | `string` | `no` | The client secret to use, if any. |
1215
1216
| scopes | `string[]` | `no` | The scopes, if any, to request the token for. |
@@ -1346,7 +1347,7 @@ Defines the [Problem Details RFC](https://datatracker.ietf.org/doc/html/rfc7807)
1346
1347
1347
1348
| Property | Type | Required | Description |
1348
1349
|----------|:----:|:--------:|-------------|
1349
-
| 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> |
1350
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> |
1351
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> |
1352
1353
| title | `string` | `no` | A short, human-readable summary of the [`error`](#error). |
@@ -1355,7 +1356,7 @@ Defines the [Problem Details RFC](https://datatracker.ietf.org/doc/html/rfc7807)
@@ -1366,14 +1367,14 @@ Standard error types serve the purpose of categorizing errors consistently acros
1366
1367
1367
1368
| Type | Status¹ | Description |
1368
1369
|------|:-------:|-------------|
1369
-
| [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. |
1370
-
| [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. |
1371
-
| [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. |
1372
-
| [https://https://serverlessworkflow.io/spec/1.0.0/errors/authentication](#) | `401` | Errors related to authentication failures. |
1373
-
| [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. |
1374
-
| [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. |
1375
-
| [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. |
1376
-
| [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. |
1377
1378
1378
1379
¹ *Default value. The `status code` that best describe the error should always be used.*
1379
1380
@@ -1685,4 +1686,22 @@ method: get
1685
1686
uri: https://petstore.swagger.io/v2/pet/1
1686
1687
headers:
1687
1688
Content-Type: application/json
1688
-
```
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
+26-4Lines changed: 26 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -196,7 +196,7 @@ 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
@@ -219,6 +219,28 @@ This argument contains information about the runtime executing the workflow.
219
219
| 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`) |
220
220
| 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"] }`. |
221
221
222
+
##### Task Descriptor
223
+
224
+
| Name | Type | Description | Example |
225
+
|:-----|:----:|:------------|:--------|
226
+
| name |`string`| The task's name. |`getPet`|
227
+
| definition |`map`| The tasks definition (specified under the name) as a parsed object |`{ "call": "http", "with": { ... } }`|
228
+
| 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 `.`) | - |
229
+
| 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`|
230
+
| 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") |
231
+
| 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") |
232
+
233
+
##### Workflow Descriptor
234
+
235
+
| Name | Type | Description | Example |
236
+
|:-----|:----:|:------------|:--------|
237
+
| id |`string`| A unique id of the workflow execution. Now specific format is imposed | UUIDv4: `4a5c8422-5868-4e12-8dd9-220810d2b9ee`, ULID: `0000004JFGDSW1H037G7J7SFB9`|
238
+
| definition |`map`| The workflow's definition as a parsed object |`{ "document": { ... }, "do": [...] }`|
239
+
| input |`any`| The workflow's input *BEFORE* the `input.from` expression. For the result of `input.from` expression use the `$input` argument | - |
240
+
| 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`|
241
+
| 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") |
242
+
| 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") |
243
+
222
244
### Fault Tolerance
223
245
224
246
Serverless Workflow is designed with resilience in mind, acknowledging that errors are an inevitable part of any system. The DSL provides robust mechanisms to identify, describe, and handle errors effectively, ensuring the workflow can recover gracefully from failures.
@@ -231,7 +253,7 @@ Errors in Serverless Workflow are described using the [Problem Details RFC](http
detail: The service is currently unavailable. Please try again later.
@@ -274,7 +296,7 @@ Workflows and tasks alike can be configured to timeout after a defined amount of
274
296
275
297
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).
276
298
277
-
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`.
299
+
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`.
278
300
279
301
### Interoperability
280
302
@@ -286,7 +308,7 @@ Serverless Workflow DSL is designed to seamlessly interact with a variety of ser
286
308
- [**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.
287
309
- [**OpenAPI**](dsl-reference.md#openapi-call): Enables communication with services that provide OpenAPI specifications, which is useful for defining and consuming RESTful APIs.
288
310
289
-
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.
311
+
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