Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For States that are used for Compensation Transition is optional but Validator throws an error #181

Closed
ilewin opened this issue Aug 18, 2023 · 0 comments · Fixed by #182
Closed
Assignees
Labels
bug 🐛 Something isn't working

Comments

@ilewin
Copy link
Contributor

ilewin commented Aug 18, 2023

What happened: Validation Error: Error: Field validation for 'Transition' failed on the 'required' tag.

{
  "id": "orderly",
  "name": "Orderly",
  "start": "First",
  "states": [
    {
      "name": "First",
      "type": "operation",
      "actions": [
        {
          "functionRef": {
            "refName": "Order",
            "arguments": {
              "input": {
                "train": "${.train}",
                "person": "${.order[0]}"
              }
            }
          },
          "actionDataFilter": {
            "results": "${ {train: .output} }"
          }
        }
      ],
      "transition": "Secend",
      "compensatedBy": "DeorderFirst"
    },
    {
      "name": "DeorderFirst",
      "type": "operation",
      "actions": [
        {
          "functionRef": {
            "refName": "DeOrder",
            "arguments": {
              "input": {
                "train": "${.train}",
                "person": "${.order[0]}"
              }
            }
          },
          "actionDataFilter": {
            "results": "${ {train: .output} }"
          }
        }
      ],
      "usedForCompensation": true
    },
    {
      "name": "PutJay",
      "type": "operation",
      "actions": [
        {
          "functionRef": {
            "refName": "Order",
            "arguments": {
              "input": {
                "train": "${.train}",
                "person": "jay"
              }
            }
          },
          "actionDataFilter": {
            "results": "${ {train: .output} }"
          }
        }
      ],
      "usedForCompensation": true
    },
    {
      "name": "Secend",
      "type": "operation",
      "actions": [
        {
          "functionRef": {
            "refName": "Order",
            "arguments": {
              "input": {
                "train": "${.train}",
                "person": "${.order[1]}"
              }
            }
          },
          "actionDataFilter": {
            "results": "${ {train: .output} }"
          }
        }
      ],
      "transition": "Third",
      "compensatedBy": "DeorderSecend"
    },
    {
      "name": "DeorderSecend",
      "type": "operation",
      "actions": [
        {
          "functionRef": {
            "refName": "DeOrder",
            "arguments": {
              "input": {
                "train": "${.train}",
                "person": "${.order[1]}"
              }
            }
          },
          "actionDataFilter": {
            "results": "${ {train: .output} }"
          }
        }
      ],
      "transition": "PutJay",
      "usedForCompensation": true
    },
    {
      "name": "Third",
      "type": "operation",
      "actions": [
        {
          "functionRef": {
            "refName": "Order",
            "arguments": {
              "input": {
                "train": "${.train}",
                "person": "${.order[2]}"
              }
            }
          },
          "actionDataFilter": {
            "results": "${ {train: .output} }"
          }
        }
      ],
      "transition": {
        "nextState": "Final",
        "compensate": true
      },
      "compensatedBy": "DeorderThird"
    },
    {
      "name": "DeorderThird",
      "type": "operation",
      "actions": [
        {
          "functionRef": {
            "refName": "DeOrder",
            "arguments": {
              "input": {
                "train": "${.train}",
                "person": "${.order[2]}"
              }
            }
          },
          "actionDataFilter": {
            "results": "${ {train: .output} }"
          }
        }
      ],
      "usedForCompensation": true
    },
    {
      "end": true,
      "name": "Final",
      "type": "operation",
      "actions": [
        {
          "functionRef": {
            "refName": "Order",
            "arguments": {
              "input": {
                "train": "${.train}",
                "person": "sudanshu"
              }
            }
          },
          "actionDataFilter": {
            "results": "${ {train: .output} }"
          }
        }
      ]
    }
  ],
  "retries": [
    {
      "name": "Default",
      "delay": "PT30S",
      "jitter": 0,
      "multiplier": 1.1,
      "maxAttempts": 50
    }
  ],
  "version": "1.0",
  "timeouts": {
    "actionExecTimeout": "PT15M"
  },
  "functions": [
    {
      "name": "Order",
      "operation": "cisco.testing.v1.0.0.load.Order"
    },
    {
      "name": "DeOrder",
      "operation": "cisco.testing.v1.0.0.load.DeOrder"
    }
  ],
  "description": "Order/Deorder",
  "specVersion": "1.8",
  "expressionLang": "jq"
}

What you expected to happen: The Definition above should not raise any errors

How to reproduce it: Unmarshal definition above

Anything else we need to know?:

Environment:

  • Specification version used:
  • Go version:
@ilewin ilewin added the bug 🐛 Something isn't working label Aug 18, 2023
ilewin pushed a commit to ilewin/sdk-go that referenced this issue Aug 18, 2023
ilewin pushed a commit to ilewin/sdk-go that referenced this issue Aug 21, 2023
…dForCompensation States

Signed-off-by: apidbere <apidbere@cisco.com>
ricardozanini pushed a commit that referenced this issue Aug 21, 2023
…tates (#182)

Signed-off-by: apidbere <apidbere@cisco.com>
Co-authored-by: apidbere <apidbere@cisco.com>
ilewin added a commit to ilewin/sdk-go that referenced this issue Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants