Skip to content

Commit ac2a4ed

Browse files
committed
Handle interface implementations of other interfaces
1 parent 6495218 commit ac2a4ed

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

Sources/GraphQL/Type/Schema.swift

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,18 +191,15 @@ func collectImplementations(
191191
) -> [String : InterfaceImplementations] {
192192
var implementations: [String: InterfaceImplementations] = [:]
193193

194-
for type in types {
194+
var typesToCheck = types
195+
while let type = typesToCheck.popLast() {
195196
if let type = type as? GraphQLInterfaceType {
196197
if implementations[type.name] == nil {
197198
implementations[type.name] = InterfaceImplementations()
198199
}
199200

200-
// Store implementations by interface.
201-
for iface in type.interfaces {
202-
implementations[iface.name] = InterfaceImplementations(
203-
interfaces: (implementations[iface.name]?.interfaces ?? []) + [type]
204-
)
205-
}
201+
// Depth first search of other interface implementations
202+
typesToCheck += type.interfaces
206203
}
207204

208205
if let type = type as? GraphQLObjectType {

0 commit comments

Comments
 (0)