GraphQL Schema Definition Cheatsheet
Quick reference for GraphQL schema types, inputs, enums, interfaces, unions, scalars, directives, and schema operations.
| Item | Description | Example | Category |
|---|---|---|---|
| type | Define object type | type User { id: ID! name: String! } | Type |
| input | Define input object type | input UserInput { name: String! age: Int } | Input |
| enum | Define enum | enum Role { ADMIN USER GUEST } | Enum |
| interface | Define interface for types | interface Node { id: ID! } | Interface |
| implements | Type implements interface | type User implements Node { id: ID! name: String! } | Interface |
| union | Union of multiple types | union SearchResult = User | Post | Comment | Union |
| scalar | Custom scalar type | scalar DateTime | Scalar |
| @deprecated | Mark field as deprecated | type User { oldField: String @deprecated(reason: "Use newField") } | Directive |
| @include / @skip | Conditional field inclusion (runtime) | type User { name: String @include(if: $showName) } | Directive |
| schema | Define root operations | schema { query: Query mutation: Mutation } | Type |
| extend | Extend existing type | extend type User { email: String } | Type |