I am using postgraphile (A library that wraps your Postgres database with GraphQL api), and I have some enums in Hebrew.
As written in GraphQL Specification, Enum Values must be Names - which are limited to the ASCII subset with this regexp:
/[_A-Za-z][_0-9A-Za-z]*/
I want to use the Postgres enum type in order to have validation on my enum columns. Postgraphile converts Postgres Enums to GraphQLEnum type and it causes an error when the value isn't in the Name standard mentioned above (because some enums are in Hebrew).
How would you use enum values in a different language?
As you've stated, currently the GraphQL specification only allows for enum values that match the Name
regexp:
EnumValue
::Name
but nottrue
, orfalse
ornull
-- https://facebook.github.io/graphql/draft/#sec-Enum-Value
Name
::/[_A-Za-z][_0-9A-Za-z]*/
I think the desire to express enums in other languages is compelling; I suggest that you help to formulate a proposal to address these concerns in the GraphQL specification itself, which you can do at the GraphQL specification repository on GitHub. There's already an issue open about this topic which you could contribute your insights to:
https://github.com/facebook/graphql/issues/256
With care (and using resources like UAX#31) it may be possible to extend GraphQL's syntax to enable multi-lingual identifiers without needing to resort to an approach such as "punycode".