GraphQL スキーマ 定義 リファレンス
リファレンス 用 GraphQL スキーマ language: 型, インターフェース, unions, enums, および directives.
Type System
GraphQL schemas define object types with fields, each having a type and optional arguments. Scalar types (Int, Float, String, Boolean, ID) are built-in; custom scalars can be declared. Interfaces define contracts that object types implement. Unions allow fields to return one of several types. Enums restrict fields to a set of named values. Input types structure mutation arguments.
- object type
- Fields with types
- interface
- Contract for objects
- union
- One of several types
type User { id: ID! } implements Node union Result = User | Error Schema Elements
The Query, Mutation, and Subscription root types define entry points. Field arguments can have default values and be required (suffix !). List types use [Type] syntax. Directives (prefixed @) annotate fields for validation, caching, or deprecation. Schema directives can be custom-defined. The introspection system allows querying the schema itself. SDL (Schema Definition Language) is the human-readable format.
- root types
- Query, Mutation, Subscription
- !
- Non-null marker
- directives
- @-prefixed annotations
entry points required field/arg @deprecated, @cache