Skip to content
uencoder

GraphQL Schema

A GraphQL schema uses SDL (Schema Definition Language) to define types, queries, mutations, and subscriptions; it is the contract of a GraphQL API.

Purpose

To define a strongly typed contract for a GraphQL API so clients know the available data and operations, enabling automatic validation and code generation.

Mechanism

SDL offers type/enum/input/interface/union/scalar definitions, with type Query/Mutation/Subscription as entry points. Every field declares its return type and arguments, with optional defaults and directives.

Use cases

  • Type contracts for GraphQL APIs
  • Automatic code generation
  • API documentation

Related tools

References