Automatic YAML validation
Automatic YAML validation during editing

The Airlock Microgateway has many DSL attributes. This makes our product very powerful, but also more difficult to keep track of all available options. In addition, typos during editing easily lead to configuration errors.

To assist you with YAML changes, we have published a JSON Schema of the DSL on GitHub.

  • Use it in an IDE (e.g. Microsoft Visual Studio Code) or your favorite editor with JSON Schema support to benefit from the following:
  • Validation during editing
  • Document outlining
  • Auto completion
  • Display documentation when hovering over attributes

Visual Studio Code configuration for the JSON Schema

To configure Visual Studio Code, do the following:

  • 1.
    Install the YAML Language Support by Red Hat extension for Visual Studio Code.
    https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml
  • 2.
    Edit the settings.json in Visual Studio Code as described on Visual Studio Code - Settings file locations.
  • 3.
    Ensure that the desired JSON Schema is configured for Visual Studio Code:
  • copy
    { 
         "editor.tabSize": 2, 
        "workbench.colorTheme": "Visual Studio Dark", 
        "yaml.schemas": { 
           "https://json.schemastore.org/airlock-microgateway-3.1.json":
             [ 
                "config.yaml" 
             ] 
        },    
        "yaml.format.enable": true, 
        "yaml.format.singleQuote": false, 
        "yaml.format.bracketSpacing": true, 
        "yaml.format.proseWrap": "preserve", 
        "yaml.format.printWidth": 80, 
        "yaml.validate": true, 
        "yaml.hover": true, 
        "yaml.completion": true    
    }
  • Enjoy the support during editing.

With this configuration, the Visual Studio Code Extension will use the JSON Schema for files with the name config.yaml.

Automatic validation example with Visual Studio Code

After configuring Visual Studio Code to use our JSON Schema for validation, editing the YAML file is supported while typing.

Microgateway-Visual-Studio-Code-JSON-schema