[Fix #1612] Adding test with fixed collection - #1614
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a regression test (per #1612) to ensure for tasks can iterate over a hard-coded (inline) collection, validating the runtime/schema support for fixed collections.
Changes:
- Added a new workflow sample (
for-sum-fixed.yaml) that uses an inline collection for aforloop. - Extended
WorkflowDefinitionTestparameterization to execute and assert the new sample’s output and exported context.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| impl/test/src/test/resources/workflows-samples/for-sum-fixed.yaml | New workflow sample exercising for.in as a hard-coded collection. |
| impl/test/src/test/java/io/serverlessworkflow/impl/test/WorkflowDefinitionTest.java | Adds a new parameterized test case to run/assert the new sample. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| for: | ||
| each: number | ||
| in: | ||
| - item: 1 | ||
| - item: 2 | ||
| - item: 3 | ||
| do: | ||
| - accumulate: | ||
| set: | ||
| counter: ${.counter+$number.item} | ||
| export: | ||
| as: if .incr==null then {incr:[$number.item+1]} else .incr+=[$number.item+1] end |
There was a problem hiding this comment.
And how Im supposed to do that if the schema requires an object there?, probably schema should be changed to any
There was a problem hiding this comment.
@ricardozanini After writing the example, I feel that, for maximun flexibility, the type of the array should be any in the workflow schema, so lets keep thisPR opened while we evaluate that and update it if the schema is finally updated.
There was a problem hiding this comment.
Signed-off-by: Francisco Javier Tirado Sarti <ftirados@ibm.com>
Fix #1612