vein.validation package¶

Submodules¶

vein.validation.policies module¶

class vein.validation.policies.LengthValidator(length: int, validate_immediately: bool = True)[source]¶

Bases: IFlowValidator

error_message() str[source]¶

Return the error message if validation fails.

validate(value: Any) bool[source]¶

Validate the given value.

class vein.validation.policies.PydanticValidator(model: BaseModel, validate_immediately: bool = True, transform: bool = False)[source]¶

Bases: IFlowValidator

error_message() str[source]¶

Return the error message if validation fails.

validate(value: Any) bool[source]¶

Validate the given value.

class vein.validation.policies.RangeValidator(min_value: int, max_value: int, validate_immediately: bool = True)[source]¶

Bases: IFlowValidator

error_message() str[source]¶

Return the error message if validation fails.

validate(value: Any) bool[source]¶

Validate the given value.

class vein.validation.policies.RegexValidator(pattern: str, validate_immediately: bool = True)[source]¶

Bases: IFlowValidator

error_message() str[source]¶

Return the error message if validation fails.

validate(value: Any) bool[source]¶

Validate the given value.

class vein.validation.policies.TypeValidator(expected_type: type, validate_immediately: bool = True)[source]¶

Bases: IFlowValidator

error_message() str[source]¶

Return the error message if validation fails.

validate(value: Any) bool[source]¶

Validate the given value.

class vein.validation.policies.URLValidator(validate_immediately: bool = True)[source]¶

Bases: RegexValidator

error_message() str[source]¶

Return the error message if validation fails.

vein.validation.validatable module¶

class vein.validation.validatable.ValidatableMixin[source]¶

Bases: ABC

add_validator(validator: IFlowValidator) ValidatableMixin[source]¶
get_validators()[source]¶

Get the validators for the current validatable item.

validate(force_live: bool = False)[source]¶

Validate the current flow item and its children.

This method performs validation on the current flow item and its children. If the item is an instance of LiveFlowItem, it uses an MD5 hash to track the state of the item’s value. Validation is only performed if the state has changed or if the force_live parameter is set to True.

Parameters: force_live (bool): If True, forces validation for LiveFlowItem instances

regardless of whether the state has changed. This is useful when a new validator is added and immediate validation is required.

Raises: FlowItemValidationError: If any of the validators fail.

abstract property value: Any¶
vein.validation.validatable.md5_hash_state(input_obj: Any) str[source]¶

Hash LiveFlow object’s state

Module contents¶

class vein.validation.IFlowValidator(validate_immediately: bool = True)[source]¶

Bases: ABC

abstractmethod error_message() str[source]¶

Return the error message if validation fails.

abstractmethod validate(value: Any) bool[source]¶

Validate the given value.