<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Moritz Onken</title>
    <description>The latest articles on DEV Community by Moritz Onken (@monken).</description>
    <link>https://dev.to/monken</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F818677%2Fa9cd1c9b-4325-43ca-a22b-03fe8f15e66b.jpeg</url>
      <title>DEV Community: Moritz Onken</title>
      <link>https://dev.to/monken</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/monken"/>
    <language>en</language>
    <item>
      <title>Enable auto-completion for AWS Step Functions in Visual Studio Code</title>
      <dc:creator>Moritz Onken</dc:creator>
      <pubDate>Sun, 20 Feb 2022 16:28:02 +0000</pubDate>
      <link>https://dev.to/monken/enable-auto-completion-for-aws-step-functions-in-visual-studio-code-582i</link>
      <guid>https://dev.to/monken/enable-auto-completion-for-aws-step-functions-in-visual-studio-code-582i</guid>
      <description>&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; Add the following configuration to your &lt;code&gt;settings.json&lt;/code&gt; file and enjoy auto-completion when authoring Step Functions in files ending with &lt;code&gt;.states.json&lt;/code&gt; or &lt;code&gt;.states.yml&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"yaml.schemas"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"https://unpkg.com/asl-validator@2.0.0/src/schemas/state-machine.json"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"*.states.yml"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"json.schemas"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"fileMatch"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"*.states.json"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://unpkg.com/asl-validator@2.0.0/src/schemas/state-machine.json"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;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 &lt;a href="https://aws.amazon.com/about-aws/whats-new/2021/announcing-workflow-studio-a-new-low-code-visual-workflow-designer-foraws-step-functions/"&gt;Workflow Studio&lt;/a&gt; have made Step Functions a serious alternative to Lambda functions.&lt;/p&gt;

&lt;p&gt;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 &lt;a href="https://yaml.org/spec/1.2.2/#anchors-and-aliases"&gt;anchors and aliases&lt;/a&gt;, multi-line syntax and generally prefer the more concise presentation.&lt;/p&gt;

&lt;p&gt;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 &lt;a href="https://github.com/ChristopheBougere/asl-validator"&gt;asl-validator&lt;/a&gt; by &lt;a href="https://github.com/ChristopheBougere"&gt;Christophe Bougere&lt;/a&gt;. This was a great starting point as VSCode and the &lt;a href="https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml"&gt;YAML extension&lt;/a&gt; support JSON schema out of the box. A &lt;a href="https://github.com/ChristopheBougere/asl-validator/pull/76"&gt;few changes&lt;/a&gt; were necessary to make it play nice with VSCode over a remote URL but that's all it took.&lt;/p&gt;

&lt;p&gt;After registering the schema with the editor via the &lt;code&gt;json.schemas&lt;/code&gt; and &lt;code&gt;yaml.schemas&lt;/code&gt; properties I was able to use auto-completion and basic validation for my step functions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Limitations:&lt;/strong&gt; At this point, the schema is limited to the &lt;a href="https://states-language.net/spec.html"&gt;Amazon States Language&lt;/a&gt; itself. It doesn't include all possible values for the task resource parameter, nor does it validate the &lt;code&gt;Parameters&lt;/code&gt; property passed to a task like &lt;code&gt;arn:aws:states:::aws-sdk:dynamodb:getItem&lt;/code&gt;.&lt;/p&gt;

</description>
      <category>vscode</category>
      <category>aws</category>
      <category>ide</category>
      <category>json</category>
    </item>
  </channel>
</rss>
