sdk-go icon indicating copy to clipboard operation
sdk-go copied to clipboard

model.State.GetName() does not return a value when the state type is switch

Open tee05S opened this issue 3 years ago • 3 comments

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

tee05S avatar Sep 29 '21 07:09 tee05S

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.

ricardozanini avatar Sep 29 '21 19:09 ricardozanini

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" } } ] }

tee05S avatar Oct 04 '21 17:10 tee05S

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

Screen Shot 2021-10-04 at 15 18 50

ricardozanini avatar Oct 04 '21 18:10 ricardozanini

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

ricardozanini avatar Sep 08 '22 14:09 ricardozanini