GraphQL Schema Definition Cheatsheet

Quick reference for GraphQL schema types, inputs, enums, interfaces, unions, scalars, directives, and schema operations.

ItemDescriptionExampleCategory
typeDefine object typetype User { id: ID! name: String! }Type
inputDefine input object typeinput UserInput { name: String! age: Int }Input
enumDefine enumenum Role { ADMIN USER GUEST }Enum
interfaceDefine interface for typesinterface Node { id: ID! }Interface
implementsType implements interfacetype User implements Node { id: ID! name: String! }Interface
unionUnion of multiple typesunion SearchResult = User | Post | CommentUnion
scalarCustom scalar typescalar DateTimeScalar
@deprecatedMark field as deprecatedtype User { oldField: String @deprecated(reason: "Use newField") }Directive
@include / @skipConditional field inclusion (runtime)type User { name: String @include(if: $showName) }Directive
schemaDefine root operationsschema { query: Query mutation: Mutation }Type
extendExtend existing typeextend type User { email: String }Type