QuickDevGuide

Home › GraphQL & gRPC

GraphQL Schema & Type System — GraphQL & gRPC

The schema (written in SDL) is the contract between client and server. Everything a client can ask for is typed. Kind Example Scalars Int, Float, String, Boolean, ID, custom scalar DateTime Object type type User { id: ID!, name: String! } Non-null / list String!, [Post!]! (non-null list of non-null posts) Enum enum Role { ADMIN EDITOR VIEWER } Interface shared fields: interface Node { id: ID! } Union union SearchResult = User \ Post Input type arguments for mutations: input CreatePostInput { ... } Root types Query, Mutation, Subscription Design tips Model the domain graph, not your database tables. Make fields nullable by default unless you can always return them — one failing non-null field nulls its whole parent. Use connections (edges, node, pageInfo, cursor) for paginated lists…

Key Takeaways