Validate CREATE GRAPH statement
(
create_graph: &CreateGraphStatement,
errors: &mut Vec<ValidationError>,
)
| 2699 | |
| 2700 | /// Validate CREATE GRAPH statement |
| 2701 | fn validate_create_graph_statement( |
| 2702 | create_graph: &CreateGraphStatement, |
| 2703 | errors: &mut Vec<ValidationError>, |
| 2704 | ) { |
| 2705 | // Validate graph name is not empty |
| 2706 | if create_graph.graph_path.segments.is_empty() |
| 2707 | || create_graph |
| 2708 | .graph_path |
| 2709 | .segments |
| 2710 | .iter() |
| 2711 | .any(|s| s.trim().is_empty()) |
| 2712 | { |
| 2713 | errors.push(ValidationError { |
| 2714 | message: "Invalid graph name".to_string(), |
| 2715 | location: Some(create_graph.location.clone()), |
| 2716 | error_type: ValidationErrorType::Syntax, |
| 2717 | }); |
| 2718 | return; |
| 2719 | } |
| 2720 | |
| 2721 | // Validate path structure |
| 2722 | match create_graph.graph_path.segments.len() { |
| 2723 | 1 => { |
| 2724 | // Single segment: warn that this requires session schema |
| 2725 | // This is informational since executor will handle the actual validation |
| 2726 | // with proper session context |
| 2727 | } |
| 2728 | 2 => { |
| 2729 | // Full path: schema/graph - valid |
| 2730 | } |
| 2731 | _ => { |
| 2732 | errors.push(ValidationError { |
| 2733 | message: "Invalid graph path: must be either 'graph_name' (when schema is set) or '/schema_name/graph_name'".to_string(), |
| 2734 | location: Some(create_graph.location.clone()), |
| 2735 | error_type: ValidationErrorType::Syntax, |
| 2736 | }); |
| 2737 | } |
| 2738 | } |
| 2739 | } |
| 2740 | |
| 2741 | /// Validate DROP GRAPH statement |
| 2742 | fn validate_drop_graph_statement( |
no test coverage detected