Hygraph
Docs

#Lesson 3 - Enumerations

This section covers creating the enumerations the product variant components depend on.

An enumeration defines a fixed set of allowed values at the schema level. The enumerations configured here, Clothes size, Shoes size, Wearable items color, and Decor items color, power the size and color dropdowns in the content editor in later lessons. They need to exist in the schema before the components that use them can be built.

#How enumerations work

An enumeration defines a fixed set of allowed values for a field. When a field is typed to an enumeration, the API enforces the allowed values at the schema level. A product entry cannot be published with a color value of "navy" if the enumeration only contains Red, Green, Blue, Black, and White.

This is different from a free-text field, where any value is accepted, and different from a reference, where values are editor-managed content entries. Use an enumeration when the set of valid values is fixed, controlled by the schema owner, and unlikely to be extended by editors. Learn more about enumerations.

#Lessons in this section

LessonWhat you will do
3.1 Configure enumerationsCreate enumerations for product size and color values that the product variant components will use

#What's next

Lesson 3.1 - Configure enumerations

Or, go to the Tutorial overview for the full lesson list.