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

Discover More
GraphQL - Schema (Type)

This article is the schema (type) definition of GraphQL. The implementation graphql/graphql-js/tree/master/src/typegraphql/type module is the engine for defining GraphQL types and schema. The below...
What is GraphQL (Graph Query Language)?

is a graph-based, schema-based, SQL-like query language where queries returns a tree of data (json objects) that should match a front-end view, regardless of where that data was pulled from....

Share this page:
Follow us:
Task Runner