Results will appear here after validation...
What is GraphQL Schema Validator?
GraphQL uses Schema Definition Language (SDL) to define the types, queries, mutations, and subscriptions in an API. A schema with syntax errors, duplicate types, or references to undefined types will fail at startup or cause runtime errors. This validator checks your schema SDL before you deploy.
How to Use
- Paste your GraphQL SDL schema into the editor.
- Click "Validate" to run structural and syntax checks.
- Review errors (blocks the schema) and warnings (potential issues).
- Fix errors and re-validate until no errors remain.
- Use "Load Sample" to see a valid schema example.
Why Use This Tool?
Tips & Best Practices
- Every GraphQL schema must have a "type Query" root — even if it's mostly mutations
- Use ! for non-null fields: String! means the field will never be null
- [Post!]! means the array is non-null AND each item in it is non-null
- Input types (input keyword) are used for mutation arguments — they cannot have fields that resolve to interfaces or unions
- Use schema linting in CI/CD (graphql-inspector, graphql-eslint) for production schemas
Frequently Asked Questions
What is the difference between a schema error and a warning?
Errors indicate problems that will prevent the schema from loading — duplicate type names, references to undefined types, unbalanced braces. Warnings indicate best-practice violations that won't prevent loading but may cause unexpected behavior, like a missing Query type or empty type bodies. Infos are advisory notices like unused types.
Does this validate queries against the schema?
No — this tool validates the schema definition itself (SDL), not GraphQL queries against a schema. To validate a query against a schema, you need a full GraphQL executor like graphql-js. Check the "GraphQL Builder" tool for query construction.
Can I validate schema fragments (partial SDL)?
Yes, but undefined type references will be flagged as errors because the validator doesn't know which types are defined in other files. If you're validating a partial schema, the "unknown type" errors for imported types can be ignored — focus only on syntax and duplicate errors.