Introspection system
- Query information about a GraphQL schema – features it supports.
- According to Merriam-Webster “introspection” means a reflective looking inward.
- A special kind of query.
- Allow you to learn about a GraphQL API’s schema.
[!TIP]
GraphQL APIs designed exclusively for in-house applications, we typically won’t add introspection service in production env. In fact disabling introspection service can be considered part of a security strategy.
To disable it you can use 3rd-party libs such as graphql-disable-introspection.
__typename
- Ask GraphQL to tell us about the type of object.
- Can be added to any object.
__schema
- Returns available types.
- Always available on the
queryroot operation type.
| Operation | Response |
|---|---|
![]() |
|
|
The response in JSON format look like this. The entrypoint of available queries which is usually called Query.
|
|
The response in JSON format look like this. Essentially it is an array of fields with filed name inside it. |
