Skip to main content

parse_selected_operation

Function parse_selected_operation 

Source
pub fn parse_selected_operation(
    operation: &OperationDefinition<'_, String>,
    doc: &Document<'_, String>,
    source: &str,
) -> Result<ParsedQuery, GraphQLParseError>
Expand description

Build a ParsedQuery from an operation the caller has already selected.

The seam for callers that do their own operation selection and must not have it silently redone. routes/subscriptions.rs is the motivating case: it filters for the single subscription operation and rejects documents with more than one, so routing it back through parse_query would validate the document’s first operation — which on a document mixing query Q {…} with subscription S {…} is the wrong one.

§Errors