Skip to content

Commit 90811e9

Browse files
Passing all implemented interfaces to object
1 parent 625b095 commit 90811e9

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

Sources/GraphZahl/Resolution/OutputResolvable/Implementations/Object/GraphQLObject+resolve.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ extension GraphQLObject {
2020

2121
let interfaces = try inheritance
2222
.compactMap { $0 as? GraphQLObject.Type }
23-
.map { try context.resolveInterface(object: $0) } + propertyResults.compactMap(\.interface)
23+
.map { try context.resolveInterface(object: $0) } + propertyResults.flatMap(\.interfaces)
2424

2525
let type = try GraphQLObjectType(name: concreteTypeName, fields: fields, interfaces: interfaces) { value, _, _ in value is Self }
2626

Sources/GraphZahl/Resolution/OutputResolvable/Implementations/Object/PropertyWrappers/Inline.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ extension Inline: CustomGraphQLProperty {
3838
}
3939
}
4040

41-
return .interface(interface, fields: fields)
41+
return .interfaces([interface] + object.interfaces, fields: fields)
4242
}
4343

4444
}

Sources/GraphZahl/Resolution/OutputResolvable/Implementations/Object/PropertyWrappers/PropertyResult.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import GraphQL
33

44
enum PropertyResult {
55
case field(String, GraphQLField)
6-
case interface(GraphQLInterfaceType, fields: [String : GraphQLField])
6+
case interfaces([GraphQLInterfaceType], fields: [String : GraphQLField])
77
case ignore
88
}
99

@@ -13,15 +13,15 @@ extension PropertyResult {
1313
switch self {
1414
case .field(let name, let field):
1515
return [name : field]
16-
case .interface(_, let fields):
16+
case .interfaces(_, let fields):
1717
return fields
1818
case .ignore:
1919
return [:]
2020
}
2121
}
2222

23-
var interface: GraphQLInterfaceType? {
24-
guard case .interface(let interface, _) = self else { return nil }
23+
var interfaces: [GraphQLInterfaceType] {
24+
guard case .interfaces(let interface, _) = self else { return [] }
2525
return interface
2626
}
2727

0 commit comments

Comments
 (0)