Skip to content

Commit

Permalink
Treat schema with no operation types as if it uses common names
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie committed Feb 3, 2023
1 parent 4d0bcde commit ac3cb10
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/utilities/printSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,15 @@ function isSchemaOfCommonNames(schema: GraphQLSchema): boolean {
const mutationOperationType = schema.getMutationType() ?? null;
const subscriptionOperationType = schema.getSubscriptionType() ?? null;

// Special case for when there are no operation types
if (
!queryOperationType &&
!mutationOperationType &&
!subscriptionOperationType
) {
return true;
}

const queryType = schema.getType('Query') ?? null;
const mutationType = schema.getType('Mutation') ?? null;
const subscriptionType = schema.getType('Subscription') ?? null;
Expand Down

0 comments on commit ac3cb10

Please sign in to comment.