March 2018
Intermediate to advanced
304 pages
6h 59m
English
A GraphQL enumeration (or enum, as it’s generally called) is a special type of scalar that has a defined, finite set of possible values. Here are some examples of values that are well represented by enums:
Enums are a good choice if the possible values are well defined and unlikely to change, if those values are short (one or maybe two words long), and if they’re not a pair of values that are more clearly represented by a boolean flag.
Let’s use the ASC and DESC ordering example for a list of menu items that we’ll allow users to retrieve in ascending or descending order.
We’ll start by adding our enum type, :sort_order
Read now
Unlock full access