Validate DROP GRAPH statement
(
drop_graph: &DropGraphStatement,
errors: &mut Vec<ValidationError>,
)
| 2740 | |
| 2741 | /// Validate DROP GRAPH statement |
| 2742 | fn 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 | } |
no test coverage detected