Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dsl-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ Allows workflows to iterate over a collection of items, executing a defined set
| Name | Type | Required | Description|
|:--|:---:|:---:|:---|
| for.each | `string` | `no` | The name of the variable used to store the current item being enumerated.<br>Defaults to `item`. |
| for.in | `string` | `yes` | A [runtime expression](dsl.md#runtime-expressions) used to get the collection to enumerate. |
| for.in | `string` \| `array<object>` | `yes` | A [runtime expression](dsl.md#runtime-expressions) or an inline array of objects used to get the collection to enumerate. |
| for.at | `string` | `no` | The name of the variable used to store the index of the current item being enumerated.<br>Defaults to `index`. |
| 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. |
| do | [`map[string, task]`](#task) | `yes` | The [task(s)](#task) to perform for each item in the collection. |
Expand Down
20 changes: 20 additions & 0 deletions examples/for-inline-array.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
document:
dsl: '1.0.3'
namespace: test
name: for-inline-array-example
version: '0.1.0'
do:
- logColors:
for:
each: color
in:
- name: red
hex: '#FF0000'
- name: green
hex: '#00FF00'
- name: blue
hex: '#0000FF'
do:
- setProcessed:
set:
processed: '${ .processed + [$color] }'
13 changes: 11 additions & 2 deletions schema/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -695,9 +695,18 @@ $defs:
description: The name of the variable used to store the current item being enumerated.
default: item
in:
type: string
title: ForIn
description: A runtime expression used to get the collection to enumerate.
description: A runtime expression or an inline array used to get the collection to enumerate.
oneOf:
- type: string
title: ForInExpression
description: A runtime expression used to get the collection to enumerate.
- type: array
title: ForInInlineArray
description: An inline array of objects to enumerate.
items:
type: object
description: An item in the inline collection.
at:
type: string
title: ForAt
Expand Down
Loading