⬡ GraphQL Beginner

What are GraphQL types?

Answer

GraphQL has a rich type system. Scalar types (leaf values): String, Int (32-bit signed), Float (64-bit), Boolean, ID (string representation of a unique identifier). Object types: custom types with fields: type Post { id: ID! title: String! }. Query/Mutation/Subscription: special root object types. Input types: object types used as arguments (not returned): input CreateUserInput { name: String! email: String! }. Enum types: fixed value sets: enum Status { ACTIVE INACTIVE BANNED }. Interface types: abstract shared fields. Union types: a field that can return multiple types. List types: [String]. Non-null modifier: ! — e.g., String! means the field can never return null.