eyconf.validation

Validating configuration data against schemas.

Functions

allow_none_in_schema(schema)

Recursively modifies a JSON schema to allow null values for all fields.

validate(data, schema)

Validate the provided data against the given schema.

Exceptions

ConfigurationError([message, section])

Exception raised for configuration validation errors.

MultiConfigurationError(errors)

Exception raised for multiple configuration validation errors.

Module Functions

eyconf.validation.allow_none_in_schema(schema: dict | list) dict

Recursively modifies a JSON schema to allow null values for all fields.

eyconf.validation.validate(data: dict, schema: dict) None

Validate the provided data against the given schema.

This function uses the Draft202012Validator to check if the data conforms to the specified schema. If there are any validation errors, it raises a ConfigurationError containing the details of the errors.

Parameters:
  • (dict) (schema) – The data to be validated.

  • (dict) – The JSON schema to validate against.

Raises:

ConfigurationError – If the data does not comply with the schema,: this error is raised with details of the violations.

Module Exceptions

exception eyconf.validation.ConfigurationError(message='Configuration error', section=None)

Exception raised for configuration validation errors.

exception eyconf.validation.MultiConfigurationError(errors: list[ConfigurationError])

Exception raised for multiple configuration validation errors.