Skip to content

Commit

Permalink
Merge pull request #898 from neuroglia-io/fix-if-doc
Browse files Browse the repository at this point in the history
Fix task `if` property doc
  • Loading branch information
ricardozanini authored Jun 13, 2024
2 parents f574808 + f65c7c9 commit b669d1e
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 43 deletions.
88 changes: 45 additions & 43 deletions dsl-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
+ [HTTP](#http-call)
+ [OpenAPI](#openapi-call)
- [Do](#do)
- [Fork](#fork)
- [Emit](#emit)
- [For](#for)
- [Fork](#fork)
- [Listen](#listen)
- [Raise](#raise)
- [Run](#run)
Expand Down Expand Up @@ -242,6 +242,7 @@ The Serverless Workflow DSL defines a list of [tasks](#task) that **must be** su
| Name | Type | Required | Description|
|:--|:---:|:---:|:---|
| if | `string` | `no` | A [`runtime expression`](dsl.md#runtime-expressions), if any, used to determine whether or not the task should be run.<br>The task is considered skipped if not run. |
| input | [`input`](#input) | `no` | An object used to customize the task's input and to document its schema, if any. |
| output | [`output`](#output) | `no` | An object used to customize the task's output and to document its schema, if any. |
| export | [`export`](#export) | `no` | An object used to customize the content of the workflow context. |
Expand Down Expand Up @@ -473,48 +474,6 @@ do:
country: Portugal
```

#### Fork

Allows workflows to execute multiple subtasks concurrently, enabling parallel processing and improving the overall efficiency of the workflow. By defining a set of subtasks to perform concurrently, the Fork task facilitates the execution of complex operations in parallel, ensuring that multiple tasks can be executed simultaneously.

##### Properties

| Name | Type | Required | Description|
|:--|:---:|:---:|:---|
| fork.branches | [`map[string, task][]`](#task) | `no` | The tasks to perform concurrently. |
| fork.compete | `boolean` | `no` | Indicates whether or not the concurrent [`tasks`](#task) are racing against each other, with a single possible winner, which sets the composite task's output. Defaults to `false`. |

##### Examples

```yaml
document:
dsl: '1.0.0-alpha1'
namespace: test
name: fork-example
version: '0.1.0'
do:
- raiseAlarm:
fork:
compete: true
branches:
- callNurse:
call: http
with:
method: put
endpoint: https://fake-hospital.com/api/v3/alert/nurses
body:
patientId: ${ .patient.fullName }
room: ${ .room.number }
- callDoctor:
call: http
with:
method: put
endpoint: https://fake-hospital.com/api/v3/alert/doctor
body:
patientId: ${ .patient.fullName }
room: ${ .room.number }
```

#### Emit

Allows workflows to publish events to event brokers or messaging systems, facilitating communication and coordination between different components and services. With the Emit task, workflows can seamlessly integrate with event-driven architectures, enabling real-time processing, event-driven decision-making, and reactive behavior based on incoming events.
Expand Down Expand Up @@ -588,6 +547,49 @@ do:
as: '.pets + [{ "id": $pet.id }]'
```

#### Fork

Allows workflows to execute multiple subtasks concurrently, enabling parallel processing and improving the overall efficiency of the workflow. By defining a set of subtasks to perform concurrently, the Fork task facilitates the execution of complex operations in parallel, ensuring that multiple tasks can be executed simultaneously.

##### Properties

| Name | Type | Required | Description|
|:--|:---:|:---:|:---|
| fork.branches | [`map[string, task][]`](#task) | `no` | The tasks to perform concurrently. |
| fork.compete | `boolean` | `no` | Indicates whether or not the concurrent [`tasks`](#task) are racing against each other, with a single possible winner, which sets the composite task's output. Defaults to `false`. |

##### Examples

```yaml
document:
dsl: '1.0.0-alpha1'
namespace: test
name: fork-example
version: '0.1.0'
do:
- raiseAlarm:
fork:
compete: true
branches:
- callNurse:
call: http
with:
method: put
endpoint: https://fake-hospital.com/api/v3/alert/nurses
body:
patientId: ${ .patient.fullName }
room: ${ .room.number }
- callDoctor:
call: http
with:
method: put
endpoint: https://fake-hospital.com/api/v3/alert/doctor
body:
patientId: ${ .patient.fullName }
room: ${ .room.number }
```


#### Listen

Provides a mechanism for workflows to await and react to external events, enabling event-driven behavior within workflow systems.
Expand Down
3 changes: 3 additions & 0 deletions schema/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ $defs:
taskBase:
type: object
properties:
if:
type: string
description: A runtime expression, if any, used to determine whether or not the task should be run.
input:
$ref: '#/$defs/input'
description: Configure the task's input.
Expand Down

0 comments on commit b669d1e

Please sign in to comment.