File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
Sources/GraphQL/Execution Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -969,6 +969,21 @@ func completeValue(
969
969
)
970
970
}
971
971
972
+ // If field type is a TypeReference, find the type itself.
973
+ if
974
+ let returnType = returnType as? GraphQLTypeReference ,
975
+ let referencedType = info. schema. typeMap [ returnType. name]
976
+ {
977
+ return try completeValue (
978
+ exeContext: exeContext,
979
+ returnType: referencedType,
980
+ fieldASTs: fieldASTs,
981
+ info: info,
982
+ path: path,
983
+ result: . success( exeContext. eventLoopGroup. any ( ) . makeSucceededFuture ( result) )
984
+ )
985
+ }
986
+
972
987
// Not reachable. All possible output types have been considered.
973
988
throw GraphQLError (
974
989
message: " Cannot complete value of unexpected type \" \( returnType) \" . "
Original file line number Diff line number Diff line change @@ -88,9 +88,16 @@ func getVariableValue(
88
88
definitionAST: VariableDefinition ,
89
89
input: Map
90
90
) throws -> Map {
91
- let type = typeFromAST ( schema: schema, inputTypeAST: definitionAST. type)
91
+ var type = typeFromAST ( schema: schema, inputTypeAST: definitionAST. type)
92
92
let variable = definitionAST. variable
93
93
94
+ if let typeReference = type as? GraphQLTypeReference {
95
+ guard let referencedType = schema. typeMap [ typeReference. name] else {
96
+ throw GraphQLError ( message: " Referenced type \( typeReference. name) not found " )
97
+ }
98
+ type = referencedType
99
+ }
100
+
94
101
guard let inputType = type as? GraphQLInputType else {
95
102
throw GraphQLError (
96
103
message:
You can’t perform that action at this time.
0 commit comments