Skip to content

Commit bd10e65

Browse files
committed
docs: Make sure the DSL documentation reflects clearly the code
Signed-off-by: Matheus André <matheusandr2@gmail.com>
1 parent ac16ede commit bd10e65

2 files changed

Lines changed: 13 additions & 14 deletions

File tree

‎experimental/fluent/func/src/main/java/io/serverlessworkflow/fluent/func/dsl/Step.java‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ public SELF exportAs(String jqExpression) {
278278
*
279279
* <pre>{@code
280280
* agent("investmentAnalyst", analyst::analyse, InvestmentMemo.class)
281-
* .outputAs(memo -> Map.of("memo", memo))
281+
* .outputAs(taskOutput -> Map.of("memo", taskOutput))
282282
* .when(condition);
283283
* }</pre>
284284
*
@@ -318,20 +318,21 @@ public <T, R> SELF outputAs(Function<T, R> function, Class<T> taskResultClass) {
318318
* Shapes what gets written back into the workflow data document using a context-aware filter
319319
* function.
320320
*
321-
* <p>This variant provides access to both workflow and task context, allowing you to inspect
322-
* metadata, task input, and raw output when shaping the committed output.
321+
* <p>This variant provides access to the task result as the first lambda parameter, plus the
322+
* workflow and task context for metadata, task input, and raw output when shaping the committed
323+
* output.
323324
*
324325
* <p><strong>Example:</strong>
325326
*
326327
* <pre>{@code
327328
* get("fetchMarketData", "http://localhost:8081/market-data/{ticker}")
328-
* .outputAs((MarketDataSnapshot snapshot,
329+
* .outputAs((MarketDataSnapshot taskOutput,
329330
* WorkflowContextData wf,
330331
* TaskContextData task) -> {
331332
* var input = task.input().asMap().orElseThrow();
332333
* var rawBody = task.rawOutput().asText().orElseThrow();
333334
* return new InvestmentPrompt(
334-
* snapshot.ticker(),
335+
* taskOutput.ticker(),
335336
* input.get("objective").toString(),
336337
* rawBody
337338
* );

‎experimental/lambda/src/test/java/io/serverless/workflow/impl/executors/func/FuncDSLDataFlowTransformationHelpersTest.java‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,13 @@ void test_input_with_outputAs() {
8282
},
8383
Long.class)
8484
.outputAs(
85-
(object, workflowContext, taskContextData) -> {
86-
softly.assertThat(object).isEqualTo(15L);
85+
(Long taskOutput,
86+
WorkflowContextData workflowContext,
87+
TaskContextData taskContextData) -> {
88+
softly.assertThat(taskOutput).isEqualTo(15L);
8789
Long input = input(workflowContext, Long.class);
8890
softly.assertThat(input).isEqualTo(10L);
89-
return input + object;
91+
return input + taskOutput;
9092
},
9193
Long.class))
9294
.build();
@@ -119,9 +121,7 @@ void test_output_with_exportAs() {
119121
},
120122
Long.class)
121123
.exportAs(
122-
(Long object,
123-
WorkflowContextData workflowContext,
124-
TaskContextData taskContextData) -> {
124+
(object, workflowContext, taskContextData) -> {
125125
Long taskOutput = output(taskContextData, Long.class);
126126
softly.assertThat(taskOutput).isEqualTo(15L);
127127
return taskOutput * 2;
@@ -178,9 +178,7 @@ void test_input_with_exportAs() {
178178
},
179179
Long.class)
180180
.exportAs(
181-
(Long object,
182-
WorkflowContextData workflowContext,
183-
TaskContextData taskContextData) -> {
181+
(object, workflowContext, taskContextData) -> {
184182
Long taskOutput = output(taskContextData, Long.class);
185183
softly.assertThat(taskOutput).isEqualTo(15L);
186184
Long input = input(workflowContext, Long.class);

0 commit comments

Comments
 (0)