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);
})();
Metadata
Release files for hestia-earth-schema-validation 39.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hestia_earth_schema_validation-39.2.0.tar.gz | 72.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hestia_earth_schema_validation-39.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 192.0 kB
Release files / hestia_earth_schema_validation-39.2.0.tar.gz
| Download URL | hestia_earth_schema_validation-39.2.0.tar.gz |
|---|---|
| Size | 72.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f07398647312ecac0b1a4299c0d1deb316dbb0a39a01af57787ac55bfe49fc9e
|
|
BLAKE2b-256 checksum How to use checksums |
9f5a747ddd3a7df5b3912e76d1865b850365b9dabd6112893d8cd2f8a811acba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.15
|
Release files / hestia_earth_schema_validation-39.2.0-py3-none-any.whl
| Download URL | hestia_earth_schema_validation-39.2.0-py3-none-any.whl |
|---|---|
| Size | 119.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dcfc4d4d7fe36870e0509d72fe81f249ea81acc212fd385238e45789e0892ae5
|
|
BLAKE2b-256 checksum How to use checksums |
4038a50be93af2bd09ce2b2e8c7dbfe4e63a1bbc81acb29543c77462861205e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.15
|