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
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*/
package io.serverlessworkflow.fluent.spec;

import io.serverlessworkflow.api.types.ForIn;
import io.serverlessworkflow.api.types.ForTask;
import io.serverlessworkflow.api.types.ForTaskConfiguration;
import io.serverlessworkflow.api.types.In;
import io.serverlessworkflow.api.types.TaskItem;
import io.serverlessworkflow.fluent.spec.spi.ForEachTaskFluent;
import java.util.List;
Expand Down Expand Up @@ -49,7 +49,7 @@ public ForEachTaskBuilder<T> each(String each) {
}

public ForEachTaskBuilder<T> in(String in) {
this.forTaskConfiguration.setIn(new In().withForInExpression(in));
this.forTaskConfiguration.setIn(new ForIn().withForInExpression(in));
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package io.serverlessworkflow.impl.executors;

import io.serverlessworkflow.api.types.ForIn;
import io.serverlessworkflow.api.types.ForTask;
import io.serverlessworkflow.api.types.In;
import io.serverlessworkflow.impl.TaskContext;
import io.serverlessworkflow.impl.WorkflowContext;
import io.serverlessworkflow.impl.WorkflowDefinition;
Expand Down Expand Up @@ -51,7 +51,7 @@ protected Optional<WorkflowPredicate> buildWhileFilter() {
}

protected WorkflowValueResolver<Collection<?>> buildCollectionFilter() {
In in = task.getFor().getIn();
ForIn in = task.getFor().getIn();
return application
.expressionFactory()
.resolveCollection(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ private static Stream<Arguments> provideParameters() {
Map.of("input", Arrays.asList(1, 2, 3)),
o -> assertThat(o).isEqualTo(6),
c -> assertThat(c).isEqualTo(Map.of("incr", Arrays.asList(2, 3, 4)))),
args(
"workflows-samples/for-sum-fixed.yaml",
Map.of(),
o -> assertThat(o).isEqualTo(6),
c -> assertThat(c).isEqualTo(Map.of("incr", Arrays.asList(2, 3, 4)))),
args(
"workflows-samples/switch-then-loop.yaml",
Map.of("count", 1),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
document:
dsl: '1.0.0-alpha5'
namespace: test
name: for-sum-fixed-example
version: '0.1.0'
do:
- sumAll:
for:
each: number
in:
- 1
- 2
- 3
do:
- accumulate:
set:
counter: ${.counter+$number}
export:
as: if .incr==null then {incr:[$number+1]} else .incr+=[$number+1] end
output:
as: .counter

3 changes: 1 addition & 2 deletions types/src/main/resources/schema/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -711,9 +711,8 @@ $defs:
description: A runtime expression used to get the collection to enumerate.
- type: array
title: ForInInlineArray
description: An inline array of objects to enumerate.
description: An inline array to enumerate.
items:
type: object
description: An item in the inline collection.
at:
type: string
Expand Down
Loading