← GraphQL learning pathGraphQL · Module 2 of 10
Schema and types
Define your data with the Schema Definition Language (SDL).
📖 Key ideas
- type User { id: ID! name: String! posts: [Post!]! }
- Scalars: Int, Float, String, Boolean, ID.
- ! means non-null.
- [Post] is a list of Post.
- Root types: Query, Mutation, Subscription.
💡 Real-life example: The schema is a menu card listing every dish (type) and its ingredients (fields).
SDLSchema Definition Language
ScalarBasic type like Int or String
!Non-null marker
Query typeEntry point for reads