Я пытаюсь получить схему для GitHub с помощью get-graphql-schema, но получаю сообщение об ошибке: -
# npm install -g get-graphql-schema
# get-graphql-schema https://api.github.com/graphql
*TypeError: Cannot read property '__schema' of undefined
at Object.buildClientSchema
(C:\Users\Aaron\AppData\Roaming\npm\node_modules\get-graphql-schema\node_modules\graphql\utilities\buildClientSchema.js:48:43)*
Я получаю то же самое для Facebook. Я не уверен, что это потому, что они не предоставляют схемы, или это ошибка с get-graphql-schema.
Как я могу программно получить схему, используя GraphQl обычно в проводнике GraphiQL?

Хорошо, вот сценарий GraphQL, который программно запрашивает запись __schema: -
query IntrospectionQuery {
__schema {
queryType { name }
mutationType { name }
subscriptionType { name }
types {
...FullType
}
directives {
name
description
args {
...InputValue
}
onOperation
onFragment
onField
}
}
}
fragment FullType on __Type {
kind
name
description
fields(includeDeprecated: true) {
name
description
args {
...InputValue
}
type {
...TypeRef
}
isDeprecated
deprecationReason
}
inputFields {
...InputValue
}
interfaces {
...TypeRef
}
enumValues(includeDeprecated: true) {
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
}
}
}
}
https://gist.github.com/AaronNGray/c873c093f7015389cd7358d7270e1e1e