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)
| 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 | /// |
no test coverage detected