Skip to main content

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.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hestia-earth-schema-validation 39.1.0
File Size Uploaded
hestia_earth_schema_validation-39.1.0.tar.gz 71.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hestia-earth-schema-validation 39.1.0
File Interpreter ABI Platform
hestia_earth_schema_validation-39.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 190.4 kB

Release files / hestia_earth_schema_validation-39.1.0.tar.gz

Download URL hestia_earth_schema_validation-39.1.0.tar.gz
Size 71.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1e237a0131eb593245bedd720b94a532bf03327f21802b8cae873238ac02f4fb
BLAKE2b-256 checksum
How to use checksums
b74bf98b67fc0fa73f6d3c4a04276b4ee7a893530ecfa978b1f35c141031b810
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / hestia_earth_schema_validation-39.1.0-py3-none-any.whl

Download URL hestia_earth_schema_validation-39.1.0-py3-none-any.whl
Size 118.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e4c7395c7bf5d20ae1ff512a4afcaf05120047ba148e8c1ad0fde5c8fffa1a47
BLAKE2b-256 checksum
How to use checksums
ccb6cdd37deb7ae0a4923fa378c26e28c2d2d1404a72da1ac9ebded10df8c998
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release history Release notifications | RSS feed

This release

39.1.0 This release

2 release files

39.0.2

2 release files

39.0.1

2 release files

39.0.0

2 release files

38.3.1

2 release files

38.3.0

2 release files

38.2.0

2 release files

38.1.0

2 release files

38.0.0

2 release files

37.0.0

2 release files

36.2.4

2 release files

36.2.3

2 release files

36.2.2

2 release files

36.2.1

2 release files

36.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page