Skip to main content

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


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-36.2.3.tar.gz (69.6 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-36.2.3-py3-none-any.whl (116.2 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for hestia_earth_schema_validation-36.2.3.tar.gz
Algorithm Hash digest
SHA256 9d39ea3143697ef2e033985fbe5444a02819bcfac75bd87b84c8817bce4e23dd
MD5 541428baa391b2ea1f6c71f1dc3a5d2f
BLAKE2b-256 f5f14aff4aff061268567ac6fd9d878bcc848e7eb7c67b54522867dfffac6eb8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hestia_earth_schema_validation-36.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 454bc3e2bcbd96b1379143d42ae5d929a026bae7b482639a324b36444b71f4e2
MD5 33028a499b1034883df39bff05d51bd5
BLAKE2b-256 a4082f65b70da451c61fa9f76a653291ae3f5e0bc4241fd99a1e9efc794c1fde

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page