@@ -581,14 +581,12 @@ variableValues):
581
581
- For each {responseName} and {fields} in {collectedFieldsMap}:
582
582
- Let {fieldName} be the name of the first entry in {fields}. Note: This value
583
583
is unaffected if an alias is used.
584
- - If {fieldName} is a meta-field as defined in the Introspection section:
585
- - Let {responseValue} be the result of resolving that meta-field as per the
586
- rules of the [ Introspection] ( #sec-Introspection ) section.
587
- - Set {responseValue} as the value for {responseName} in {resultMap}.
588
- - Otherwise, if a field named {fieldName} is defined on {objectType}:
589
- - Let {fieldType} be the return type defined for the field {fieldName} of
590
- {objectType}.
591
- - Assert: {fieldType} must exist.
584
+ - If {fieldName} is a meta-field as defined in the
585
+ [ Introspection] ( #sec-Introspection ) section, let {fieldType} be the return
586
+ type of that meta-field.
587
+ - Otherwise, let {fieldType} be the return type defined for the field
588
+ {fieldName} of {objectType}.
589
+ - If {fieldType} is defined:
592
590
- Let {responseValue} be {ExecuteField(objectType, objectValue, fieldType,
593
591
fields, variableValues)}.
594
592
- Set {responseValue} as the value for {responseName} in {resultMap}.
@@ -730,8 +728,11 @@ ExecuteField(objectType, objectValue, fieldType, fields, variableValues):
730
728
- Let {fieldName} be the field name of {field}.
731
729
- Let {argumentValues} be the result of {CoerceArgumentValues(objectType, field,
732
730
variableValues)}.
733
- - Let {resolvedValue} be {ResolveFieldValue(objectType, objectValue, fieldName,
734
- argumentValues)}.
731
+ - If {fieldName} is a meta-field as defined in the
732
+ [ Introspection] ( #sec-Introspection ) section, let {resolvedValue} be
733
+ {ResolveMetaFieldValue(objectType, fieldName, argumentValues)}.
734
+ - Otherwise, let {resolvedValue} be {ResolveFieldValue(objectType, objectValue,
735
+ fieldName, argumentValues)}.
735
736
- Return the result of {CompleteValue(fieldType, fields, resolvedValue,
736
737
variableValues)}.
737
738
@@ -823,6 +824,27 @@ necessitates the rest of a GraphQL executor to handle an asynchronous execution
823
824
flow. If the field is of a list type, each value in the collection of values
824
825
returned by {resolver} may itself be retrieved asynchronously.
825
826
827
+ ### Meta-Field Resolution
828
+
829
+ The meta-fields ` __typename ` , ` __schema ` and ` __type ` are resolved as per the
830
+ rules in the [ Introspection] ( #sec-Introspection ) section.
831
+
832
+ ResolveMetaFieldValue(objectType, fieldName, argumentValues):
833
+
834
+ - If {fieldName} is {"\_\_ typename"}:
835
+ - Return the name of {objectType}.
836
+ - If {fieldName} is {"\_\_ schema"}:
837
+ - Assert: {objectType} must be the _ root operation type_ in {schema} for query
838
+ operations.
839
+ - Return {schema}.
840
+ - If {fieldName} is {"\_\_ type"}:
841
+ - Assert: {objectType} must be the _ root operation type_ in {schema} for query
842
+ operations.
843
+ - Let {typeName} be the value provided in {argumentValues} for the name
844
+ {"name"}.
845
+ - Let {type} be the type with name {typeName} in {schema}.
846
+ - Return {type} if it exists; otherwise {null}.
847
+
826
848
### Value Completion
827
849
828
850
After resolving the value for a field, it is completed by ensuring it adheres to
0 commit comments