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