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

Function validate_procedure_query

graphlite/src/ast/validator.rs:2624–2656  ·  view source on GitHub ↗

Validate a query within a procedure body - doesn't require RETURN clause

(
    query: &Query,
    ctx: &ValidationContext,
    errors: &mut Vec<ValidationError>,
)

Source from the content-addressed store, hash-verified

2622
2623/// Validate a query within a procedure body - doesn't require RETURN clause
2624fn validate_procedure_query(
2625 query: &Query,
2626 ctx: &ValidationContext,
2627 errors: &mut Vec<ValidationError>,
2628) {
2629 match query {
2630 Query::Basic(basic_query) => {
2631 // Validate structure but don't require RETURN clause
2632 if basic_query.match_clause.patterns.is_empty() {
2633 errors.push(ValidationError {
2634 message: "Query must have at least one path pattern in MATCH clause"
2635 .to_string(),
2636 location: None,
2637 error_type: ValidationErrorType::Structural,
2638 });
2639 }
2640 // Note: We don't check for RETURN clause requirement here
2641
2642 // Validate other aspects using a temporary context
2643 let mut temp_ctx = ctx.clone();
2644
2645 // Validate variable declarations and patterns
2646 validate_basic_query_variables(basic_query, &mut temp_ctx, errors);
2647 validate_basic_query_path_patterns(basic_query, &mut temp_ctx, errors);
2648 validate_basic_query_expressions(basic_query, &mut temp_ctx, errors);
2649 }
2650 _ => {
2651 // For other query types, use standard validation for now
2652 // This is a simplified implementation - in production you'd want full validation
2653 // without RETURN clause requirements
2654 }
2655 }
2656}
2657
2658/// Validate CREATE SCHEMA statement
2659fn validate_create_schema_statement(

Callers 1

Calls 5

cloneMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected