Skip to content

Add support to set(Map) on func DSL (experimental) #1155

@mcruzdev

Description

@mcruzdev

Problem

Currently the following code does not work as expected:

  @Test
  void set_with_map() {
    Workflow workflow =
        FuncWorkflowBuilder.workflow().tasks(set(Map.of("message", "hello world!"))).build();

    WorkflowApplication app = WorkflowApplication.builder().build();

    WorkflowDefinition workflowDefinition = app.workflowDefinition(workflow);

    WorkflowModel model = workflowDefinition.instance(Map.of()).start().join();

    Optional<String> text = model.asText(); // return "{ }"
  }

The workflow's output returns an empty object ever (not expected).

Using a JQ approach like:

      return WorkflowBuilder.workflow("hello")
                .tasks(t -> t.set("sayHelloWorld", "{ message: \"hello world!\" }"))
                .build();

The result of the worklfow is: { "message": "hello world" } .

I would be great if we have the same behavior with set(Map.of("message", "hello world!") approach.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions