Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 34 additions & 4 deletions spec/Section 6 -- Execution.md
Original file line number Diff line number Diff line change
Expand Up @@ -581,8 +581,11 @@ variableValues):
- For each {responseName} and {fields} in {collectedFieldsMap}:
- Let {fieldName} be the name of the first entry in {fields}. Note: This value
is unaffected if an alias is used.
- Let {fieldType} be the return type defined for the field {fieldName} of
{objectType}.
- If {fieldName} is a meta-field as defined in the
[Introspection](#sec-Introspection) section, let {fieldType} be the return
type of that meta-field.
- Otherwise, let {fieldType} be the return type defined for the field
{fieldName} of {objectType}.
- If {fieldType} is defined:
- Let {responseValue} be {ExecuteField(objectType, objectValue, fieldType,
fields, variableValues)}.
Expand Down Expand Up @@ -725,8 +728,11 @@ ExecuteField(objectType, objectValue, fieldType, fields, variableValues):
- Let {fieldName} be the field name of {field}.
- Let {argumentValues} be the result of {CoerceArgumentValues(objectType, field,
variableValues)}.
- Let {resolvedValue} be {ResolveFieldValue(objectType, objectValue, fieldName,
argumentValues)}.
- If {fieldName} is a meta-field as defined in the
[Introspection](#sec-Introspection) section, let {resolvedValue} be
{ResolveMetaFieldValue(objectType, fieldName, argumentValues)}.
- Otherwise, let {resolvedValue} be {ResolveFieldValue(objectType, objectValue,
fieldName, argumentValues)}.
- Return the result of {CompleteValue(fieldType, fields, resolvedValue,
variableValues)}.

Expand Down Expand Up @@ -818,6 +824,30 @@ necessitates the rest of a GraphQL executor to handle an asynchronous execution
flow. If the field is of a list type, each value in the collection of values
returned by {resolver} may itself be retrieved asynchronously.

### Meta-Field Resolution

The meta-fields `__typename`, `__schema` and `__type` are resolved as per the
rules in the [Introspection](#sec-Introspection) section.

ResolveMetaFieldValue(objectType, fieldName, argumentValues):

- If {fieldName} is {"\_\_schema"}:
- Assert: {objectType} must be the _root operation type_ in {schema} for query
operations.
- Return {schema}.
- Otherwise, if {fieldName} is {"\_\_type"}:
- Assert: {objectType} must be the _root operation type_ in {schema} for query
operations.
- Let {typeName} be the value provided in {argumentValues} for the name
{"name"}.
- If {typeName} begins with {"\_\_"}, let {type} be the type with name
{typeName} in the introspection schema.
- Otherwise, let {type} be the type with name {typeName} in {schema}.
- Return {type} if it exists; otherwise {null}.
- Otherwise:
- Assert: {fieldName} is {"\_\_typename"}.
- Return the name of {objectType}.

### Value Completion

After resolving the value for a field, it is completed by ensuring it adheres to
Expand Down