Cheatsheet: GraphQL
Last updated 2026-06-21
Schema
Define object types and the root Query type.
Use non-null fields and arguments with !.
Use list types for arrays of values or objects.
Define an input type for structured mutation arguments.
Define enums for a fixed set of allowed values.
Define interfaces for fields shared by multiple object types.
Queries
Execute a simple query with a nested selection set.
Pass arguments to fields.
Use aliases to request the same field with different arguments.
Use variables instead of hard-coding argument values.
Use fragments to reuse field selections.
Use inline fragments for unions or interfaces.
Operations and directives
Execute a mutation and request fields from the payload.
Execute a subscription for real-time updates where supported by the server.
Conditionally include fields with @include.
Conditionally skip fields with @skip.
Use operation names to identify requests in logs and tooling.
Introspection
List available query fields with introspection.
Inspect a type and its fields.
See also: