HESTIA Schema Validation library
Project description
HESTIA Schema Validation
Module to validate data using the HESTIA Schema and Ajv.
Install
npm install @hestia-earth/schema @hestia-earth/schema-validation
Example validating JSON
const { SchemaType } = require('@hestia-earth/schema');
const { validator } = require('@hestia-earth/schema-validation/validate');
// Set to `true` to validate existing Nodes (@type/@id) or `false` for Nodes to upload (type/id)
const strictMode = false;
// Initialise the validation function, do this only once
const schemaValidation = validator(undefined, strictMode);
const node = {
type: SchemaType.Cycle,
id: 'my first cycle'
};
(async () => {
const { success, errors } = await schemaValidation(node);
console.log(success);
// list of errors in Ajv formatting. See https://github.com/ajv-validator/ajv/tree/v6.12.6#validation-errors
console.log(errors);
})();
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hestia_earth_schema_validation-36.1.1.tar.gz.
File metadata
- Download URL: hestia_earth_schema_validation-36.1.1.tar.gz
- Upload date:
- Size: 68.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83ed89d4d9a1c8f1c4abca0e2c2f798a3c35d95987822449983555eae3d9f22c
|
|
| MD5 |
c005f84a4113c8756f692979e10c2e98
|
|
| BLAKE2b-256 |
4683f3e3936dda273feb0eeaacdd43fe94e924b69568e35ea639c238727686d6
|
File details
Details for the file hestia_earth_schema_validation-36.1.1-py3-none-any.whl.
File metadata
- Download URL: hestia_earth_schema_validation-36.1.1-py3-none-any.whl
- Upload date:
- Size: 115.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7dce9250fc9fc9af0c7ac3b92f85dde2373700f649bda0ac3154e6cb9f4ee597
|
|
| MD5 |
060b9b132552d440950fa2cab22639c6
|
|
| BLAKE2b-256 |
e2e59c3e43e0cd4ace63a8104b6c01fe8faf173c818b0a1ac85b506c4aea0365
|