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

Exclude deprecated fields from the fetched schema #2107

Merged
merged 1 commit into from
May 1, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 92 additions & 5 deletions script/fetch-schema
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,100 @@ const fs = require('fs');
const path = require('path');

const fetch = require('node-fetch');
const {
buildClientSchema,
introspectionQuery,
printSchema,
} = require('graphql/utilities');
const {buildClientSchema, printSchema} = require('graphql/utilities');
const schemaPath = path.resolve(__dirname, '..', 'graphql', 'schema');

const introspectionQuery = `
query IntrospectionQuery {
__schema {
queryType { name }
mutationType { name }
subscriptionType { name }
types {
...FullType
}
directives {
name
description
locations
args {
...InputValue
}
}
}
}
fragment FullType on __Type {
kind
name
description
fields(includeDeprecated: false) {
name
description
args {
...InputValue
}
type {
...TypeRef
}
isDeprecated
deprecationReason
}
inputFields {
...InputValue
}
interfaces {
...TypeRef
}
enumValues(includeDeprecated: false) {
name
description
isDeprecated
deprecationReason
}
possibleTypes {
...TypeRef
}
}
fragment InputValue on __InputValue {
name
description
type { ...TypeRef }
defaultValue
}
fragment TypeRef on __Type {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
}
}
}
}
}
}
}
}
`;

const token = process.env.GITHUB_TOKEN;
if (!token) {
throw new Error('You must specify a GitHub auth token in GITHUB_TOKEN');
Expand Down