Skip to content

Instantly share code, notes, and snippets.

@niaeashes
Created March 12, 2021 11:19
Show Gist options
  • Save niaeashes/ddc001576ee288d8d7be9fbb46aa1c32 to your computer and use it in GitHub Desktop.
Save niaeashes/ddc001576ee288d8d7be9fbb46aa1c32 to your computer and use it in GitHub Desktop.
const validate = require('json-schema').validate;
const YAML = require('yaml');
const fs = require('fs').promises;
const main = async () => {
const doc = YAML.parse(await fs.readFile('./doc.yml', { encoding: 'utf-8' }));
const schema = YAML.parse(await fs.readFile('./schema.yml', { encoding: 'utf-8' }));
console.log({ doc, schema });
console.log(validate(doc, schema));
}
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment