pub fn prepare(
schema: Option<&Schema>,
request: Request,
introspection_disabled_for: Option<&str>,
) -> Result<Request, (Request, Vec<ServerError>)>Expand description
Ready a request for execution, and refuse it where async-graphql would not.
Two passes over the same parsed document, because parsing it twice to do them separately would be the only reason to separate them:
- variable declarations nothing uses are dropped, since Hasura executes such a document and the specification does not;
- variables used where their declared type does not fit are refused, since the specification says so and async-graphql does not.
schema is what the second pass needs – the types a variable is being
used against. Without one only the first pass runs.
Err carries the request back beside the errors, so the caller can answer
with them rather than executing.