buildtest.schemas.defaults

Module Contents

Functions

custom_validator(recipe, schema)

Validate a JSON document against a given schema using a custom validator.

Attributes

here

schema_table

schema_store

registry

buildtest.schemas.defaults.here
buildtest.schemas.defaults.schema_table
buildtest.schemas.defaults.schema_store
buildtest.schemas.defaults.registry
buildtest.schemas.defaults.custom_validator(recipe, schema)[source]

Validate a JSON document against a given schema using a custom validator.

This function utilizes Registry from the referencing <https://python-jsonschema.readthedocs.io/en/latest/referencing/> library to handle schema references locally and validate buildspecs with schema files on the local filesystem, ensuring that schema changes are synchronized with the code base updates.

This method uses Draft7Validator for validating schemas. If there is an error during validation jsonschema will raise an exception of type jsonschema.exceptions.ValidationError

Parameters:
  • recipe (dict) – Loaded test recipe as YAML document

  • schema (dict) – Schema document loaded in JSON format

Raises:

jsonschema.exceptions.ValidationError – if recipe fails to validate with schema