-
Notifications
You must be signed in to change notification settings - Fork 169
Description
I tried this:
The https://github.com/serverlessworkflow/specification/blob/main/dsl-reference.md#extension section states that the before and after types are of type [map[string, task]], and the Rust SDK implements them as as HashMap https://github.com/serverlessworkflow/sdk-rust/blob/main/core/src/models/extension.rs#L17-L23:
/// Gets/sets a name/definition map, if any, of the tasks to execute before the extended task
#[serde(rename = "before", skip_serializing_if = "Option::is_none")]
pub before: Option<HashMap<String, TaskDefinition>>,
/// Gets/sets a name/definition map, if any, of the tasks to execute after the extended task
#[serde(rename = "after", skip_serializing_if = "Option::is_none")]
pub after: Option<HashMap<String, TaskDefinition>>
However, the example in the https://github.com/serverlessworkflow/specification/blob/main/dsl-reference.md#extension defines the properties as lists:
before:
- sendLog:
call: http
with:
method: post
endpoint: https://fake.log.collector.com
body:
message: ${ "Executing task '\($task.reference)'..." }
after:
- sendLog:
call: http
with:
method: post
endpoint: https://fake.log.collector.com
body:
message: ${ "Executed task '\($task.reference)'..." }
It is also defined as a list in this example: https://github.com/serverlessworkflow/specification/blob/main/examples/mock-service-extension.yaml.
The schema also defines them as lists at https://github.com/serverlessworkflow/specification/blob/main/schema/workflow.yaml#L1589-L1596:
before:
$ref: '#/$defs/taskList'
title: ExtensionDoBefore
description: The task(s) to execute before the extended task, if any.
after:
$ref: '#/$defs/taskList'
title: ExtensionDoAfter
description: The task(s) to execute after the extended task, if any.
This happened:
I tried following https://github.com/serverlessworkflow/specification/blob/main/examples/mock-service-extension.yaml with the Rust SDK and it didn't work as expected.
I expected this:
Based off of the spec I expected this to happen:
document:
dsl: '1.0.2'
namespace: test
name: sample-workflow
version: 0.1.0
use:
extensions:
mockService:
extend: call
when: ($task.with.endpoint != null and ($task.with.endpoint | startswith("https://mocked.service.com"))) or ($task.with.endpoint.uri != null and ($task.with.endpoint.uri | startswith("https://mocked.service.com")))
before:
mockResponse:
set:
statusCode: 200
headers:
Content-Type: application/json
content:
foo:
bar: baz
then: exit #using this, we indicate to the workflow we want to exit the extended task, thus just returning what we injected
do:
- callHttp:
call: http
with:
method: get
endpoint:
uri: https://fake.com/sample
Is there a workaround?
No response
Anything else?
I think there is a discrepancy here that needs to be resolved, but I am not sure which type is correct!
Area(s)
No response
Community Notes
- Please vote by adding a 👍 reaction to the issue to help us prioritize.
- If you are interested to work on this issue, please leave a comment.name: Bug Report 🐞
Metadata
Metadata
Assignees
Labels
Type
Projects
Status