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

Function validate_node

graphlite/src/ast/validator.rs:2483–2508  ·  view source on GitHub ↗

Validate node

(node: &Node, ctx: &mut ValidationContext, errors: &mut Vec<ValidationError>)

Source from the content-addressed store, hash-verified

2481
2482/// Validate node
2483fn validate_node(node: &Node, ctx: &mut ValidationContext, errors: &mut Vec<ValidationError>) {
2484 // Declare variable if node has an identifier
2485 if let Some(ref identifier) = node.identifier {
2486 ctx.declared_variables.insert(identifier.clone());
2487 ctx.variable_types
2488 .insert(identifier.clone(), GqlType::String { max_length: None }); // Node as generic type
2489 }
2490
2491 // Validate labels
2492 for label in &node.labels {
2493 if label.is_empty() {
2494 errors.push(ValidationError {
2495 message: "Node label cannot be empty".to_string(),
2496 location: Some(node.location.clone()),
2497 error_type: ValidationErrorType::Syntax,
2498 });
2499 }
2500 }
2501
2502 // Validate properties if present
2503 if let Some(properties) = &node.properties {
2504 for property in &properties.properties {
2505 validate_expression(&property.value, ctx, errors);
2506 }
2507 }
2508}
2509
2510/// Validate edge
2511fn validate_edge(edge: &Edge, ctx: &mut ValidationContext, errors: &mut Vec<ValidationError>) {

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