Skip to content

Commit

Permalink
Fixing type resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
nerdsupremacist committed Dec 25, 2020
1 parent 17b3081 commit 0e0e210
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Sources/GraphZahl/Resolution/Resolution.swift
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,10 @@ extension Resolution.Context {
let interfaceReference = GraphQLTypeReference(interfaceName)
let interface = try GraphQLInterfaceType(name: interfaceName, fields: interfaceFields) { (value, eventLoop, info: GraphQLResolveInfo) in
let schema = info.schema
let interface = schema.getType(name: name) as! GraphQLInterfaceType
let interface = schema.getType(name: interfaceName) as! GraphQLInterfaceType
let objects = schema.getPossibleTypes(abstractType: interface)
let sorted = objects.sorted { $0.interfaces.count > $1.interfaces.count }
return try sorted.first { try $0.isTypeOf.map { try $0(value, eventLoop, info) } ?? false } ?? "__\(name)"
let sorted = objects.sorted { $0.name != name && $0.interfaces.count > $1.interfaces.count }
return try sorted.first { try $0.isTypeOf.map { try $0(value, eventLoop, info) } ?? false } ?? name
}

let newObjectFields = object.fields.mapValues { field in
Expand Down

0 comments on commit 0e0e210

Please # to comment.