File tree Expand file tree Collapse file tree
Sources/GraphQL/Execution Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -969,6 +969,21 @@ func completeValue(
969969 )
970970 }
971971
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+
972987 // Not reachable. All possible output types have been considered.
973988 throw GraphQLError (
974989 message: " Cannot complete value of unexpected type \" \( returnType) \" . "
Original file line number Diff line number Diff line change @@ -88,9 +88,16 @@ func getVariableValue(
8888 definitionAST: VariableDefinition ,
8989 input: Map
9090) throws -> Map {
91- let type = typeFromAST ( schema: schema, inputTypeAST: definitionAST. type)
91+ var type = typeFromAST ( schema: schema, inputTypeAST: definitionAST. type)
9292 let variable = definitionAST. variable
9393
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+
94101 guard let inputType = type as? GraphQLInputType else {
95102 throw GraphQLError (
96103 message:
You can’t perform that action at this time.
0 commit comments