Skip to content

Commit b669d1e

Browse files
Merge pull request #898 from neuroglia-io/fix-if-doc
Fix task `if` property doc
2 parents f574808 + f65c7c9 commit b669d1e

File tree

2 files changed

+48
-43
lines changed

2 files changed

+48
-43
lines changed

dsl-reference.md

Lines changed: 45 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
+ [HTTP](#http-call)
1616
+ [OpenAPI](#openapi-call)
1717
- [Do](#do)
18-
- [Fork](#fork)
1918
- [Emit](#emit)
2019
- [For](#for)
20+
- [Fork](#fork)
2121
- [Listen](#listen)
2222
- [Raise](#raise)
2323
- [Run](#run)
@@ -242,6 +242,7 @@ The Serverless Workflow DSL defines a list of [tasks](#task) that **must be** su
242242
243243
| Name | Type | Required | Description|
244244
|:--|:---:|:---:|:---|
245+
| 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. |
245246
| input | [`input`](#input) | `no` | An object used to customize the task's input and to document its schema, if any. |
246247
| output | [`output`](#output) | `no` | An object used to customize the task's output and to document its schema, if any. |
247248
| export | [`export`](#export) | `no` | An object used to customize the content of the workflow context. |
@@ -473,48 +474,6 @@ do:
473474
country: Portugal
474475
```
475476

476-
#### Fork
477-
478-
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.
479-
480-
##### Properties
481-
482-
| Name | Type | Required | Description|
483-
|:--|:---:|:---:|:---|
484-
| fork.branches | [`map[string, task][]`](#task) | `no` | The tasks to perform concurrently. |
485-
| 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`. |
486-
487-
##### Examples
488-
489-
```yaml
490-
document:
491-
dsl: '1.0.0-alpha1'
492-
namespace: test
493-
name: fork-example
494-
version: '0.1.0'
495-
do:
496-
- raiseAlarm:
497-
fork:
498-
compete: true
499-
branches:
500-
- callNurse:
501-
call: http
502-
with:
503-
method: put
504-
endpoint: https://fake-hospital.com/api/v3/alert/nurses
505-
body:
506-
patientId: ${ .patient.fullName }
507-
room: ${ .room.number }
508-
- callDoctor:
509-
call: http
510-
with:
511-
method: put
512-
endpoint: https://fake-hospital.com/api/v3/alert/doctor
513-
body:
514-
patientId: ${ .patient.fullName }
515-
room: ${ .room.number }
516-
```
517-
518477
#### Emit
519478

520479
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.
@@ -588,6 +547,49 @@ do:
588547
as: '.pets + [{ "id": $pet.id }]'
589548
```
590549

550+
#### Fork
551+
552+
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.
553+
554+
##### Properties
555+
556+
| Name | Type | Required | Description|
557+
|:--|:---:|:---:|:---|
558+
| fork.branches | [`map[string, task][]`](#task) | `no` | The tasks to perform concurrently. |
559+
| 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`. |
560+
561+
##### Examples
562+
563+
```yaml
564+
document:
565+
dsl: '1.0.0-alpha1'
566+
namespace: test
567+
name: fork-example
568+
version: '0.1.0'
569+
do:
570+
- raiseAlarm:
571+
fork:
572+
compete: true
573+
branches:
574+
- callNurse:
575+
call: http
576+
with:
577+
method: put
578+
endpoint: https://fake-hospital.com/api/v3/alert/nurses
579+
body:
580+
patientId: ${ .patient.fullName }
581+
room: ${ .room.number }
582+
- callDoctor:
583+
call: http
584+
with:
585+
method: put
586+
endpoint: https://fake-hospital.com/api/v3/alert/doctor
587+
body:
588+
patientId: ${ .patient.fullName }
589+
room: ${ .room.number }
590+
```
591+
592+
591593
#### Listen
592594

593595
Provides a mechanism for workflows to await and react to external events, enabling event-driven behavior within workflow systems.

schema/workflow.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ $defs:
112112
taskBase:
113113
type: object
114114
properties:
115+
if:
116+
type: string
117+
description: A runtime expression, if any, used to determine whether or not the task should be run.
115118
input:
116119
$ref: '#/$defs/input'
117120
description: Configure the task's input.

0 commit comments

Comments
 (0)