[Fix #1163] Allow inline arrays in for.in property - #1170
Conversation
…property The for.in property now accepts either a runtime expression (string) or an inline array of objects, making the schema more flexible for cases where the collection is known at definition time. Signed-off-by: Ricardo Zanini <ricardozanini@gmail.com>
There was a problem hiding this comment.
Pull request overview
Updates the workflow schema and documentation to let for.in accept either a string expression or an inline, definition-time array—addressing #1163’s request to hardcode collections directly in workflow definitions.
Changes:
- Updated
schema/workflow.yamlsofor.inacceptsstringorarray(withitems: { type: object }). - Updated
dsl-reference.mdto reflect the expandedfor.intype. - Added
examples/for-inline-array.yamldemonstrating inline array iteration.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| schema/workflow.yaml | Expands for.in from a single string type to a oneOf supporting string or inline array of objects. |
| dsl-reference.md | Updates the reference table row for for.in to document the new accepted types. |
| examples/for-inline-array.yaml | Adds a concrete example of using an inline array for for.in. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Regarding the suggestion to use The plain The |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
schema/workflow.yaml:709
- New validation behavior is introduced for
for.in(now acceptsarray<object>). Please add/upate schema validation tests to cover (1) accepting an inline array of objects and (2) rejecting arrays containing non-objects (e.g., strings/numbers), so the intended constraint doesn’t regress.
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.
examples/for-inline-array.yaml:20
- This example appends to
.processedwithout showing initialization. To make the example copy/paste-safe and self-explanatory, initializeprocessed(e.g., to an empty array) before the loop, or use an expression that defaults when.processedis absent.
processed: '${ .processed + [$color] }'
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (3)
examples/for-inline-array.yaml:20
- This example appends to
.processedwithout showing any prior initialization. If.processedstarts undefined, the first iteration may error (or produce unintended results) depending on expression semantics. Consider initializingprocessedto an empty array before the loop, or updating the expression to safely default to an empty array on first use.
- setProcessed:
set:
processed: '${ .processed + [$color] }'
schema/workflow.yaml:709
- This introduces a new validation path for
for.in(inline arrays) but the PR doesn’t add a targeted validation test case. Given the constraint that items must be objects, it would be valuable to add schema validation tests that (1) accept anarray<object>and (2) reject arrays containing non-objects (e.g., strings/numbers) to prevent regressions.
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.
schema/workflow.yaml:699
- The top-level
for.indescription says "inline array" while the actual allowed inline form is specifically an "inline array of objects" (as stated in theForInInlineArraybranch). Updating this description to explicitly say "inline array of objects" would better match the enforced constraint and the docs.
description: A runtime expression or an inline array used to get the collection to enumerate.
af0f9d3
into
open-workflow-specification:main
Summary
for.inproperty now accepts either a runtime expression (string) or an inline array of objectstype: objectas proposed in the issueChanges
schema/workflow.yaml: Changedfor.infromtype: stringtooneOfaccepting a string or an array of objectsdsl-reference.md: Updatedfor.intype documentation tostring | arrayexamples/for-inline-array.yaml: New example demonstrating inline array usageTest plan
Fixes #1163