data-ok
Convenience method to wrap json-schema validation into a single function.
The single API method exported: isValid(schema, data)
, does three things:
- Dereference the schema to resolve all external references
- Validate the resulting fullSchema
- Validate the data against the fullSchema.
Usage
API
/** * Provides a convenience interface to validate a data object * against a dereferenced schema object. * * Throws a SchemaError if either the schema or data is not valid. * SchemaError provides an `errors` property, detailing individual * violations. * * @async * @param schema schema to validate data against * @param data data to validate * @returns Promise<boolean> */declare ;
CLI
Usage: data-ok [options] Options: -V, --version output the version number -d, --data <data> data to validate {json, yaml} -s, --schema <schema> schema to use
Development Tooling
License
Code of Conduct
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
Support
Bugs, PRs, comments, suggestions welcomed!