aiida_crystal17.validation package

Submodules

aiida_crystal17.validation.utils module

Utility functions for validating JSON objects against schemas.

aiida_crystal17.validation.utils.load_schema(name)[source]

Read and return a JSON schema.

If the name is an absolute path, it will be used as is, otherwise it will be loaded as resource from the internal json schema module.

Parameters

name (str) –

Returns

Return type

dict

aiida_crystal17.validation.utils.load_validator(schema)[source]

Create a validator for a schema.

Parameters

schema (str or dict) – schema or path to schema

Returns

the validator to use

Return type

jsonschema.IValidator

aiida_crystal17.validation.utils.validate_against_schema(data, schema)[source]

Validate json-type data against a schema.

Parameters
  • data (dict) –

  • schema (dict or str) – schema, name of schema resource, or absolute path to a schema

Raises
Returns

return True if validated

Return type

bool

Module contents

Package for validating JSON objects against schemas.