1.0.0 • Published 7 years ago
metabin-schema-validator v1.0.0
Metabin Schema Validator
Metabin schemas validation tool
Installation
npm install metabin-schema-validator
Usage
import schemaValidator from 'metabin-schema-validator'
const schema = {
"title": "string",
"genres": [],
"author": {
"name": "string",
"age": "number"
},
"band": "$schema_hash",
"tracks": [ "$schema_hash", "number" ],
"text": [[ "e", "n", "u", "m" ]]
}
const report = schemaValidator(schema)
console.log(report)
/*
{
title: 'STRING',
genres: '!Empty array of types.',
author: { name: 'STRING', age: 'NUMBER' },
band: 'SCHEMA_LINK',
tracks: [ 'SCHEMA_LINK', 'NUMBER' ],
text: 'ENUM'
}
*/