MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / validate_partial_node

Method validate_partial_node

graphlite/src/schema/validator.rs:130–161  ·  view source on GitHub ↗

ROADMAP v0.4.0 - Partial node validation for UPDATE/SET operations with graph type enforcement

(
        &self,
        graph_type: &GraphTypeDefinition,
        label: &str,
        properties: &HashMap<String, Value>,
    )

Source from the content-addressed store, hash-verified

128 /// Validate partial node update (only validates provided properties)
129 #[allow(dead_code)] // ROADMAP v0.4.0 - Partial node validation for UPDATE/SET operations with graph type enforcement
130 pub fn validate_partial_node(
131 &self,
132 graph_type: &GraphTypeDefinition,
133 label: &str,
134 properties: &HashMap<String, Value>,
135 ) -> Result<(), ValidationError> {
136 // Find node type definition
137 let node_type = graph_type
138 .node_types
139 .iter()
140 .find(|nt| nt.label == label)
141 .ok_or_else(|| ValidationError::UnknownLabel(label.to_string()))?;
142
143 // Only validate the properties that are being updated
144 for (prop_name, prop_value) in properties {
145 if let Some(prop_def) = node_type.properties.iter().find(|p| p.name == *prop_name) {
146 self.validate_property_type(prop_value, &prop_def.data_type)?;
147
148 // Validate individual property constraints
149 for constraint in &prop_def.constraints {
150 self.validate_property_constraint(prop_value, constraint)?;
151 }
152 } else if !self.allow_unknown_properties {
153 return Err(ValidationError::UnknownProperty {
154 label: label.to_string(),
155 property: prop_name.clone(),
156 });
157 }
158 }
159
160 Ok(())
161 }
162
163 /// Validate that an edge matches the graph type schema
164 #[allow(dead_code)] // ROADMAP v0.4.0 - Edge validation for graph type DDL enforcement (endpoint constraints, edge properties)

Callers 1

validate_updateMethod · 0.80

Calls 4

cloneMethod · 0.80
iterMethod · 0.45

Tested by

no test coverage detected