⬡ GraphQL
Beginner
What is the GraphQL Schema Definition Language (SDL)?
Answer
The Schema Definition Language (SDL) is the human-readable syntax for writing GraphQL schemas. It is language-agnostic and used to describe the type system. Key constructs: type TypeName { field: Type } (object type), interface InterfaceName { field: Type }, union UnionName = TypeA | TypeB, enum EnumName { VALUE1 VALUE2 }, input InputName { field: Type } (for mutation arguments), scalar CustomScalar, directive @directiveName on FIELD_DEFINITION. Comments use # (inline) or triple-quote strings """Description""" for documentation. The SDL is used by tools like Apollo Studio, GraphiQL, and code generators to provide documentation, type checking, and client code generation.