serverlessworkflow / sdk-typescript

Typescript SDK for Serverless Workflow
https://serverlessworkflow.io/
Apache License 2.0
62 stars 16 forks source link

fixed-end-condition-mermaid #141

Closed antmendoza closed 2 years ago

antmendoza commented 2 years ago

Many thanks for submitting your Pull Request :heart:!

What this PR does / why we need it: closes #140

Special notes for reviewers:

Additional information (if needed):

antmendoza commented 2 years ago

given this workflow:


{
  "id": "applicantrequest",
  "version": "1.0",
  "specVersion": "0.7",
  "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":[
    {
      "type":"switch",
      "name":"CheckApplication",
      "dataConditions": [
        {
          "condition": "${ .applicants | .age >= 18 }",
          "transition": "StartApplication"
        },
        {
          "condition": "${ .applicants | .age < 18 }",
          "end": true
        }
      ],
      "defaultCondition": {
        "transition": "StartApplication"
      }
    },
    {
      "type": "operation",
      "name": "StartApplication",
      "actions": [
        {
          "subFlowRef": "startApplicationWorkflowId"
        }
      ],
      "end": true
    }
  ]
}

this is the output:

tsurdilo commented 2 years ago

@antmendoza thank you!!