Enumerations
An enumeration (or enum for short) can be used to group values within a type. Enums can be useful to filter, and define certain content entries in your project.
For example, a product model may contain the enum COMMODITY
, and values Digital
and Physical
.
Enums values can only contain alphanumeric characters, and underscores.
Learn more about Enumerations.
#Fetching enumeration values
You may want to fetch all possible values of an Enum you have created. You can do this via GraphQL using your projects API endpoint.
{__type(name: "COMMODITY") {enumValues {name}}}
#Creating an enumeration
- Navigate to the schema editor in the side-bar.
- If you don't see it, your role does not have access to the schema editor.
- In the collapsible side-bar, next to the label "Enumerations", click the "+ Add" button.
- Provide a display name, API ID and description.
#Adding enumeration values
Enums must begin with a capital letter.
- Add a value in the input of the "Enumeration Values".
- Press the return key or press the "Add to List" button.
- Continue adding more items until the list is complete.
#Removing enumeration values
- Navigate to the Enumeration area of the schema editor.
- Open an enumeration you'd like to edit by pressing the "edit" button below the name of the enumeration you'd like to edit.
- Locate the "-" icon next to the Enumeration pill.
- Press the minus button to remove the Enumeration from the list.
- Press "Update Enumeration".
#Delete an enumeration
- Navigate to the Enumeration area of the schema editor.
- Press the "delete" button below the name of the enumeration you'd like to delete.