Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/comonadd/yml-validate

YML Validator
https://github.com/comonadd/yml-validate

Last synced: 16 days ago
JSON representation

YML Validator

Awesome Lists containing this project

README

        

yml-validate
============

This package implements a configurable YAML validation function.
You can see the usage examples in the tests directory.

Example:

```
const C = {
children: {
foo: { type: VT.STRLIT_ONE_OF, values: ["bar"] },
something: {
allowListValues: true,
},
wow: {
type: VT.BLOCK,
children: {
well: { type: VT.STRLIT_ONE_OF, values: ["five"] }
},
},
},
};
const yaml = `
foo: bar
something:
- Hello
- 123
- Times
- Three
wow:
well: five
`;
// this gives an empty array, signaling that there is no validation errors
// in the provided YAML input
const validateYaml(C, yaml);
// or
const validateMyYaml = validateWith(C);
validateMyYaml(yaml);
```