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

Function validate_edge

graphlite/src/ast/validator.rs:2511–2536  ·  view source on GitHub ↗

Validate edge

(edge: &Edge, ctx: &mut ValidationContext, errors: &mut Vec<ValidationError>)

Source from the content-addressed store, hash-verified

2509
2510/// Validate edge
2511fn 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
2539fn validate_subquery(

Callers 1

validate_path_patternFunction · 0.85

Calls 4

validate_expressionFunction · 0.85
cloneMethod · 0.80
insertMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected