Skip to content

Add metadata support to TaskBaseBuilder and implement TaskMetadataBuilder - #1694

Open
matheusandre1 wants to merge 1 commit into
open-workflow-specification:mainfrom
matheusandre1:issue1689
Open

matheusandre1 wants to merge 1 commit into
open-workflow-specification:mainfrom
matheusandre1:issue1689

Conversation

@matheusandre1

Copy link
Copy Markdown
Contributor

Many thanks for submitting your Pull Request ❤️!

What this PR does / why we need it:

Closes: #1689

Adds a fluent metadata() method to TaskBaseBuilder so task metadata can be configured directly in the builder DSL, following the existing DocumentBuilder.metadata() pattern.

tasks.set("loop-task-0", s -> s
    .expr("$.value = 'test'")
    .metadata(meta -> meta
        .description("Exit when counter reaches 10")
        .put("exitConditionDescription", "counter == 10")));

Special notes for reviewers:

Additional information (if needed):

…lder

Signed-off-by: Matheus André <matheusandr2@gmail.com>
Copilot AI lite review requested due to automatic review settings September 18, 2026 15:54

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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Pull request overview

Adds fluent task metadata configuration to the builder DSL by introducing a TaskMetadataBuilder and wiring it into TaskBaseBuilder.metadata(), with a corresponding test to validate behavior.

Changes:

  • Add TaskMetadataBuilder fluent API for building TaskMetadata entries.
  • Add TaskBaseBuilder.metadata(Consumer<TaskMetadataBuilder>) to configure task metadata in the DSL.
  • Add a unit test verifying metadata is set when configured and remains unset otherwise.

Reviewed changes

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

File Description
fluent/spec/src/test/java/io/serverlessworkflow/fluent/spec/WorkflowBuilderTest.java Adds coverage for task metadata being populated via the DSL and absent when not configured.
fluent/spec/src/main/java/io/serverlessworkflow/fluent/spec/TaskMetadataBuilder.java Introduces a fluent builder for TaskMetadata with convenience helpers.
fluent/spec/src/main/java/io/serverlessworkflow/fluent/spec/TaskBaseBuilder.java Exposes metadata() on tasks and applies built TaskMetadata onto the underlying task model.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +137 to +142
public T metadata(Consumer<TaskMetadataBuilder> metadataConsumer) {
final TaskMetadataBuilder metadataBuilder = new TaskMetadataBuilder();
metadataConsumer.accept(metadataBuilder);
this.task.setMetadata(metadataBuilder.build());
return self();
}
Comment on lines +128 to +136
/**
* Configures additional information about this task, such as descriptions meant for UI
* visualization. Parallel to the `metadata` property in the Spec.
*
* @param metadataConsumer consumer used to populate the task metadata
* @see <a
* href="https://github.com/serverlessworkflow/specification/blob/main/dsl-reference.md#task">DSL
* Reference - Task</a>
*/
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.

Add metadata() method to TaskBaseBuilder for task metadata configuration

2 participants