GraphQL Schema Explorer
Paste a GraphQL schema and explore types, fields, relationships, and auto-generated sample queries. Free online GraphQL SDL viewer.
Paste a GraphQL schema and click Explore, or load the Example Schema.
How to Use This Tool
- Paste your GraphQL schema in SDL format into the input area. Multi-line schemas with comments, descriptions, and directives are all supported.
- Click Explore to parse the schema. The tool will display a statistics bar with counts of types, fields, queries, and mutations.
- Use the Types tab to browse every type in the schema. Click a type in the sidebar to see its fields, arguments, return types, and descriptions. Types are color-coded: blue for object types, green for inputs, orange for enums, purple for interfaces, and pink for unions.
- Switch to the Relationships tab to see which types reference which others, giving you a high-level view of the schema graph.
- Open the Sample Queries tab to view auto-generated query and mutation skeletons based on your schema, ready to copy and use in a GraphQL client.
What Is GraphQL?
GraphQL is a query language for APIs developed by Facebook (now Meta) in 2012 and open-sourced in 2015. Unlike REST APIs where each endpoint returns a fixed data structure, GraphQL lets clients request exactly the fields they need in a single request. This eliminates over-fetching (getting more data than you need) and under-fetching (having to make multiple requests to assemble the data you need).
A GraphQL API is defined by its schema, which describes all the types, fields, and operations available. Clients send queries that mirror the shape of the data they want back, and the server responds with JSON matching that exact shape. This makes GraphQL particularly powerful for mobile applications, complex frontends, and any situation where bandwidth and request count matter.
Understanding the Schema Definition Language (SDL)
The Schema Definition Language is the standard syntax for writing GraphQL schemas. It is declarative and human-readable, designed to describe the full capabilities of a GraphQL API in a single file or set of files. SDL defines object types with fields, input types for mutations, enumerations, interfaces for shared field sets, unions for polymorphic return types, and custom scalars for specialized data types.
Every GraphQL schema has at least one root type: Query, which defines all read operations. Most schemas also include Mutation for write operations and optionally Subscription for real-time data. These root types are regular object types whose fields represent the top-level entry points of the API.
Field types can be modified with ! to indicate non-null (the field will never return null) and [] to indicate a list. These modifiers can be combined: [Book!]! means a non-null list of non-null Book objects. Understanding nullability is critical for writing robust GraphQL clients, as it determines which fields can be absent in responses.
The GraphQL Type System
GraphQL has a strong, static type system. Every field in a schema has a defined type, and the server guarantees responses match these types. The built-in scalar types are String, Int, Float, Boolean, and ID. Schemas can define custom scalars like DateTime, JSON, or URL for specialized data.
Object types are the building blocks of a GraphQL schema. Each object type has a name and a set of fields, where each field has a name, a return type, and optional arguments. Arguments let clients parameterize individual fields, enabling features like filtering, pagination, and sorting without needing separate endpoints.
Interfaces define a set of fields that multiple types must implement, similar to interfaces in TypeScript or Java. A type that implements an interface must include all the interface fields. Unions represent a value that could be one of several types, useful for search results or feeds that return mixed content. Both interfaces and unions enable polymorphic queries using inline fragments (... on TypeName).
GraphQL vs REST
REST APIs organize data around resources, each with its own URL endpoint. A typical REST flow might require three requests to fetch a user, their posts, and comments on those posts. GraphQL collapses this into a single request where the client specifies the exact nested data structure it needs.
REST relies on HTTP verbs (GET, POST, PUT, DELETE) for different operations, while GraphQL uses a single endpoint (typically /graphql) with queries and mutations in the request body. REST APIs are often documented with OpenAPI/Swagger, while GraphQL APIs are self-documenting through introspection — clients can query the schema itself to discover available types and fields.
The trade-offs are real: REST is simpler to cache (HTTP caching works out of the box), easier to understand for simple APIs, and has a larger ecosystem of tooling. GraphQL shines with complex data requirements, rapidly evolving frontends, and situations where multiple client platforms (web, mobile, IoT) need different slices of the same data.
Working with Directives
Directives are annotations in GraphQL schemas that modify the behavior of fields or types. The most common built-in directive is @deprecated, which marks a field as no longer recommended for use. This tool detects @deprecated directives and visually marks affected fields, including displaying the deprecation reason if provided. Custom directives like @auth, @cache, or @complexity are commonly used in production schemas to add metadata for server-side processing.
Related Tools
Format JSON API responses with the JSON Formatter. Generate TypeScript types from JSON with the JSON to TypeScript Generator. Convert curl commands to JavaScript API calls with the Curl to Fetch Converter. Generate TypeScript interfaces from OpenAPI specs with the OpenAPI to TypeScript Generator. Validate JSON payloads from GraphQL responses with the JSON Validator.
Frequently Asked Questions
- What is GraphQL Schema Definition Language (SDL)?
- GraphQL SDL is the syntax used to define the structure of a GraphQL API. It describes types, fields, queries, mutations, and their relationships in a human-readable format. SDL files typically use the .graphql or .gql extension and are used by both servers and clients to understand the API shape.
- What GraphQL features does this explorer support?
- The explorer parses type definitions, input types, enums, interfaces, unions, scalar declarations, queries, mutations, and subscriptions. It handles field arguments, non-null (!) and list ([]) modifiers, directives like @deprecated, and both block (triple-quote) and line (#) comments.
- Is my GraphQL schema sent to a server?
- No. All parsing and visualization happens entirely in your browser using JavaScript. Your schema never leaves your machine. This makes the tool safe for exploring private or proprietary API schemas.
- What are the generated sample queries?
- The tool automatically generates skeleton GraphQL queries for every field defined in your Query, Mutation, and Subscription types. It resolves nested object types up to two levels deep and includes placeholder argument values, giving you a starting point for testing your API.
- What is the difference between a type and an input type in GraphQL?
- A type (object type) defines the shape of data returned by the API — it is an output type. An input type defines the shape of data sent to the API as arguments — it is used for mutations and complex query parameters. Input types cannot have fields that return other object types or have arguments on their fields.
- How do I get the SDL schema for an existing GraphQL API?
- Most GraphQL APIs support introspection, which lets you query the schema programmatically. You can use tools like graphql-cli, Apollo Studio, or run an introspection query and convert the JSON result to SDL. Many APIs also publish their schema files in their documentation or GitHub repositories.
AI agent tools available.
The CodeTidy MCP Server gives Claude, Cursor, and other AI agents
access to 47 developer tools. One command: npx @codetidy/mcp