4

In C# it's possible to create an Enum with a Flags Attribute.(https://learn.microsoft.com/en-us/dotnet/api/system.flagsattribute?view=netstandard-2.1) This means that that an Enum can look like this:

[Flags]
enum EnumWithFlags 
{
  None = 0,
  FlagOne = 1,
  FlagTwo = 2,
  FlagThree = 4
}

EnumWithFlags can have a value of 5, which means it will have both FlagThree and FlagOne.

Is this also possible with a Enum inputtype? And is there an example for this?

user8689373
  • 115
  • 1
  • 11

1 Answers1

2

From the Schemas and Types:

Enumerations types are a special kind of scalar that is restricted to a particular set of allowed values.

Basically, you have to define each combination of flags as a separate value if you want it to be an enumeration. A better solution is probably to use a vector, where you can set multiple enum values in a list:

    type Foo {
         flags: [EnumWithFlags]
    }

    enum EnumWithFlags {
         NONE
         FLAG_ONE
         FLAG_TWO
         FLAG_TREE
    }

An update, it has also been answered here