Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pascalre/homeassistant-js-yaml-schema
A schema allowing js-yaml to process YAML documents including Home Assistent specific local tags.
https://github.com/pascalre/homeassistant-js-yaml-schema
homeassistant homeassistant-yaml js-yaml js-yaml-schema schema yaml
Last synced: 3 months ago
JSON representation
A schema allowing js-yaml to process YAML documents including Home Assistent specific local tags.
- Host: GitHub
- URL: https://github.com/pascalre/homeassistant-js-yaml-schema
- Owner: pascalre
- License: mit
- Created: 2022-03-16T22:09:47.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-04-07T14:40:26.000Z (9 months ago)
- Last Synced: 2024-04-25T01:21:23.895Z (9 months ago)
- Topics: homeassistant, homeassistant-yaml, js-yaml, js-yaml-schema, schema, yaml
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/homeassistant-js-yaml-schema
- Size: 286 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# homeassistant-js-yaml-schema
[![Coverage Status](https://coveralls.io/repos/github/pascalre/homeassistant-js-yaml-schema/badge.svg?branch=master)](https://coveralls.io/github/pascalre/homeassistant-js-yaml-schema?branch=master)
Schema to allow js-yaml to process YAML formatted Home Assistent templates that use Home Assistent specific [local tags](https://www.home-assistant.io/docs/configuration/splitting_configuration/) while parsing or dumping, for example: `!env_var`, `!include_dir_named`.
See [tags.json](https://github.com/pascalre/homeassistant-js-yaml-schema/blob/master/src/tags.json) for currently supported local tags.
# Usage
```typescript
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](https://github.com/pascalre/vscode-yaml-sort).
# License
homeassistant-js-yaml-schema is licensed under the [MIT License](https://raw.githubusercontent.com/pascalre/homeassistant-js-yaml-schema/master/LICENSE).