Schema for GraphQLs
A GraphQL schema is the typed contract between client and server, written in the schema definition language. It declares object types, fields, arguments, enums, inputs and the Query and Mutation entry points. Nullability markers show which fields can be missing, and the schema drives validation, tooling and documentation.
Stage: Basics · Part of the GraphQL roadmap · Last reviewed 19 November 2026
What to learn in Schema
- Define object types, enums and input types in SDL
- Mark fields as non-null with an exclamation mark and justify each choice
- Model a one-to-many relationship between two types
- Explain how GraphQL returns partial data with an errors array
- Use interfaces and unions to describe values of several shapes
Schema interview questions
What does a non-null field mean in GraphQL?
A field marked with an exclamation mark, like name: String!, promises never to return null. If a resolver fails for such a field, the null propagates up to the nearest nullable parent, so overusing non-null can make one failure blank a large part of the response.
When would you use a union instead of an interface?
Use an interface when types share a common set of fields that clients can query directly. Use a union when the possible types have no shared fields, such as a search result that may be a User or a Post, and clients select fields with inline fragments.
Where Schema fits in the GraphQL roadmap
Schema belongs to the Basics stage (beginner level), which takes about 13 hours. Query language.
Other units in this stage
Back to the full GraphQL roadmap