Search⌘ K
AI Features

Enumeration Types

Explore how to implement enumeration types in GraphQL schemas to restrict fields to specific allowed values. Understand their role in type validation and how to define and test enums using Apollo Server and Node.js.

Enumeration types, or enums, are special scalars restricted to a particular set of allowed values. Enumeration types allow us to do the following:

  • Validate that the arguments of a type are one of the allowed values.

  • Convey through the type system that a field will always be one of a finite set of values.

Here’s what an enum definition may look like in ...