The schema is the contract
A typed schema is what makes tooling, validation and safe evolution possible.
Open this lesson in the learning hubKey points
- Every GraphQL API publishes a schema: the types, their fields, and what is nullable.
String!means non-null;[Order!]!is a non-null list of non-null orders.- The server rejects a query naming a field that does not exist - before running anything.
- That schema powers editor autocomplete, client codegen and introspection for free.
- The trade: the schema is a contract, so removing a field is a breaking change for every client.
Example
type Query {
customer(id: ID!): Customer
orders(status: OrderStatus, first: Int = 20): [Order!]!
}
type Customer {
id: ID!
name: String!
email: String # nullable: may be hidden
orders: [Order!]!
}
enum OrderStatus { PENDING SHIPPED CANCELLED }
The bang is non-null, and its position matters: [Order!]! and [Order]! mean different things.
This is a reading copy. The full lesson — with the visual explainer, the interactive lab and a Run button for the code — lives in the GraphQL Course course, and every lesson in it is listed on the GraphQL Course contents page.