diff --git a/dsl-reference.md b/dsl-reference.md
index 75179843..060f7ba1 100644
--- a/dsl-reference.md
+++ b/dsl-reference.md
@@ -73,7 +73,7 @@ A [workflow](#workflow) serves as a blueprint outlining the series of [tasks](#t
| input | [`input`](#input) | `no` | Configures the workflow's input. |
| use | [`use`](#use) | `no` | Defines the workflow's reusable components, if any. |
| do | [`map[string, task][]`](#task) | `yes` | The [task(s)](#task) that must be performed by the [workflow](#workflow). |
-| timeout | [`timeout`](#timeout) | `no` | The configuration, if any, of the workflow's timeout. |
+| timeout | `string`
[`timeout`](#timeout) | `no` | The configuration, if any, of the workflow's timeout.
*If a `string`, must be the name of a [timeout](#timeout) defined in the [workflow's reusable components](#use).* |
| output | [`output`](#output) | `no` | Configures the workflow's output. |
| schedule | [`schedule`](#schedule) | `no` | Configures the workflow's schedule, if any. |
| evaluate | [`evaluate`](#evaluate) | `no` | Configures runtime expression evaluation. |
@@ -105,6 +105,7 @@ Defines the workflow's reusable components.
| functions | [`map[string, task]`](#task) | `no` | A name/value mapping of the workflow's reusable tasks. |
| retries | [`map[string, retryPolicy]`](#retry) | `no` | A name/value mapping of the workflow's reusable retry policies. |
| secrets | `string[]` | `no` | A list containing the workflow's secrets. |
+| timeouts | [`map[string, timeout]`](#timeout) | `no` | A name/value mapping of the workflow's reusable timeouts. |
#### Schedule
@@ -252,7 +253,7 @@ The Serverless Workflow DSL defines a list of [tasks](#task) that **must be** su
| 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. |
-| timeout | [`timeout`](#timeout) | `no` | The configuration of the task's timeout, if any. |
+| timeout | `string`
[`timeout`](#timeout) | `no` | The configuration of the task's timeout, if any.
*If a `string`, must be the name of a [timeout](#timeout) defined in the [workflow's reusable components](#use).* |
| then | [`flowDirective`](#flow-directive) | `no` | The flow directive to execute next.
*If not set, defaults to `continue`.* |
| metadata | `map` | `no` | Additional information about the task. |
@@ -653,7 +654,7 @@ Intentionally triggers and propagates errors. By employing the "Raise" task, wor
| Name | Type | Required | Description |
|:--|:---:|:---:|:---|
-| raise.error | [`error`](#error) | `yes` | Defines the error to raise. |
+| raise.error | `string`
[`error`](#error) | `yes` | Defines the [error](#error) to raise.
*If a `string`, must be the name of an [error](#error) defined in the [workflow's reusable components](#use).* |
##### Examples
@@ -1035,12 +1036,12 @@ Defines the configuration of a catch clause, which a concept used to catch error
| Name | Type | Required | Description |
|:--|:---:|:---:|:---|
-| errors | [`errorFilter`](#retry) | `no` | The definition of the errors to catch |
+| errors | [`errorFilter`](#retry) | `no` | The definition of the errors to catch. |
| as | `string` | `no` | The name of the runtime expression variable to save the error as. Defaults to 'error'. |
-| when | `string`| `no` | A runtime expression used to determine whether or not to catch the filtered error |
-| exceptWhen | `string` | `no` | A runtime expression used to determine whether or not to catch the filtered error |
-| retry | [`retryPolicy`](#retry) | `no` | The retry policy to use, if any, when catching errors |
-| do | [`map[string, task][]`](#task) | `no` | The definition of the task(s) to run when catching an error |
+| when | `string`| `no` | A runtime expression used to determine whether or not to catch the filtered error. |
+| exceptWhen | `string` | `no` | A runtime expression used to determine whether or not to catch the filtered error. |
+| retry | `string`
[`retryPolicy`](#retry) | `no` | The [`retry policy`](#retry) to use, if any, when catching [`errors`](#error).
*If a `string`, must be the name of a [retry policy](#retry) defined in the [workflow's reusable components](#use).* |
+| do | [`map[string, task][]`](#task) | `no` | The definition of the task(s) to run when catching an error. |
#### Wait
diff --git a/examples/raise.yaml b/examples/raise-inline copy.yaml
similarity index 100%
rename from examples/raise.yaml
rename to examples/raise-inline copy.yaml
diff --git a/examples/raise-reusable.yaml b/examples/raise-reusable.yaml
new file mode 100644
index 00000000..7f5bd965
--- /dev/null
+++ b/examples/raise-reusable.yaml
@@ -0,0 +1,16 @@
+document:
+ dsl: '1.0.0-alpha1'
+ namespace: test
+ name: raise-not-implemented
+ version: '0.1.0'
+use:
+ errors:
+ notImplemented:
+ type: https://serverlessworkflow.io/errors/not-implemented
+ status: 500
+ title: Not Implemented
+ detail: ${ "The workflow '\( $workflow.definition.document.name ):\( $workflow.definition.document.version )' is a work in progress and cannot be run yet" }
+do:
+ - notImplemented:
+ raise:
+ error: notImplemented
\ No newline at end of file
diff --git a/examples/try-catch-retry.yaml b/examples/try-catch-retry-inline.yaml
similarity index 100%
rename from examples/try-catch-retry.yaml
rename to examples/try-catch-retry-inline.yaml
diff --git a/examples/try-catch-retry-reusable.yaml b/examples/try-catch-retry-reusable.yaml
new file mode 100644
index 00000000..3b920720
--- /dev/null
+++ b/examples/try-catch-retry-reusable.yaml
@@ -0,0 +1,30 @@
+document:
+ dsl: '1.0.0'
+ namespace: default
+ name: try-catch-retry
+ version: '1.0.0'
+use:
+ retries:
+ default:
+ delay:
+ seconds: 3
+ backoff:
+ exponential: {}
+ limit:
+ attempt:
+ count: 5
+do:
+ - tryGetPet:
+ try:
+ - getPet:
+ call: http
+ with:
+ method: get
+ endpoint: https://petstore.swagger.io/v2/pet/{petId}
+ catch:
+ errors:
+ with:
+ type: https://serverlessworkflow.io.io/dsl/errors/types/communication
+ status: 503
+ retry: default
+
\ No newline at end of file
diff --git a/schema/workflow.yaml b/schema/workflow.yaml
index c80ccd3e..4401f001 100644
--- a/schema/workflow.yaml
+++ b/schema/workflow.yaml
@@ -101,14 +101,24 @@ properties:
items:
type: string
description: The workflow's secrets.
+ timeouts:
+ type: object
+ title: UseTimeouts
+ description: The workflow's reusable timeouts.
+ additionalProperties:
+ $ref: '#/$defs/timeout'
do:
$ref: '#/$defs/taskList'
title: Do
description: Defines the task(s) the workflow must perform.
timeout:
- $ref: '#/$defs/timeout'
- title: Timeout
- description: The workflow's timeout configuration, if any.
+ oneOf:
+ - $ref: '#/$defs/timeout'
+ title: TimeoutDefinition
+ description: The workflow's timeout configuration, if any.
+ - type: string
+ title: TimeoutReference
+ description: The name of the workflow's timeout, if any.
output:
$ref: '#/$defs/output'
title: Output
@@ -169,9 +179,13 @@ $defs:
title: TaskBaseExport
description: Export task output to context.
timeout:
- $ref: '#/$defs/timeout'
- title: TaskBaseTimeout
- description: The task's timeout configuration, if any.
+ oneOf:
+ - $ref: '#/$defs/timeout'
+ title: TaskTimeoutDefinition
+ description: The task's timeout configuration, if any.
+ - type: string
+ title: TaskTimeoutReference
+ description: The name of the task's timeout, if any.
then:
$ref: '#/$defs/flowDirective'
title: TaskBaseThen
@@ -531,9 +545,13 @@ $defs:
unevaluatedProperties: false
properties:
error:
- $ref: '#/$defs/error'
- title: RaiseError
- description: Defines the error to raise.
+ oneOf:
+ - $ref: '#/$defs/error'
+ title: RaiseErrorDefinition
+ description: Defines the error to raise.
+ - type: string
+ title: RaiseErrorReference
+ description: The name of the error to raise
required: [ error ]
runTask:
type: object
@@ -757,9 +775,13 @@ $defs:
title: CatchExceptWhen
description: A runtime expression used to determine whether or not to catch the filtered error.
retry:
- $ref: '#/$defs/retryPolicy'
- title: TryTaskCatchRetry
- description: The retry policy to use, if any, when catching errors.
+ oneOf:
+ - $ref: '#/$defs/retryPolicy'
+ title: RetryPolicyDefinition
+ description: The retry policy to use, if any, when catching errors.
+ - type: string
+ title: RetryPolicyReference
+ description: The name of the retry policy to use, if any, when catching errors.
do:
$ref: '#/$defs/taskList'
title: TryTaskCatchDo