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);
})();

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hestia_earth_schema_validation-39.0.1.tar.gz (71.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hestia_earth_schema_validation-39.0.1-py3-none-any.whl (118.3 kB view details)

Uploaded Python 3

File details

Details for the file hestia_earth_schema_validation-39.0.1.tar.gz.

File metadata

File hashes

Hashes for hestia_earth_schema_validation-39.0.1.tar.gz
Algorithm Hash digest
SHA256 04c2922a15660718e8847a8cfbeb38cc088635e22a1500e2e1c906406abaa34b
MD5 30d04920de4e5f26234e4bb3fd225fdd
BLAKE2b-256 25c6fc3ead58c912309008773218d089763e5e58a13e3694d8f446ea0c76b5e6

See more details on using hashes here.

File details

Details for the file hestia_earth_schema_validation-39.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for hestia_earth_schema_validation-39.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7dbcd33bee8ff52d3dc74bb9899ea0187aae9cee67caa2d633c4c19dea10c045
MD5 567fcd7d091d88a1fb2e84c0c4252d64
BLAKE2b-256 d0c99811b2334603ca41cb153d8ae7ab1b82b14108d52db810c196323d383d58

See more details on using hashes here.

Release history Release notifications | RSS feed

39.0.2

2 files

This release

39.0.1 This release

2 files

39.0.0

2 files

38.3.1

2 files

38.3.0

2 files

38.2.0

2 files

38.1.0

2 files

38.0.0

2 files

37.3.1

2 files

37.3.0

2 files

37.2.3

2 files

37.2.2

2 files

37.2.1

2 files

37.2.0

2 files

37.1.0

2 files

37.0.0

2 files

36.2.4

2 files

36.2.3

2 files

36.2.2

2 files

36.2.1

2 files

36.1.1

2 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