awslabs / statelint

A Ruby gem that provides a command-line validator for Amazon States Language JSON files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Linter errors on BackoffRate for not being a float but console formatter removes .0

G-Rath opened this issue · comments

State Machine.States.CallWebhook.Retry[0].BackoffRate is 5 but should be a Float

I have the following state machine JSON:

{
  "Comment": "Call a webhook and retry on failure.",
  "StartAt": "CallWebhook",
  "States": {
    "CallWebhook": {
      "Type": "Task",
      "Resource": "<arn>",
      "Retry": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "IntervalSeconds": 60,
          "MaxAttempts": 5,
          "BackoffRate": 5
        }
      ],
      "End": true
    }
  }
}

statelint complains:

statelint ./state-machine.json
One error:
 State Machine.States.CallWebhook.Retry[0].BackoffRate is 5 but should be a Float

I can resolve this by adding .0 to the value, however this is removed by the Step Function "Format JSON" button in the AWS Console.

A number without decimals is a valid value for BackoffRate that is accepted by Step Functions. The spec's definition of BackoffRate:

a number which is the multiplier that increases the retry interval on each attempt (default: 2.0). The value of BackoffRate MUST be greater than or equal to 1.0.

j2119's constraints on this field are incorrect:
https://github.com/awslabs/j2119/blob/232a1a18f1f2c9a9bbe6b3982640d8c28183d4d1/data/AWL.j2119#L38