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

Function validate_path_pattern

graphlite/src/ast/validator.rs:2457–2480  ·  view source on GitHub ↗

Validate path pattern

(
    pattern: &PathPattern,
    ctx: &mut ValidationContext,
    errors: &mut Vec<ValidationError>,
)

Source from the content-addressed store, hash-verified

2455
2456/// Validate path pattern
2457fn validate_path_pattern(
2458 pattern: &PathPattern,
2459 ctx: &mut ValidationContext,
2460 errors: &mut Vec<ValidationError>,
2461) {
2462 if pattern.elements.is_empty() {
2463 errors.push(ValidationError {
2464 message: "Path pattern must have at least one element".to_string(),
2465 location: Some(pattern.location.clone()),
2466 error_type: ValidationErrorType::Structural,
2467 });
2468 }
2469
2470 for element in &pattern.elements {
2471 match element {
2472 PatternElement::Node(node) => {
2473 validate_node(node, ctx, errors);
2474 }
2475 PatternElement::Edge(edge) => {
2476 validate_edge(edge, ctx, errors);
2477 }
2478 }
2479 }
2480}
2481
2482/// Validate node
2483fn validate_node(node: &Node, ctx: &mut ValidationContext, errors: &mut Vec<ValidationError>) {

Callers 2

validate_expressionFunction · 0.85
validate_match_clauseFunction · 0.85

Calls 4

validate_nodeFunction · 0.85
validate_edgeFunction · 0.85
cloneMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected