Pipeline validator
File validation pipeline for processing files against multiple validation rules.
PipelineValidator()
A pipeline for validating files against multiple validation rules.
This class provides a flexible way to validate files by chaining multiple BaseValidator
instances. Each validator is applied sequentially, and validation behavior depends on
the stop_on_failure setting of each validator.
Attributes:
| Name | Type | Description |
|---|---|---|
validators |
list[BaseValidator]
|
A list of |
Initialize the PipelineValidator object.
add_validator(validator)
Add a validator to the validation pipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
validator |
BaseValidator
|
The validator to add to the pipeline. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
PipelineValidator |
PipelineValidator
|
The validation pipeline object for method chaining. |
validate(file_validation_input)
Validate the file against all configured validation rules.
Validation stops early if a validator fails and its stop_on_failure
setting is True; in that case, the returned list will only include results
up to and including the failing validator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_validation_input |
ValidatorInput
|
The file validation input object to validate. |
required |
Returns:
| Type | Description |
|---|---|
list[ValidatorResult]
|
list[ValidatorResult]: A list of ValidatorResult objects for each validator run,
which may be truncated if a validator with |