Skip to content

Instantly share code, notes, and snippets.

@a7v8x
Last active November 5, 2023 12:36
Show Gist options
  • Star 45 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save a7v8x/c30d92d2ca2458035aadc41702da367d to your computer and use it in GitHub Desktop.
Save a7v8x/c30d92d2ca2458035aadc41702da367d to your computer and use it in GitHub Desktop.
GraphQL introspection query - for fetching the whole schema (from GraphiQL IDE) for https://atheros.ai/blog/graphql-introspection-and-introspection-queries
query IntrospectionQuery {
__schema {
queryType { name }
mutationType { name }
types {
...FullType
}
directives {
name
description
locations
args {
...InputValue
}
}
}
}
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
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
}
}
}
}
}
}
}
}
@paveltyk
Copy link

Thanks :)

@caralmar
Copy link

caralmar commented Feb 1, 2022

Hi, quick question. I have use case where I need to introspect a list of objects and get their schemas in ONE json doc. Is there a way to specify a list of objects that you want the graphQL server to fetch the schema for? So I would not get ALL of the objects... just the ones that I'm interested in, but in one query. THANK YOU!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment