Skip to content

Commit b59b98a

Browse files
committed
update check to allow for schemas with just federated resolvers
1 parent 6357451 commit b59b98a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Sources/Graphiti/Schema/Schema.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ public final class Schema<Resolver, Context> {
1616
try component.update(typeProvider: typeProvider, coders: coders)
1717
}
1818

19-
guard let query = typeProvider.query else {
20-
fatalError("Query type is required.")
19+
guard typeProvider.query != nil || !typeProvider.federatedResolvers.isEmpty else {
20+
fatalError("Schema must contain at least 1 query or federated resolver")
2121
}
22+
2223
schema = try GraphQLSchema(
23-
query: query,
24+
query: typeProvider.query,
2425
mutation: typeProvider.mutation,
2526
subscription: typeProvider.subscription,
2627
types: typeProvider.types,

0 commit comments

Comments
 (0)