Introspection
A GraphQL server supports introspection over its schema. This schema is queried using GraphQL itself, creating a powerful platform for tool‐building.
Take an example query for a trivial app. In this case there is a User type with three fields: id, name, and birthday.
For example, given a server with the following type definition:
type User {
id: String
name: String
birthday: Date
}
The query
{
__type(name: "User") {
name
fields {
name
type {
name
}
}
}
}
would return
{
"__type"
: {
"name"
:
"User"
,
"fields"
: [
{
"name"
:
"id"
,
"type"
: {
"name"
:
"String"
}
},
{
"name"
:
"name"
,
"type"
: {
"name"
:
"String"
}
},
{
"name"
:
"birthday"
,
"type"
: {
"name"
:
"Date"
}
},
]
}
}