Skip to content

feat: optional taskName parameter to switchWhenOrElse, forEach, and o…#1362

Open
matheusandre1 wants to merge 1 commit intoserverlessworkflow:mainfrom
matheusandre1:issue1355
Open

feat: optional taskName parameter to switchWhenOrElse, forEach, and o…#1362
matheusandre1 wants to merge 1 commit intoserverlessworkflow:mainfrom
matheusandre1:issue1355

Conversation

@matheusandre1
Copy link
Copy Markdown
Contributor

…ther control flow methods

Many thanks for submitting your Pull Request ❤️!

What this PR does / why we need it: Closes: #1355

Special notes for reviewers:

Additional information (if needed):

I thought it was relevant to add a FuncDSLTaskNameTest test layer.

Copilot AI review requested due to automatic review settings April 30, 2026 20:53
@matheusandre1 matheusandre1 requested a review from fjtirado as a code owner April 30, 2026 20:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses #1355 by adding optional taskName-first overloads to FuncDSL control-flow helpers so callers can give explicit, descriptive names to generated switch/for-loop tasks (improving readability and .then("...") navigation) while preserving backward compatibility.

Changes:

  • Added taskName-first overloads for switchWhen, switchWhenOrElse (predicate + JQ variants), forEach, and forEachItem, with existing overloads delegating to the new ones.
  • Threaded the provided taskName through to the underlying FuncTaskItemListBuilder methods (switchCase(...), forEach(...)) so naming behavior is consistent with other DSL tasks.
  • Added a comprehensive new JUnit test suite covering named/unnamed behavior and backwards compatibility for the updated control-flow APIs.

Reviewed changes

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

File Description
experimental/fluent/func/src/main/java/io/serverlessworkflow/fluent/func/dsl/FuncDSL.java Introduces taskName-first overloads for switch/forEach control-flow helpers and delegates legacy overloads to them.
experimental/fluent/func/src/test/java/io/serverlessworkflow/fluent/func/FuncDSLTaskNameTest.java Adds test coverage validating explicit naming, auto-naming, and backward compatibility across the new overloads.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Collaborator

@mcruzdev mcruzdev left a comment

Choose a reason for hiding this comment

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

Amazing PR! Thanks!

Copilot AI review requested due to automatic review settings May 2, 2026 16:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread impl/core/src/main/java/io/serverlessworkflow/impl/executors/ForExecutor.java Outdated
@matheusandre1
Copy link
Copy Markdown
Contributor Author

In the ForExecutor block, there's a bug in the test that caused a race condition in the CI. I added local variables and redefined them in each lambda of the thencompose

Copilot AI review requested due to automatic review settings May 2, 2026 23:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread impl/core/src/main/java/io/serverlessworkflow/impl/executors/ForExecutor.java Outdated
…ther control flow methods

Signed-off-by: Matheus André <matheusandr2@gmail.com>
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.

FuncDSL: Add optional taskName parameter to switchWhenOrElse, forEach, and other control flow methods

4 participants