⬡ GraphQL
Beginner
What is a GraphQL schema?
Answer
A GraphQL schema is the blueprint of an API — it defines all the types, fields, and operations available. Written in the Schema Definition Language (SDL), it serves as a contract between the client and server. The schema has three special root types: Query (for reads), Mutation (for writes), and Subscription (for real-time). Every field in the schema has a type, and types can be scalars (String, Int, Float, Boolean, ID) or object types (composed of fields). The schema is strongly typed and self-documenting via introspection. Example: type User { id: ID! name: String! email: String! }. The schema enforces what data can be queried and what operations are valid.