Skip to main content

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

AttributeTypeDescription
stepsVec< Arc< CombinedValidator > >An ordered collection of validator instances that are executed sequentially to validate the input data.
nameStringA 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

NameTypeDescription
stepsVec< Arc< CombinedValidator > >A vector of atomic reference-counted combined validators representing the sequence of validation steps.
nameStringThe name identifier for the chain validator.

Signature

@staticmethod
def new(
name: string
) - > [ChainValidator](chainvalidator.md?sid=validators_chain_chainvalidator)

Parameters

NameTypeDescription
namestringThe 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

NameTypeDescription
stepArc< CombinedValidator >An atomic reference-counted pointer to a validator implementation to be included in the execution sequence.

Returns

TypeDescription
nullNothing is returned; the internal state of the validator is updated.