pcvs.helpers.validation module

class pcvs.helpers.validation.ValidationScheme(schema_name)[source]

Bases: object

Object manipulating schemes (yaml) to enforce data formats.

A validationScheme is instancied according to a ‘model’ (the format to validate). This instance can be used multiple times to check multiple streams belonging to the same model.

Create a new ValidationScheme instance based on a given model.

During initialisation the file scheme is loaded from disk.

Parameters:

schema_name (str) – Name of the schema that will be loaded for validation.

Raises:

ValidationException.InvalidSchemeError – file is not found OR unable to load the YAML scheme file.

# noqa: DAR401 # noqa: DAR402

avail_list: list[str] = []
classmethod available_schemes()[source]

Return list of currently supported formats to be validated.

The list is extracted from INSTALL/schemes/generated/<model>-scheme.yml :rtype: list :return: List of available schemes.

validate(content, filepath)[source]

Validate a given datastructure (dict) agasint the loaded scheme.

Parameters:
  • content (dict) – json to validate

  • filepath (str) – the path of the file content come from

Raises:
Return type:

None

# noqa: DAR401 # noqa: DAR402