docs: Make sure the DSL documentation reflects clearly the code#1336
docs: Make sure the DSL documentation reflects clearly the code#1336matheusandre1 wants to merge 1 commit intoserverlessworkflow:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Updates fluent DSL documentation/examples to clarify that context-aware outputAs lambdas receive the task result as their first parameter (aligning docs with runtime behavior and the discussion in #1284).
Changes:
- Update
Step.outputAs(...)JavaDoc examples/wording to name the first lambda parametertaskOutputand describe it explicitly as the task result. - Adjust
FuncDSLDataFlowTransformationHelpersTestto use a typedtaskOutputparameter foroutputAs(...).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| experimental/lambda/src/test/java/io/serverless/workflow/impl/executors/func/FuncDSLDataFlowTransformationHelpersTest.java | Updates DSL usage in tests; outputAs now uses the task output parameter explicitly (but exportAs tests still rely on output(taskContextData, ...)). |
| experimental/fluent/func/src/main/java/io/serverlessworkflow/fluent/func/dsl/Step.java | Refines outputAs JavaDoc to clearly state and demonstrate that the first parameter is the task result. |
Comments suppressed due to low confidence (1)
experimental/lambda/src/test/java/io/serverless/workflow/impl/executors/func/FuncDSLDataFlowTransformationHelpersTest.java:186
- Same issue as above:
exportAs(FilterFunction)receives the task output as its first parameter, but the test ignores it and re-reads output fromtaskContextData. This makes the test not validate the documented/expected contract and can causeReflectionUtils.inferInputType(...)to inferObjectfor the lambda input type. Prefer typing/using the first parameter (e.g.,Long taskOutput) and remove theoutput(...)helper call in this test.
.exportAs(
(object, workflowContext, taskContextData) -> {
Long taskOutput = output(taskContextData, Long.class);
softly.assertThat(taskOutput).isEqualTo(15L);
Long input = input(workflowContext, Long.class);
softly.assertThat(input).isEqualTo(10L);
return input + taskOutput;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bd10e65 to
87341e9
Compare
87341e9 to
b306bad
Compare
There was a problem hiding this comment.
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.
Signed-off-by: Matheus André <matheusandr2@gmail.com>
b306bad to
d9a70c2
Compare
Many thanks for submitting your Pull Request ❤️!
What this PR does / why we need it: Closes: #1284
Special notes for reviewers:
Additional information (if needed):
I had forgotten to take care of that....