pub enum SchemaIntrospectionSplit {
    None,
    Only(SchemaIntrospectionQuery),
    Both {
        introspection_query: SchemaIntrospectionQuery,
        filtered_document: Valid<ExecutableDocument>,
    },
}
Expand description

Result of splitting schema introspection fields from an operation.

Variants§

§

None

The selected operation does not use schema introspection fields. It should be executed unchanged.

§

Only(SchemaIntrospectionQuery)

The selected operation only uses schema introspection fields. This provides the execute’able introspection query, there is nothing else to execute.

§

Both

Fields

§introspection_query: SchemaIntrospectionQuery

The execute’able query for schema introspection parts of the original operation.

§filtered_document: Valid<ExecutableDocument>

The rest of the operation.

This document contains exactly one operation with schema introspection fields removed, and the fragment definitions that are still needed. The operation definition name is preserved, so either None or the original Option<&str> name request can be passed to ExecutableDocument::get_operation to obtain the one operation.

The selected operation uses both schema introspection fields and other fields. Each part should be executed, and their responses merged with Response::merge.

Implementations§

source§

impl SchemaIntrospectionSplit

source

pub fn split( schema: &Valid<Schema>, document: &Valid<ExecutableDocument>, operation: &Node<Operation> ) -> Result<Self, SchemaIntrospectionError>

Splits schema introspection fields from an operation.

Returns either a split result, or a request error that should stop any further execution and can be converted with into_response.

In the execution model described in the GrapQL specification, a single server executes an entire operation by traversing its selections and calling resolver functions for each individual field. In this model, schema introspection is just another set of fields with dedicated resolver functions.

In other models such as Apollo Federation there may not be an obvious place to “plug in” such resolvers. Instead, this function splits an operation into either or both introspection and other parts that can be executed separately. Full execution of introspection parts is provided by SchemaIntrospectionQuery::execute.

In an unconventional schema where the type of the query operation is also the type of some field, it is possible to use schema introspection fields nested in other fields. This function returns SchemaIntrospectionError::Unsupported for such operations, as they cannot be split into parts that have disjoint response keys.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.