pub struct ValidationConfig {
pub rules: Vec<ValidationRule>,
}Expand description
Configuration for the validation function containing a list of rules.
Each rule specifies a JSONLogic condition that must evaluate to true
for the validation to pass. If a rule evaluates to anything other than
true, its error message is added to the message’s error list.
Fields§
§rules: Vec<ValidationRule>List of validation rules to evaluate.
Implementations§
Source§impl ValidationConfig
impl ValidationConfig
Sourcepub fn execute(
&self,
message: &mut Message,
datalogic: &Arc<DataLogic>,
logic_cache: &[Arc<CompiledLogic>],
) -> Result<(usize, Vec<Change>)>
pub fn execute( &self, message: &mut Message, datalogic: &Arc<DataLogic>, logic_cache: &[Arc<CompiledLogic>], ) -> Result<(usize, Vec<Change>)>
Executes all validation rules using pre-compiled logic.
Evaluates each rule sequentially against the message context. This is a read-only operation that does not modify message data.
§Arguments
message- The message to validate (errors are added to its error list)datalogic- DataLogic instance for evaluationlogic_cache- Pre-compiled logic expressions
§Returns
Ok((200, []))- All rules passed, no changes madeOk((400, []))- One or more rules failed, errors added to message
§Error Types
Validation errors are recorded with the following codes:
VALIDATION_ERROR- Rule evaluated to non-true valueEVALUATION_ERROR- Rule evaluation failed with an errorCOMPILATION_ERROR- Logic was not properly compiled
Trait Implementations§
Source§impl Clone for ValidationConfig
impl Clone for ValidationConfig
Source§fn clone(&self) -> ValidationConfig
fn clone(&self) -> ValidationConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ValidationConfig
impl Debug for ValidationConfig
Source§impl<'de> Deserialize<'de> for ValidationConfig
impl<'de> Deserialize<'de> for ValidationConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ValidationConfig
impl RefUnwindSafe for ValidationConfig
impl Send for ValidationConfig
impl Sync for ValidationConfig
impl Unpin for ValidationConfig
impl UnwindSafe for ValidationConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more