Skip to content

pascalre/homeassistant-js-yaml-schema

Repository files navigation

homeassistant-js-yaml-schema

Coverage Status

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.

Usage

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.

License

homeassistant-js-yaml-schema is licensed under the MIT License.

About

A schema allowing js-yaml to process YAML documents including Home Assistent specific local tags.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •