Skip to content

[Fix #1163] Allow inline arrays in for.in property - #1170

Merged
ricardozanini merged 6 commits into
open-workflow-specification:mainfrom
ricardozanini:fix/1163-for-in-array
Jul 28, 2026
Merged

[Fix #1163] Allow inline arrays in for.in property#1170
ricardozanini merged 6 commits into
open-workflow-specification:mainfrom
ricardozanini:fix/1163-for-in-array

Conversation

@ricardozanini

Copy link
Copy Markdown
Collaborator

Summary

  • The for.in property now accepts either a runtime expression (string) or an inline array of objects
  • This makes the schema more flexible for cases where the collection is known at definition time, without requiring a runtime expression
  • Array items are constrained to type: object as proposed in the issue

Changes

  • schema/workflow.yaml: Changed for.in from type: string to oneOf accepting a string or an array of objects
  • dsl-reference.md: Updated for.in type documentation to string | array
  • examples/for-inline-array.yaml: New example demonstrating inline array usage

Test plan

  • All 130 existing validation tests pass
  • New example validates against the updated schema

Fixes #1163

…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>
Copilot AI review requested due to automatic review settings July 23, 2026 18:57
@ricardozanini
ricardozanini requested a review from cdavernas as a code owner July 23, 2026 18:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.yaml so for.in accepts string or array (with items: { type: object }).
  • Updated dsl-reference.md to reflect the expanded for.in type.
  • Added examples/for-inline-array.yaml demonstrating 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.

Comment thread schema/workflow.yaml
Comment thread dsl-reference.md Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 23, 2026 19:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread schema/workflow.yaml
@ricardozanini

ricardozanini commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator Author

Regarding the suggestion to use $ref: '#/$defs/runtimeExpression' instead of plain type: string for the expression branch:

The plain type: string is intentional. The existing for.in field was type: string before this change, and existing CTK tests and examples use shorthand expressions like .pets and .colors (without the ${ } wrapper). These don't match the runtimeExpression pattern ^\s*\$\{.+\}\s*$.

The runtimeExpression ref is only used in schema locations where oneOf disambiguation against other string types (like uriTemplate) requires it. Here, the oneOf already discriminates by type (string vs array), so there's no ambiguity to resolve. Switching to runtimeExpression would break all existing for.in usages in loose evaluation mode.

Copilot AI review requested due to automatic review settings July 28, 2026 07:32

@cdavernas cdavernas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Cheers ❤️

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 accepts array<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 .processed without showing initialization. To make the example copy/paste-safe and self-explanatory, initialize processed (e.g., to an empty array) before the loop, or use an expression that defaults when .processed is absent.
              processed: '${ .processed + [$color] }'

Copilot AI review requested due to automatic review settings July 28, 2026 07:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 28, 2026 09:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .processed without showing any prior initialization. If .processed starts undefined, the first iteration may error (or produce unintended results) depending on expression semantics. Consider initializing processed to 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 an array<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.in description says "inline array" while the actual allowed inline form is specifically an "inline array of objects" (as stated in the ForInInlineArray branch). 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.

Copilot AI review requested due to automatic review settings July 28, 2026 19:15
@ricardozanini
ricardozanini merged commit af0f9d3 into open-workflow-specification:main Jul 28, 2026
3 checks passed
@ricardozanini
ricardozanini deleted the fix/1163-for-in-array branch July 28, 2026 19:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

In property in for task should allow hardcoded arrays

3 participants