hasura / hasura/graphql-engine
Allow more flexible enum values
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Is your proposal related to a problem?
I have an enum table that is also used as a foreign key of another table. It contains BCP47 compliant language code (also known as locales) and example values are: `en-US`, `fr-FR`
I would like to make this table an enum but I get the following error:
```
Inconsistent object: the table "enum_locales" cannot be used as an enum because the values "en-US" and "fr-FR" are not valid GraphQL enum value names
```
### Describe the solution you'd like
It would be good that automatically Hasura could strip invalid characters from enum values, and end up with an enum that looks like this:
```
{
enUs: 'en-US',
frFr: 'fr-FR'
}
```
### Describe alternatives you've considered
I won't be able to use this as an enum and will have to duplicate these values in my code because I won't be able to leverage enum-based code generation.
Contributor guide
Assessment
This issue has not been assessed yet.