Skip to content

Commit 85c43c8

Browse files
Merge branch 'main' into query-params
2 parents c49c263 + 434e0eb commit 85c43c8

File tree

3 files changed

+69
-28
lines changed

3 files changed

+69
-28
lines changed

dsl-reference.md

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
+ [Duration](#duration)
5151
+ [HTTP Response](#http-response)
5252
+ [HTTP Request](#http-request)
53+
+ [URI Template](#uri-template)
5354

5455
## Abstract
5556

@@ -83,7 +84,7 @@ Documents the workflow definition.
8384
| dsl | `string` | `yes` | The version of the DSL used to define the workflow. |
8485
| namespace | `string` | `yes` | The workflow's namespace.<br> |
8586
| 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/) |
8788
| title | `string` | `no` | The workflow's title. |
8889
| summary | `string` | `no` | The workflow's Markdown summary. |
8990
| tags | `map[string, string]` | `no` | A key/value mapping of the workflow's tags, if any. |
@@ -279,7 +280,7 @@ do:
279280

280281
Serverless Workflow defines several default functions that **MUST** be supported by all implementations and runtimes:
281282

282-
- [AsyncAPI](#asyncapi)
283+
- [AsyncAPI](#asyncapi-call)
283284
- [gRPC](#grpc-call)
284285
- [HTTP](#http-call)
285286
- [OpenAPI](#openapi-call)
@@ -529,9 +530,9 @@ Allows workflows to iterate over a collection of items, executing a defined set
529530
| Name | Type | Required | Description|
530531
|:--|:---:|:---:|:---|
531532
| 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. |
533534
| 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. |
535536
| do | [`task`](#task) | `yes` | The task to perform for each item in the collection. |
536537

537538
##### Examples
@@ -602,7 +603,6 @@ do:
602603
room: ${ .room.number }
603604
```
604605

605-
606606
#### Listen
607607

608608
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.
10741074
| Property | Type | Required | Description |
10751075
|----------|:----:|:--------:|-------------|
10761076
| 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. |
10781078
| authentication | [`authentication`](#authentication) | `no` | The authentication policy, or the name of the authentication policy, to use when fecthing the resource. |
10791079

10801080
##### Examples
@@ -1209,8 +1209,8 @@ Defines the fundamentals of an 'oauth2' authentication
12091209

12101210
| Property | Type | Required | Description |
12111211
|----------|:----:|:--------:|-------------|
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. |
12141214
| client.id | `string` | `yes` | The client id to use. |
12151215
| client.secret | `string` | `no` | The client secret to use, if any. |
12161216
| 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)
13471347

13481348
| Property | Type | Required | Description |
13491349
|----------|:----:|:--------:|-------------|
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> |
13511351
| 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> |
13521352
| 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> |
13531353
| 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)
13561356
#### Examples
13571357

13581358
```yaml
1359-
type: https://https://serverlessworkflow.io/spec/1.0.0/errors/communication
1359+
type: https://serverlessworkflow.io/spec/1.0.0/errors/communication
13601360
title: Service Not Available
13611361
status: 503
13621362
```
@@ -1367,14 +1367,14 @@ Standard error types serve the purpose of categorizing errors consistently acros
13671367

13681368
| Type | Status¹ | Description |
13691369
|------|:-------:|-------------|
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. |
13781378

13791379
¹ *Default value. The `status code` that best describe the error should always be used.*
13801380

@@ -1686,4 +1686,22 @@ method: get
16861686
uri: https://petstore.swagger.io/v2/pet/1
16871687
headers:
16881688
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.
1702+
1703+
#### Examples
1704+
1705+
```yaml
1706+
uri: https://petstore.swagger.io/v2/pet/{petId}
1707+
```

dsl.md

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,17 +196,40 @@ Runtimes **may** optionally support other runtime expression languages, which au
196196

197197
CloudFlows defines [several arguments](#runtime-expression-arguments) that runtimes **must** provide during the evaluation of runtime expressions.
198198

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`.
200200

201201
#### Runtime expression arguments
202202

203203
| Name | Type | Description |
204204
|:-----|:----:|:------------|
205-
| context | `map` | The task's context data. |
205+
| context | `any` | The task's context data. |
206206
| input | `any` | The task's filtered input. |
207207
| 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. |
208208
| 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") |
210233

211234
### Fault Tolerance
212235

@@ -220,7 +243,7 @@ Errors in Serverless Workflow are described using the [Problem Details RFC](http
220243

221244
*Example error:*
222245
```yaml
223-
type: https://https://serverlessworkflow.io/spec/1.0.0/errors/communication
246+
type: https://serverlessworkflow.io/spec/1.0.0/errors/communication
224247
title: Service Unavailable
225248
status: 503
226249
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
263286

264287
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).
265288

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`.
267290

268291
### Interoperability
269292

@@ -275,7 +298,7 @@ Serverless Workflow DSL is designed to seamlessly interact with a variety of ser
275298
- [**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.
276299
- [**OpenAPI**](dsl-reference.md#openapi-call): Enables communication with services that provide OpenAPI specifications, which is useful for defining and consuming RESTful APIs.
277300

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.
279302

280303
#### Custom and Non-Standard Interactions
281304

schema/workflow.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ $defs:
734734
properties:
735735
authority:
736736
type: string
737-
format: uri
737+
format: uri-template
738738
description: The URI that references the OAuth2 authority to use.
739739
grant:
740740
type: string
@@ -944,14 +944,14 @@ $defs:
944944
externalResource:
945945
oneOf:
946946
- type: string
947-
format: uri
947+
format: uri-template
948948
- title: ExternalResourceURI
949949
type: object
950950
unevaluatedProperties: false
951951
properties:
952952
uri:
953953
type: string
954-
format: uri
954+
format: uri-template
955955
description: The endpoint's URI.
956956
authentication:
957957
$ref: '#/$defs/referenceableAuthenticationPolicy'

0 commit comments

Comments
 (0)