Base validator
Base validator for file validation.
BaseValidator(stop_on_failure=False, applicable_extensions=None)
Bases: ABC
Abstract base class for file validators.
This class defines the interface that all file validators must implement. Each validator should validate a specific aspect of a file and return a ValidatorResult indicating success/failure and an appropriate message.
Initialize the BaseValidator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stop_on_failure |
bool
|
Whether to terminate the validation process if this validator fails. Default is False. |
False
|
applicable_extensions |
list[str] | None
|
The list of file extensions that this validator is applicable to. Default is None which means all extensions are applicable. |
None
|
validate(file_validation_input)
Validate the file against the validator's criteria.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_validation_input |
ValidatorInput
|
The ValidatorInput object to validate. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ValidatorResult |
ValidatorResult
|
A ValidatorResult object indicating success or failure with an appropriate message. |