deev.validation#

final exception ValidationError(field_name, reason)#

Bases: Exception

Exception raised when a value fails validation for a specific field.

validate(entity, attrs=None)#

Runs validations for the target entity.

Parameters:
  • entity (object) – The entity to validate.

  • attrs (Optional[list[str]]) – A list of attributes to be validated, otherwise validates all.

Return type:

list[ValidationError] | None

Returns:

A list containing validation errors, or None if no validation errors.