diff --git a/dsl-reference.md b/dsl-reference.md index 2d110ede..a6a9e9e3 100644 --- a/dsl-reference.md +++ b/dsl-reference.md @@ -962,8 +962,8 @@ A task used to set data. ##### Properties | Name | Type | Required | Description | -|:--|:---:|:---:|:---| -| set | `object` | `yes` | A name/value mapping of the data to set. | +|:-------|:------:|:----------:|:-------------| +| set | `map`
`string` | `yes` | The data to set.
*Can be an object or a direct runtime expression.* | ##### Examples @@ -979,6 +979,8 @@ do: shape: circle size: ${ .configuration.size } fill: ${ .configuration.fill } + - setColor: + set: ${ .configuration.color } ``` #### Switch diff --git a/examples/set-expression.yaml b/examples/set-expression.yaml new file mode 100644 index 00000000..32b5e887 --- /dev/null +++ b/examples/set-expression.yaml @@ -0,0 +1,13 @@ +document: + dsl: '1.0.0' + namespace: test + name: set + version: '0.1.0' +schedule: + on: + one: + with: + type: io.serverlessworkflow.samples.events.trigger.v1 +do: + - initialize: + set: ${ $workflow.input[0] } \ No newline at end of file diff --git a/examples/set.yaml b/examples/set.yaml index 161c16b9..e1e64af6 100644 --- a/examples/set.yaml +++ b/examples/set.yaml @@ -8,7 +8,7 @@ schedule: one: with: type: io.serverlessworkflow.samples.events.trigger.v1 -do: +do: - initialize: set: startEvent: ${ $workflow.input[0] } \ No newline at end of file diff --git a/schema/workflow.yaml b/schema/workflow.yaml index 3870f50e..5473f059 100644 --- a/schema/workflow.yaml +++ b/schema/workflow.yaml @@ -767,11 +767,13 @@ $defs: unevaluatedProperties: false properties: set: - type: object + oneOf: + - type: object + minProperties: 1 + additionalProperties: true + - type: string title: SetTaskConfiguration description: The data to set. - minProperties: 1 - additionalProperties: true switchTask: type: object $ref: '#/$defs/taskBase'