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
}
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
true
orfalse
ornull
and finally a Name must begin with an underscore or a ASCII letter.
© 2022 - 2024 — McMap. All rights reserved.