Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit ee081ab

Browse files
authored
Merge pull request #2107 from atom/aw/inline-introspection-query
Exclude deprecated fields from the fetched schema
2 parents 9b569d0 + e3fdcf1 commit ee081ab

File tree

1 file changed

+92
-5
lines changed

1 file changed

+92
-5
lines changed

script/fetch-schema

Lines changed: 92 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,100 @@ const fs = require('fs');
33
const path = require('path');
44

55
const fetch = require('node-fetch');
6-
const {
7-
buildClientSchema,
8-
introspectionQuery,
9-
printSchema,
10-
} = require('graphql/utilities');
6+
const {buildClientSchema, printSchema} = require('graphql/utilities');
117
const schemaPath = path.resolve(__dirname, '..', 'graphql', 'schema');
128

9+
const introspectionQuery = `
10+
query IntrospectionQuery {
11+
__schema {
12+
queryType { name }
13+
mutationType { name }
14+
subscriptionType { name }
15+
types {
16+
...FullType
17+
}
18+
directives {
19+
name
20+
description
21+
locations
22+
args {
23+
...InputValue
24+
}
25+
}
26+
}
27+
}
28+
fragment FullType on __Type {
29+
kind
30+
name
31+
description
32+
fields(includeDeprecated: false) {
33+
name
34+
description
35+
args {
36+
...InputValue
37+
}
38+
type {
39+
...TypeRef
40+
}
41+
isDeprecated
42+
deprecationReason
43+
}
44+
inputFields {
45+
...InputValue
46+
}
47+
interfaces {
48+
...TypeRef
49+
}
50+
enumValues(includeDeprecated: false) {
51+
name
52+
description
53+
isDeprecated
54+
deprecationReason
55+
}
56+
possibleTypes {
57+
...TypeRef
58+
}
59+
}
60+
fragment InputValue on __InputValue {
61+
name
62+
description
63+
type { ...TypeRef }
64+
defaultValue
65+
}
66+
fragment TypeRef on __Type {
67+
kind
68+
name
69+
ofType {
70+
kind
71+
name
72+
ofType {
73+
kind
74+
name
75+
ofType {
76+
kind
77+
name
78+
ofType {
79+
kind
80+
name
81+
ofType {
82+
kind
83+
name
84+
ofType {
85+
kind
86+
name
87+
ofType {
88+
kind
89+
name
90+
}
91+
}
92+
}
93+
}
94+
}
95+
}
96+
}
97+
}
98+
`;
99+
13100
const token = process.env.GITHUB_TOKEN;
14101
if (!token) {
15102
throw new Error('You must specify a GitHub auth token in GITHUB_TOKEN');

0 commit comments

Comments
 (0)