Executing Requests

To execute a request, the executor must have a parsedDocument(as defined in the “Query Language” part of this spec) and a selected operation name to run if the document defines multiple operations, otherwise the document is expected to only contain a single operation. The result of the request is determined by the result of executing this operation according to the “Executing Operations” section below.

ExecuteRequest

(

schema

,

document

,

operationName

,

variableValues

,

initialValue

)

  1. Let operation be the result of GetOperation ( document , operationName ) .
  2. Let coercedVariableValues be the result of CoerceVariableValues ( schema , operation , variableValues ) .
  3. If operation is a query operation:
    1. Return ExecuteQuery ( operation , schema , coercedVariableValues , initialValue ) .
  4. Otherwise if operation is a mutation operation:
    1. Return ExecuteMutation ( operation , schema , coercedVariableValues , initialValue ) .

GetOperation

(

document

,

operationName

)

  1. If operationName is null :
    1. If document contains exactly one operation.
      1. Return the Operation contained in the document .
    2. Otherwise produce a query error requiring operationName .
  2. Otherwise:
    1. Let operation be the Operation named operationName in document .
    2. If operation was not found, produce a query error.
    3. Return operation .

results matching ""

    No results matching ""