hasura / hasura/graphql-engine
reuse enum types in actions
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
## Current behavior
I have an enum table `userGender` with a correctly set foreign key on table `user` and column `gender`. The generated `insert_user_one` then expects a custom type `userGender_enum`, that's kinda cool and works well with a codegen.
I have also a mutation action `signUp` that accepts the gender of the user on the input and calls (among others) a generated mutation `insert_user_one`. When I want to specify generated `userGender_enum` for the input it won't allow it.
> validation for the given custom types failed because the type "userGender_enum" for field "gender" in input object type "SignUpInput" does not exist
## Expected behavior
I know that in practice, this doesn't matter that much because the underlying foreign key will still check the input. It's definitely nicer for GraphiQL and others to make writing queries for actions easier if they are correctly type-checked.
Unfortunately, it's a problem with the generated typescript code. It causes inconsistency in data type `String` on input (from `SignUpInput`) and data type for inserting users which is based on the enum.
I expect that enum table type can be used in the custom input type for an action.
Contributor guide
Assessment
This issue has not been assessed yet.