0Pricing
GraphQL APIs with Spring Boot · Lesson

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

  1. Modeling Nested Objects & Relationships
  2. Implementing Interfaces and Union Types
  3. Leveraging Input Types for Mutations
  4. Enums and Custom Scalar Types
← Back to GraphQL APIs with Spring Boot