Working with my graphQL API using typescript and type-graphql, I am attempting to perform a mutation that has an inputType with an enum value defined as shown below
export enum GenderType {
female = 'female',
male = 'male',
}
registerEnumType(GenderType, {
name: 'GenderType',
});
I am trying to execute this mutation:
mutation {
registerStudent(data: {
name: "John",
gender: "male",
}) {
id
}
}
However, when attempting to run the mutation, it generates an error message saying:
"message": "Enum "GenderType" cannot represent non-enum value: "female". Did you mean the enum value "female" or "male"?",
I believe this is due to how I defined the enum type using registerEnumType in type-graphql.
Can someone explain how to define an enum with type-graphql?