Skip to main content

Editor Support

There is a json schema file which can be used to integrate with your editor. This will help validate your yaml files and provide intellisense for the spec.

VSCode

For VSCode you'll need to use a YAML plugin that supports JSON schemas, such as YAML Support by Red Hat. Follow the plugins instructions to add the schema to your workspace. Here are some examples of vscode workspace configs settings.json enabling the JSON schema:

  1. Schema is locally available and enable it for yml files under a single directory.
{
"yaml.schemas": {
"docs/spec.schema.json": "test/fixtures/*.yml"
}
}
  1. Schema is locally available and enable it for yml files under multiple directories.
{
"yaml.schemas": {
"docs/spec.schema.json": [
"test/fixtures/*.yml",
"docs/**/*.yml"
]
}
}
  1. Directly reference schema from GitHub repository URL.
{
"yaml.schemas": {
"https://raw.githubusercontent.com/Azure/dalec/<version>/docs/spec.schema.json" : "test/fixtures/*.yml"
}
}

You may find with this extension that null-able yaml objects will show as errors in the editor unless you specify the empty value. An example:

args:
FOO:

In this example the json schema says that FOO should be a string but we've left it null which is perfectly valid yaml and will unmarshal to an empty string. The yaml plugin will complain that it is an incorrect type. To fix this you can specify the empty string as the value:

args:
FOO: ""