serverlessworkflow / sdk-java

Java SDK for Serverless Workflow
http://serverlessworkflow.io
Apache License 2.0
76 stars 46 forks source link

Retry definition validation doesn't work #213

Closed escos closed 3 months ago

escos commented 1 year ago

Given: Workflow definition to be validated

{
  "id": "workflow_1",
  "name": "workflow_1",
  "description": "workflow_1",
  "version": "1.0",
  "specVersion": "0.8",
  "start": "Task1",
  "functions": [
    {
      "name": "increment",
      "type": "custom",
      "operation": "worker"
    }
  ],
  "retries": [
    {
      "maxAttempts": 3
    }
  ],
  "states": [
    {
      "name": "Task1",
      "type": "operation",
      "actionMode": "sequential",
      "actions": [
        {
          "functionRef": {
            "refName": "increment",
            "arguments": {
              "input": "some text"
            }
          },
          "retryRef": "const",
          "actionDataFilter": {
            "toStateData": "${ .result }"
          }
        }
      ],
      "end": true
    }
  ]
}

Expected result: Validation failed (because of name of RetryDefinition missed)

Actual result: Validation passed.

The same result(validation passed) if 'name' field is empty or/and maxAttempts not defined. According to specification 'name ' is required and maxAttempts not. But in the retrydef.json schema they are required both.

Could you please support us in this question? May be we miss something?

ricardozanini commented 3 months ago

Hi! maxAttempts is required per the Specification schema: https://github.com/serverlessworkflow/specification/blob/0.8.x/schema/retries.json#L81.

I'll fix the name validation.