Skip to main content

ConstraintValidator

Trait ConstraintValidator 

Source
pub trait ConstraintValidator: Send + Sync {
    // Required methods
    fn validate_node_property(
        &self,
        labels: &[String],
        key: &str,
        value: &Value,
    ) -> Result<(), OperatorError>;
    fn validate_node_complete(
        &self,
        labels: &[String],
        properties: &[(String, Value)],
    ) -> Result<(), OperatorError>;
    fn check_unique_node_property(
        &self,
        labels: &[String],
        key: &str,
        value: &Value,
    ) -> Result<(), OperatorError>;
    fn validate_edge_property(
        &self,
        edge_type: &str,
        key: &str,
        value: &Value,
    ) -> Result<(), OperatorError>;
    fn validate_edge_complete(
        &self,
        edge_type: &str,
        properties: &[(String, Value)],
    ) -> Result<(), OperatorError>;
}
Expand description

Trait for validating schema constraints during mutation operations.

Implementors check type definitions, NOT NULL, and UNIQUE constraints before data is written to the store.

Required Methods§

Source

fn validate_node_property( &self, labels: &[String], key: &str, value: &Value, ) -> Result<(), OperatorError>

Validates a single property value for a node with the given labels.

Checks type compatibility and NOT NULL constraints.

Source

fn validate_node_complete( &self, labels: &[String], properties: &[(String, Value)], ) -> Result<(), OperatorError>

Validates that all required properties are present after creating a node.

Checks NOT NULL constraints for properties that were not explicitly set.

Source

fn check_unique_node_property( &self, labels: &[String], key: &str, value: &Value, ) -> Result<(), OperatorError>

Checks UNIQUE constraint for a node property value.

Returns an error if a node with the same label already has this value.

Source

fn validate_edge_property( &self, edge_type: &str, key: &str, value: &Value, ) -> Result<(), OperatorError>

Validates a single property value for an edge of the given type.

Source

fn validate_edge_complete( &self, edge_type: &str, properties: &[(String, Value)], ) -> Result<(), OperatorError>

Validates that all required properties are present after creating an edge.

Implementors§