GraphQL specification at a glance
GraphQL is a query language and runtime defined by a single specification maintained by the GraphQL Foundation. This reference collects the parts developers look up most often: the built-in scalar types, the type kinds that make up the type system, the built-in directives, and the three operation types. Everything below is filterable so you can jump straight to, say, the @deprecated directive or the ID scalar.
How it works
The GraphQL type system is built from a small set of fundamental kinds. Scalars are leaf values that resolve to concrete data. Object, interface and union types describe composite shapes, while enum and input object types constrain values. Two wrapping kinds — LIST and NON_NULL — modify another type; for example [String!]! is a non-null list of non-null strings.
Directives annotate parts of a document or schema to change execution or validation. The spec requires servers to support @skip, @include, @deprecated and @specifiedBy. Directives carry arguments, e.g. @deprecated(reason: "Use newField").
Execution turns a validated document into a result. Top-level query fields may execute in parallel because reads are side-effect free; mutation fields execute serially in listed order so writes are deterministic. Errors are collected into an errors array while partial data is still returned where possible.
Tips and example
A typical schema using these pieces:
type User {
id: ID!
name: String!
legacyEmail: String @deprecated(reason: "Use contactEmail")
contactEmail: String!
}
type Query {
user(id: ID!): User
}
When unsure whether a value can be null, remember that GraphQL fields are nullable by default — you opt into non-null with the trailing !. Use the filter below to confirm the exact spec section before relying on any behaviour.