Skip to content
Jellykit

GraphQL Formatter & Validator

Format GraphQL queries, fragments and schema SDL, check the syntax with the line and column of any error, and check schema definitions.

  • Runs on your device
  • Works in the background
Loading tool

About GraphQL Formatter & Validator

Paste a query, a mutation, fragments or a schema written in SDL and get it laid out with consistent indentation. Comments starting with # and descriptions in quotes are kept where they were. Choose Compact to squeeze the document onto as few characters as possible, for example to send it in a request.

The syntax is always checked: if the document cannot be read, the line and column where reading stopped are shown. Schema definitions are also checked on their own, for unknown types and directives, duplicate names and interfaces that are not implemented. Operations are checked for syntax only, because checking them against a schema needs that schema.

How it works

  1. The document is parsed by the reference GraphQL library in a background worker. A syntax error stops there, with its line and column.
  2. Type definitions, extensions and directive definitions are checked as a schema of their own. A document with no Query type is taken as part of a larger schema, so the missing root type is not reported, but references to types it does not define are.
  3. The document is then printed with your indentation by a printer that keeps # comments and descriptions in place, or compacted by removing every character GraphQL ignores, comments included.

Questions

Does it validate my query against my schema?

No. Queries, mutations, subscriptions and fragments are checked for syntax only. Fields, arguments and variable types are not compared with a schema, even when the schema is in the same document.

Why does my schema show unknown types or directives?

Schema definitions are checked using only what this document contains. A file that is one part of a larger schema, or that uses directives defined by a server framework, will show those names as unknown. The formatting is done all the same.

Are comments kept?

Yes, with any indentation choice, # comments stay next to the line they were on and descriptions in quotes are kept. Compact output removes # comments, because GraphQL ignores them, but keeps descriptions.

How large a document can it take?

Up to 1 MB of text and 500,000 tokens (names, punctuation and values). A document nested so deeply that the parser cannot follow it is refused with a message rather than freezing the page.

Everything you enter here is processed in this browser tab. Nothing is uploaded, logged or shared. How privacy works here.