ChainValidator
This class manages a sequence of validation steps by storing a collection of combined validators and an associated name. It provides a structured way to execute multiple validation logic components in a specific order.
Attributes
| Attribute | Type | Description |
|---|---|---|
| steps | Vec< Arc< CombinedValidator > > | An ordered collection of validator instances that are executed sequentially to validate the input data. |
| name | String | A unique identifier for the validation chain used for logging and error reporting purposes. |
Constructor
Signature
def ChainValidator(
steps: Vec< Arc< CombinedValidator > >,
name: String
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| steps | Vec< Arc< CombinedValidator > > | A vector of atomic reference-counted combined validators representing the sequence of validation steps. |
| name | String | The name identifier for the chain validator. |
Signature
@staticmethod
def new(
name: string
) - > [ChainValidator](chainvalidator.md?sid=validators_chain_chainvalidator)
Parameters
| Name | Type | Description |
|---|---|---|
| name | string | The unique identifier or label for this validation chain, used for logging and error reporting. |
Methods
add_step()
def add_step(
step: Arc< CombinedValidator >
) - > null
Appends a validation step to the end of the chain to be executed in sequence.
Parameters
| Name | Type | Description |
|---|---|---|
| step | Arc< CombinedValidator > | An atomic reference-counted pointer to a validator implementation to be included in the execution sequence. |
Returns
| Type | Description |
|---|---|
null | Nothing is returned; the internal state of the validator is updated. |