We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6724ae4 commit d9e9857Copy full SHA for d9e9857
src/diff.ts
@@ -6,7 +6,6 @@ import {
6
introspectionQuery,
7
buildClientSchema,
8
buildSchema,
9
- IntrospectionQuery,
10
DangerousChange,
11
BreakingChange
12
} from 'graphql';
@@ -37,8 +36,13 @@ async function fetchRemoteSchema(
37
36
throw new Error(`${res.status} - ${res.statusText} (${endpoint})`);
38
}
39
40
- const { data }: { data: IntrospectionQuery } = await res.json();
41
- return buildClientSchema(data);
+ const responseBody = await res.json();
+
+ if (!responseBody || !responseBody.data || !responseBody.data.__schema) {
42
+ throw new Error(`Invalid response from GraphQL endpoint: ${endpoint}`);
43
+ }
44
45
+ return buildClientSchema(responseBody.data);
46
47
48
function readLocalSchema(schemaPath: string): GraphQLSchema {
0 commit comments