Integer types raise validation errors for Amazon State Languages files (`DefinitionSubstitutions` in step functions)
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 807
- Avg merge
- 10h 12m
- Merged PRs (30d)
- 7
Description
## Problem
As per the documentation on [`DefineSubstitutions`](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-statemachine.html#sam-statemachine-definitionsubstitutions), variables should be formatted as `${variableName}`. When doing this for integers, the editor raises validation errors. For example, when defining a [retrying block](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-error-handling.html#retrybackoffrate) for one of the step function states, the `MaxAttempts` key needs an integer.
```json
"Retry": [
{
"ErrorEquals": [
"States.TaskFailed"
],
"IntervalSeconds": 300,
"MaxAttempts": ${MaxAttempts},
"BackoffRate": 1
}
],
```
This will then two errors:
```json
[{
"resource": "/Users/bas/code/sample-project/state-machine.asl.json",
"owner": "_generated_diagnostic_collection_name_#3",
"code": "516",
"severity": 8,
"message": "Value expected",
"source": "asl",
"startLineNumber": 15,
"startColumn": 30,
"endLineNumber": 15,
"endColumn": 31
},{
"resource": "/Users/bas/code/sample-project/state-machine.asl.json",
"owner": "_generated_diagnostic_collection_name_#3",
"severity": 8,
"message": "Incorrect type. Expected \"object\".",
"startLineNumber": 16,
"startColumn": 15,
"endLineNumber": 16,
"endColumn": 28
}]
```
## Steps to reproduce the issue
Use the example provided in the problem. This will then raise the validation errors.
## Expected behavior
The validation errors not being shown.
## System details (run `AWS: About` and/or `Amazon Q: About`)
- OS: `MacOS 15.1.1 (24B91)`
- Visual Studio Code version: `1.97.2`
- AWS Toolkit version: `3.47.0`
- Amazon Q version:
Contributor guide
Research direction
Start by reproducing the example in state-machine.asl.json and trace the ASL validation path for DefinitionSubstitutions. Confirm how an integer substitution such as MaxAttempts is handled, then verify that the example no longer reports the shown diagnostics while normal validation remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode
- Domain
- cloud, devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100