DEV Community

Cover image for Enable auto-completion for AWS Step Functions in Visual Studio Code
Moritz Onken
Moritz Onken

Posted on

Enable auto-completion for AWS Step Functions in Visual Studio Code

TL;DR: Add the following configuration to your settings.json file and enjoy auto-completion when authoring Step Functions in files ending with .states.json or .states.yml:

    "yaml.schemas": {
        "": "*.states.yml"
    "json.schemas": [{
        "fileMatch": ["*.states.json"],
        "url": ""
Enter fullscreen mode Exit fullscreen mode

AWS Step Functions have been around since 2016 but only recently started to gain attention after they added over 9,000 AWS APIs directly into the states language. This, and the addition of the formidable Workflow Studio have made Step Functions a serious alternative to Lambda functions.

My workflow for building a new Step Function starts with the Workflow Designer. It's interface lets me browse all available integrations and I can simply drag-and-drop them in the right location. Then, I export the Step Function, convert it to YAML and stick it into my code repository. I prefer YAML over JSON because it allows me to add comments, use anchors and aliases, multi-line syntax and generally prefer the more concise presentation.

My editor of choice is Visual Studio Code and I was trying to find a basic schema validator and auto-completion for Step Functions. None of the options on the VSCode Marketplace offered this so I looked for a JSON Schema and came across asl-validator by Christophe Bougere. This was a great starting point as VSCode and the YAML extension support JSON schema out of the box. A few changes were necessary to make it play nice with VSCode over a remote URL but that's all it took.

After registering the schema with the editor via the json.schemas and yaml.schemas properties I was able to use auto-completion and basic validation for my step functions.

Limitations: At this point, the schema is limited to the Amazon States Language itself. It doesn't include all possible values for the task resource parameter, nor does it validate the Parameters property passed to a task like arn:aws:states:::aws-sdk:dynamodb:getItem.

Top comments (0)