JSON schema

JSON, YAML and TOML configuration files can benefit from a JSON schema that describes the config structure depending on the selected restic and configuration file version.

Schema URLs

JSON schema URLs for any restic version:

These universal schemas contain all flags and commands of all known restic versions and may allow to set flags that are not supported by a particular restic version. Descriptions and deprecation markers indicate what is supported and what should no longer be used.

JSON schema URLs for a specific restic version (list of available URLs):

  • .../config-1-restic-{MAJOR}-{MINOR}.json
  • .../config-2-restic-{MAJOR}-{MINOR}.json

These schemas contain only flags and commands of a specific restic version. The schema will validate a config only when flags are used that the selected restic version supports according to its manual pages.

As an alternative to URLs, schemas can be generated locally with: resticprofile generate --json-schema [--version RESTIC_VERSION] [v2|v1]

Usage (vscode)

To use a schema with vscode, begin your config files with:

#:schema https://259-merge.resticprofile.pages.dev/jsonschema/config-2.json

version = "2"
 
# yaml-language-server: $schema=https://259-merge.resticprofile.pages.dev/jsonschema/config-2.json

version: "2"
 
{
    "$schema": "https://259-merge.resticprofile.pages.dev/jsonschema/config-2.json",
    "version": "2"
}

YAML & TOML validation with JSON schema is not supported out of the box. Additional extensions are required.

Example

Extension: redhat.vscode-yaml