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

Method validate_index_schema

graphlite/src/schema/validator.rs:217–243  ·  view source on GitHub ↗

ROADMAP v0.4.0 - Index schema validation for CREATE INDEX on graph type properties

(
        &self,
        graph_name: &str,
        label: &str,
        properties: &[String],
    )

Source from the content-addressed store, hash-verified

215 /// Validate that an index references valid schema elements
216 #[allow(dead_code)] // ROADMAP v0.4.0 - Index schema validation for CREATE INDEX on graph type properties
217 pub fn validate_index_schema(
218 &self,
219 graph_name: &str,
220 label: &str,
221 properties: &[String],
222 ) -> Result<(), ValidationError> {
223 let graph_type = self.get_graph_type_for_graph(graph_name)?;
224
225 // Check label exists
226 let node_type = graph_type
227 .node_types
228 .iter()
229 .find(|nt| nt.label == label)
230 .ok_or_else(|| ValidationError::UnknownLabel(label.to_string()))?;
231
232 // Check properties exist
233 for property in properties {
234 if !node_type.properties.iter().any(|p| p.name == *property) {
235 return Err(ValidationError::UnknownProperty {
236 label: label.to_string(),
237 property: property.clone(),
238 });
239 }
240 }
241
242 Ok(())
243 }
244
245 /// Get the graph type definition for a graph
246 #[allow(dead_code)] // ROADMAP v0.4.0 - Helper to resolve graph type from graph name for validation

Callers

nothing calls this directly

Calls 3

cloneMethod · 0.80
iterMethod · 0.45

Tested by

no test coverage detected