Enums and Custom Scalar Types
Extend your GraphQL schema beyond the built-in types by defining enums for fixed value sets and custom scalars for domain types like dates and URLs in Spring Boot.
Beyond Built-in Types
GraphQL ships with scalars like Int, String, and Boolean. But real domains need more: a fixed set of statuses, a proper date type, or a validated email.
Enums and custom scalars let your schema express these precisely.
What Is a GraphQL Enum?
An enum restricts a field to a fixed list of named values. Clients can only send or receive one of those values, and tooling can offer autocompletion.
enum OrderStatus {
PENDING
SHIPPED
DELIVERED
CANCELLED
}All lessons in this course
- Modeling Nested Objects & Relationships
- Implementing Interfaces and Union Types
- Leveraging Input Types for Mutations
- Enums and Custom Scalar Types