sdk-go
sdk-go copied to clipboard
model.State.GetName() does not return a value when the state type is switch
What happened: model.State.GetName() does not return a value when the state type is switch What you expected to happen: state name is returned even when the state type is switch
Anything else we need to know?: I have tried this with only data based switch Environment:
- Specification version used:
- 0.6
- Go version: go1.16.3
Hi @tee05S many thanks for reporting this issue. Can you please share your workflow? I've tried with the latest PR (#43) targeting 0.7 version of the spec and it's working.
I can test with the previous version since I need to upgrade and fix the tag.
Hi @ricardozanini
this is the workflow sample I used:
{
"id": "applicantrequest",
"version": "1.0",
"name": "Applicant Request Decision Workflow",
"description": "Determine if applicant request is valid",
"start": "CheckApplication",
"functions": [
{
"name": "sendRejectionEmailFunction",
"operation": "http://myapis.org/applicationapi.json#emailRejection"
}
],
"states":[
{
"name":"CheckApplication",
"type":"switch",
"dataConditions": [
{
"condition": "${ .applicants | .age >= 18 }",
"transition":{"nextState": "StartApplication"}
},
{
"condition": "${ .applicants | .age < 18 }",
"transition":{"nextState": "RejectApplication"}
}
]
},
{
"name": "StartApplication",
"type": "operation",
"end": {
"kind": "terminate"
}
},
{
"name":"RejectApplication",
"type":"operation",
"actionMode":"sequential",
"actions":[
{
"functionRef": {
"refName": "sendRejectionEmailFunction",
"arguments": {
"applicant": "${ .applicant }"
}
}
}
],
"end": {
"kind": "terminate"
}
}
]
}
Hi!
I've just tested with the main
branch (version 2.1.0) and it's working fine. The DataSwitchState
has an intermediate BaseSwitchState
class in the hierarchy, but that shouldn't be a problem.
Can you try with the latest version? go get github.com/serverlessworkflow/sdk-go/v2

I'm closing this issue since it has been opened for quite some time without a response. Please reopen if needed.