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>;
// Provided methods
fn validate_node_labels_allowed(
&self,
labels: &[String],
) -> Result<(), OperatorError> { ... }
fn validate_edge_type_allowed(
&self,
edge_type: &str,
) -> Result<(), OperatorError> { ... }
fn validate_edge_endpoints(
&self,
edge_type: &str,
source_labels: &[String],
target_labels: &[String],
) -> Result<(), OperatorError> { ... }
fn inject_defaults(
&self,
labels: &[String],
properties: &mut Vec<(String, Value)>,
) { ... }
}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§
Sourcefn validate_node_property(
&self,
labels: &[String],
key: &str,
value: &Value,
) -> Result<(), OperatorError>
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.
Sourcefn validate_node_complete(
&self,
labels: &[String],
properties: &[(String, Value)],
) -> Result<(), OperatorError>
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.
Sourcefn check_unique_node_property(
&self,
labels: &[String],
key: &str,
value: &Value,
) -> Result<(), OperatorError>
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.
Sourcefn validate_edge_property(
&self,
edge_type: &str,
key: &str,
value: &Value,
) -> Result<(), OperatorError>
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.
Sourcefn validate_edge_complete(
&self,
edge_type: &str,
properties: &[(String, Value)],
) -> Result<(), OperatorError>
fn validate_edge_complete( &self, edge_type: &str, properties: &[(String, Value)], ) -> Result<(), OperatorError>
Validates that all required properties are present after creating an edge.
Provided Methods§
Sourcefn validate_node_labels_allowed(
&self,
labels: &[String],
) -> Result<(), OperatorError>
fn validate_node_labels_allowed( &self, labels: &[String], ) -> Result<(), OperatorError>
Validates that the node labels are allowed by the bound graph type.
Sourcefn validate_edge_type_allowed(
&self,
edge_type: &str,
) -> Result<(), OperatorError>
fn validate_edge_type_allowed( &self, edge_type: &str, ) -> Result<(), OperatorError>
Validates that the edge type is allowed by the bound graph type.
Sourcefn validate_edge_endpoints(
&self,
edge_type: &str,
source_labels: &[String],
target_labels: &[String],
) -> Result<(), OperatorError>
fn validate_edge_endpoints( &self, edge_type: &str, source_labels: &[String], target_labels: &[String], ) -> Result<(), OperatorError>
Validates that edge endpoints have the correct node type labels.