Does GraphQL provide an alternative to enum fields like bit fields?
Creating a schema that reflects the status of the element, often leads to the introduction of these attributes, such as { new
, opened
, resolved
, closed
}. Problems arise when a new status is introduced (for example rejected
) because clients don't know how to interpret it. We are considering using a number of boolean fields, so we don't need to introduce a new enum field with a different range of values ββwhen such changes occur. In this case, the rejected status will be presented as
{
closed: true,
rejected: true
}
Is this the preferred enumeration? Is it preferable to define enums with a name that indicates their range, for example statusIncludingRejected
? Is there any other pattern I should find out?
source to share
No one has answered this question yet
See similar questions:
or similar: