reuse enum types in actions
See original GitHub issueCurrent 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.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:37
- Comments:5 (2 by maintainers)
Up If we can use enum tables as the source of truth for actions then we can reduce a lot of manual code. Currently, we are using enum tables as a source of truth in both frontend and backend with help of graphql-codegen
Up