Enter your GraphQL schema definition (SDL)
Click Validate to check for syntax errors
Get formatted schema with proper indentation
GraphQL schema validation ensures that your GraphQL Schema Definition Language (SDL) is syntactically correct and follows GraphQL specifications. A valid schema is essential for your GraphQL API to function properly, as it defines the types, queries, mutations, and relationships in your API.
Our validator checks for common errors like missing type definitions, invalid field types, incorrect syntax, and schema inconsistencies. It helps catch errors early in development before they cause runtime issues in your GraphQL server.
type User {
id: ID!
name: String!
email: String!
posts: [Post!]!
}
type Query {
user(id: ID!): User
users: [User!]!
}
Copy your GraphQL schema definition from your project and paste it into the input area. The schema should be in SDL (Schema Definition Language) format, which is the standard way to define GraphQL schemas.
Click "Validate Schema" to check for syntax errors and schema issues. The validator will report any problems with specific line numbers and descriptions, making it easy to locate and fix errors.
Once validated, click "Format Schema" to get a properly formatted version with consistent indentation and spacing. Copy the formatted schema back to your project or download it as a .graphql file.
Common validation errors include undefined types, missing required fields, invalid field types, and syntax errors. The validator provides detailed error messages to help you quickly identify and fix issues.
Validate your GraphQL schema during API development to ensure it's correctly structured before implementing resolvers. This prevents runtime errors and ensures your API contract is solid.
When refactoring your GraphQL schema, use the validator to ensure changes don't introduce errors. Validate after each change to catch issues immediately rather than discovering them during testing.
Validate schemas during code review to ensure proposed changes maintain schema integrity. Well-formatted, validated schemas make reviews faster and more effective.
Many GraphQL documentation tools require valid schemas. Validate and format your schema before generating documentation to ensure accurate, complete API docs.
Tools like GraphQL Code Generator require valid schemas to generate TypeScript types or other client code. Validate your schema first to ensure successful code generation.
type User {
id: ID!
name: String!
email: String!
age: Int
isActive: Boolean!
}
type Query {
user(id: ID!): User
users: [User!]!
}
type Author {
id: ID!
name: String!
books: [Book!]!
}
type Book {
id: ID!
title: String!
author: Author!
publishedYear: Int!
}
input CreateUserInput {
name: String!
email: String!
age: Int
}
type Mutation {
createUser(input: CreateUserInput!): User!
updateUser(id: ID!, input: CreateUserInput!): User!
}
enum Role {
ADMIN
USER
GUEST
}
interface Node {
id: ID!
}
type User implements Node {
id: ID!
name: String!
role: Role!
}
type User {
id: ID!
name: String!
email: String! @deprecated(reason: "Use emailAddress instead")
emailAddress: String!
password: String! @auth(requires: ADMIN)
}
Explore our other API and data tools:
Get $200 free DigitalOcean credit or sponsor us on GitHub!