Skip to content

Commit 97f1ea4

Browse files
committed
Treat schema with no operation types as if it uses common names
1 parent 6f25937 commit 97f1ea4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/utilities/printSchema.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,15 @@ function isSchemaOfCommonNames(schema: GraphQLSchema): boolean {
115115
const mutationOperationType = schema.getMutationType() || null;
116116
const subscriptionOperationType = schema.getSubscriptionType() || null;
117117

118+
// Special case for when there are no operation types
119+
if (
120+
!queryOperationType &&
121+
!mutationOperationType &&
122+
!subscriptionOperationType
123+
) {
124+
return true;
125+
}
126+
118127
const queryType = schema.getType('Query') || null;
119128
const mutationType = schema.getType('Mutation') || null;
120129
const subscriptionType = schema.getType('Subscription') || null;

0 commit comments

Comments
 (0)