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?

0


source to share





All Articles