GraphQL Validator
Check a GraphQL schema for syntax problems and see a breakdown of types, fields, enums, and directives
Input
Validation
- Total tokens
- Type definitions
- Interfaces
- Enums
- Input types
- Unions
- Scalars
- Directives
- Total fields
- Arguments
- Descriptions
- Comments
What is the GraphQL Validator?
A schema that comes back from a federation composer, a code generator, or a hand-edit during a code review almost always has at least one syntax problem on the first pass. A stray }, an unterminated description string, an enum body that got chopped off when someone copied half a screen of SDL into a chat, and the next thing you know your Apollo Server startup blows up with a parser error pointing at line 1, which is rarely where the actual problem is. This validator walks the SDL token-by-token and points at the real line.
It checks structural rules from the October 2021 GraphQL spec: every {, (, and [ needs a matching closer of the right kind; descriptions written as """...""" have to be terminated; quoted strings inside arguments must close on the same line. The validator does NOT verify semantics: it will not tell you that Query is missing or that a field references an undeclared type. For that, run the schema through the reference graphql-js implementation. What this page does well is the syntax pass and the stat block, so you can see at a glance whether the schema you just pasted has 14 types or 4, 187 fields or 12.
Validation happens inside the page itself; the schema is never sent off or saved. Paste it, check it, copy it.
How to Use the GraphQL Validator
Three quick steps. The buttons below match the actual buttons on this page.
Paste, Upload, or Load a Sample
Put a schema in the Input pane; the check reruns 300 ms after you stop typing, which is why there is no Validate button. Upload reads .graphql, .graphqls, .gql or .txt, and Sample loads a commented storefront schema so you can see a fully populated stat grid. A paste with a mistake in it might look like this:
type Invoice {
number: String!
issuedTo: Customer!
lines: [InvoiceLine!]!
enum InvoiceState { DRAFT SENT PAID } That paste never closes Invoice, so the banner turns red with Unmatched '{' at line 1, pointing at the brace that was opened and left hanging. # comments and """ descriptions are read as tokens of their own, as the GraphQL learn-schema docs describe them, so a brace typed inside a description never trips the check.
Read the Stat Block
The right panel shows a green banner if the schema parses cleanly, a red banner if it does not, and either way you get a stat breakdown of how many type, interface, enum, input, union, scalar, and directive definitions the schema declares, plus the total field count, argument count, and description count. Useful for sanity-checking a federation merge or comparing two revisions of the same schema. The counts mirror the kinds of definition the GraphQL type system is built from.
Fix and Re-paste
If the schema is invalid, the banner tells you the exact line of the unbalanced brace or unterminated string. Fix it, paste it back, watch the banner go green. The Copy button on the right gives you a small JSON stat report you can drop into a PR description or a chat message: handy when you want to show a teammate "yes the schema is fine, here are the stats" without sharing the SDL itself.
When You'd Actually Use This
Pre-merge sanity check
Before merging a federation gateway change or a schema-stitching update, paste the composed schema in. If the brace balance is off or a description is unterminated, you will see it here in two seconds rather than in a CI failure ten minutes later. Pairs well with the rover subgraph check command for the semantic side.
Diffing two revisions
Paste version A, note the stat numbers (28 types, 142 fields, 6 enums). Paste version B, compare. If the field count jumped by 40 but only one new type was added, somebody probably duplicated a fragment. The stat block is much faster than scrolling through a 2000-line diff.
Onboarding a new contractor
Hand them the schema file, point them at this page, and say "if it goes red, your paste is broken; if the field count is suddenly 800 lower, you only copied half of it." Saves the back-and-forth of "is this all of it?" before they even get to writing resolvers.
Pasting from chat
Slack and Discord love to mangle backticks and quote characters when wrapping long messages, so a schema someone pasted into a thread often loses a closing brace or two. Drop it in here first to find out before opening it in your IDE.
Common Questions
Does it validate semantics, or just syntax?
Syntax only. It confirms that braces, parentheses and brackets pair up and that every string is closed, then counts tokens, types, fields and the rest. It has no idea that InvoiceLine was never defined or that the file has no Query type. Load the SDL with buildSchema from graphql-js, or start your server, to get those errors.
Is my schema sent to a server?
No. The parser works on your own machine, so the schema is never transmitted and never ends up in a log. Internal or unreleased schemas are fine to paste.
What syntax problems will it actually catch?
Unmatched { / ( / [ with the line number where the opener was, mismatched closers like ) where } was expected, unterminated "strings" or """block strings""", and stray characters that are not part of the GraphQL token grammar.
Why does my schema show 0 types when it clearly has types?
The stat counter only counts a definition once both its keyword (type, interface, etc.) AND its body braces are present. If you pasted a schema that is truncated mid-type, the count for that type stays 0 until you finish the body. The validator banner will also be red in that case, pointing at the unmatched opener.
Does it understand block-string descriptions?
Yes. """An order placed by a customer.""" is recognised as a description token and counted in the Descriptions stat. The validator does not enforce where descriptions appear, that is a style choice, but the count gives you a quick read on how documented the schema is.
How big a schema can I paste?
The page accepts up to 5 MB and shows a message past that. Under the cap, the tokenizer and the stat walk are single passes, so even a large federated schema gets its banner quickly; a long file slows the editor down before it slows the check.
Other GraphQL Tools
A green banner here means the SDL is well-formed. These pages pick up from that point, or check the config files that tend to sit beside a schema: