Skip to main content

validate_variable_uses

Function validate_variable_uses 

Source
pub fn validate_variable_uses(
    operation_name: Option<&str>,
    defined: &[String],
    referenced: &[String],
) -> Result<()>
Expand description

Check that every variable referenced by the operation is defined by it.

operation_name is the executed operation’s name, used verbatim in the error the way a client reads its own document; an anonymous operation drops the clause rather than inventing a name.

§Errors

Returns FraiseQLError::Validation naming the first undefined variable in document order, with a “did you mean” hint when a close defined name exists — a variable typo is precisely the case this rule catches, and it is one edit away from the name that works.