Schema to allow js-yaml to process YAML formatted Home Assistent templates that use Home Assistent specific local tags while parsing or dumping, for example: !env_var
, !include_dir_named
.
See tags.json for currently supported local tags.
const jsyaml = require('js-yaml');
const fs = require('fs');
import { HOMEASSISTANT_SCHEMA } from "homeassistant-js-yaml-schema"
let doc = yaml.load(fs.readFileSync('/path/to/file.yml', 'utf8'));
let body = jsyaml.load(doc, { schema: HOMEASSISTANT_SCHEMA });
console.log(JSON.stringify(body, null, 2));
body = jsyaml.dump(body, { schema: HOMEASSISTANT_SCHEMA });
console.log(body);
See usage in vscode-yaml-sort.
homeassistant-js-yaml-schema is licensed under the MIT License.