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

Function validate_drop_graph_statement

graphlite/src/ast/validator.rs:2742–2780  ·  view source on GitHub ↗

Validate DROP GRAPH statement

(
    drop_graph: &DropGraphStatement,
    errors: &mut Vec<ValidationError>,
)

Source from the content-addressed store, hash-verified

2740
2741/// Validate DROP GRAPH statement
2742fn validate_drop_graph_statement(
2743 drop_graph: &DropGraphStatement,
2744 errors: &mut Vec<ValidationError>,
2745) {
2746 // Validate graph name is not empty
2747 if drop_graph.graph_path.segments.is_empty()
2748 || drop_graph
2749 .graph_path
2750 .segments
2751 .iter()
2752 .any(|s| s.trim().is_empty())
2753 {
2754 errors.push(ValidationError {
2755 message: "Invalid graph name".to_string(),
2756 location: Some(drop_graph.location.clone()),
2757 error_type: ValidationErrorType::Syntax,
2758 });
2759 return;
2760 }
2761
2762 // Validate path structure
2763 match drop_graph.graph_path.segments.len() {
2764 1 => {
2765 // Single segment: warn that this requires session schema
2766 // This is informational since executor will handle the actual validation
2767 // with proper session context
2768 }
2769 2 => {
2770 // Full path: schema/graph - valid
2771 }
2772 _ => {
2773 errors.push(ValidationError {
2774 message: "Invalid graph path: must be either 'graph_name' (when schema is set) or '/schema_name/graph_name'".to_string(),
2775 location: Some(drop_graph.location.clone()),
2776 error_type: ValidationErrorType::Syntax,
2777 });
2778 }
2779 }
2780}

Callers 1

Calls 4

cloneMethod · 0.80
is_emptyMethod · 0.45
iterMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected