solidipes.validators.validator module
- class solidipes.validators.validator.ValidationResult(validator: Validator, valid: bool, errors: list[str])[source]
Bases:
objectResult of a validation, evaluable as a boolean, and containing the list of errors and warnings.
- errors
List of errors and warnings
- class solidipes.validators.validator.Validator(description: str, mandatory: bool = True, manually_settable: bool = False)[source]
Bases:
ABC,Generic[T]Abstract class for validators.
- _abc_impl = <_abc._abc_data object>
- abstractmethod _validate(obj: T | None = None) bool | Any[source]
Validate an object and optionally return a boolean. Can raise exceptions.
- has_validation_errors() bool[source]
Check if there are validation errors in the current validation context.
- property name
- validate(obj: T | None = None) ValidationResult[source]
Validate an object and return a ValidationResult, also catching exceptions.
- solidipes.validators.validator.validator(description: str, mandatory: bool = True, manually_settable=False) Callable[source]
Decorator to add a Validator class attribute to another class.
The decorated method should return None or a list of strings with the errors. The method can also raise exceptions.