GraphQL - Schema Introspection


Schema Introspection (ie querying the Schema and not the data)

Example: graphql/graphql-js/blob/master/src/__tests__/starWarsIntrospection-test.js

The introspection file in GraphQL.js contains code implementing a specification-compliant GraphQL query introspection system



We can ask GraphQL, by querying the __schema field, always available on the root type of a Query.


query IntrospectionTypeQuery {
  __schema {
    types {

and we get all the types with the name field.

  "__schema": {
    "types": [
        "name": "Query"
        "name": "Character"
        "name": "Human"

Built-in type

  • __Schema, __Type, __TypeKind, __Field, __InputValue, __EnumValue, __Directive preceded with a double underscore, indicating that they are part of the introspection system.

Documentation / Reference

Recommended Pages

is a graph based query language for querying and retrieving a tree of data that perfectly matches a front-end view, regardless of where that data was pulled from. is intended to be a replacement for...
GraphQL - Schema (Type)

GraphQl defines a schema (type). The implementation graphql/graphql-js/tree/master/src/typegraphql/type module is the engine for defining GraphQL types and schema. The below type is a shorthand notation....

Share this page:
Follow us:
Task Runner