Validate edge
(edge: &Edge, ctx: &mut ValidationContext, errors: &mut Vec<ValidationError>)
| 2509 | |
| 2510 | /// Validate edge |
| 2511 | fn validate_edge(edge: &Edge, ctx: &mut ValidationContext, errors: &mut Vec<ValidationError>) { |
| 2512 | // Declare variable if edge has an identifier |
| 2513 | if let Some(ref identifier) = edge.identifier { |
| 2514 | ctx.declared_variables.insert(identifier.clone()); |
| 2515 | ctx.variable_types |
| 2516 | .insert(identifier.clone(), GqlType::String { max_length: None }); // Edge as generic type |
| 2517 | } |
| 2518 | |
| 2519 | // Validate labels |
| 2520 | for label in &edge.labels { |
| 2521 | if label.is_empty() { |
| 2522 | errors.push(ValidationError { |
| 2523 | message: "Edge label cannot be empty".to_string(), |
| 2524 | location: Some(edge.location.clone()), |
| 2525 | error_type: ValidationErrorType::Syntax, |
| 2526 | }); |
| 2527 | } |
| 2528 | } |
| 2529 | |
| 2530 | // Validate properties if present |
| 2531 | if let Some(properties) = &edge.properties { |
| 2532 | for property in &properties.properties { |
| 2533 | validate_expression(&property.value, ctx, errors); |
| 2534 | } |
| 2535 | } |
| 2536 | } |
| 2537 | |
| 2538 | /// Validate a subquery recursively |
| 2539 | fn validate_subquery( |
no test coverage detected