I was trying to create an enum type with Int value in GraphQL schema but failed. I might miss something in the doc. Anyone has any idea about how to implement Int value in the enum type like below?
enum IntValue {
1
2
3
}
You could declare something like
enum IntValue { _1 _2 _3 }
enum IntName { ONE TWO THREE }
but in both cases those enumerated values would be different from the numbers 1, 2, 3.
You can't declare something that looks like an enum but contains actual numbers. In the specification, an EnumTypeDefinition contains a list of EnumValueDefinition, each of which contains a single EnumValue; each value is
Name but not
trueorfalseornull
and finally a Name must begin with an underscore or a ASCII letter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With