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

Method validate_query

graphlite/src/coordinator/query_coordinator.rs:604–613  ·  view source on GitHub ↗

Validate query syntax without executing it This is useful for query builders, IDEs, or validating user input before attempting execution. # Arguments `query` - The GQL query string to validate # Returns `Ok(())` - Query is syntactically valid `Err(String)` - Error message describing the syntax error # Example ```no_run # use graphlite::QueryCoordinator; # let coordinator = QueryCoordinator::fr

(&self, query: &str)

Source from the content-addressed store, hash-verified

602 /// assert!(coordinator.validate_query("MATCH (n RETURN n").is_err());
603 /// ```
604 pub fn validate_query(&self, query: &str) -> Result<(), String> {
605 // Parse the query
606 let document = parse_query(query).map_err(|e| format!("Parse error: {:?}", e))?;
607
608 // Validate the parsed query (pass false for has_graph_context since we're just validating syntax)
609 crate::ast::validator::validate_query(&document, false)
610 .map_err(|e| format!("Validation error: {:?}", e))?;
611
612 Ok(())
613 }
614
615 /// Check if a query is syntactically valid
616 ///

Callers 2

is_valid_queryMethod · 0.80
mainFunction · 0.80

Calls 2

parse_queryFunction · 0.85
validate_queryFunction · 0.85

Tested by

no test coverage detected