`Hi guys, ive got a problem with runnin my graphql mutation due to the following error:
`"errors": [
{
"message": "Unknown type "GenderInput".",
"locations": [
{
"line": 1,
"column": 37
}
],
"extensions": {
"code": "GRAPHQL_VALIDATION_FAILED",
"stacktrace": [
"GraphQLError: Unknown type "GenderInput".",`
I have not had this problem until I have created a custom input type, GenerInput.
This is my frontend mutation
`export const CALCULATE_CALORIES = gql`
mutation calculateCalories(
$gender: GenderInput!
$weight: String!
$activityLevel: Float!
$goal: GoalInput!
$user_id: String!
) {
calculateCalories(
gender: $gender
weight: $weight
activityLevel: $activityLevel
goal: $goal
user_id: $user_id
)
}
`;`
and this is my TypeDefinitions File in the Backend. From the schema ive provided, it seems to me that GenderInput is defined correctly but i still get this error. I have tried restarting Apollo server but it doesnt seem to fix the issue.
`export const typeDefsWorkout = `#graphql
type exercise {
id: ID!
name: String!
muscletrained: String
user_id: String!
}
type component {
component_id: ID!
repetitions: Int!
sets: Int!
exercise_id: ID!
}
type userComponent {
component_id: ID!
repetitions: Int!
sets: Int!
exercise_id: ID!
user_id: String!
}
type WorkoutComponent {
component_id: ID!
repetitions: Int!
sets: Int!
name: String!
}
type WorkoutComponents {
component_id: ID!
repetitions: Int!
sets: Int!
name: String!
}
type User{
user_id: ID!
email: String!
password: String!
first_name: String!
last_name: String!
}
input GenderInput{
label: String!
value: String!
}
input GoalInput{
label: String!
v`alue: String!
}
type Goal{
label: ID!
goal: String!
}
type Query {
exerciseComponents: [WorkoutComponent!]!
exerciseComponentsUser(user_id: String!): [WorkoutComponent]!
userExercises(user_id: String!): [exercise]!
exercises: [exercise!]!
exercise(id: ID!): exercise
login(email: String!, password: String!): User
getGoals: [Goal!]!
}
type Mutation {
createUser(email: String!, password: String!, first_name: String!, last_name: String!): User!
calculateCalories(gender: GenderInput!, weight: String!, activityLevel: Float!, goal: GoalInput!, user_id: String!): Float!
createExercise(name: String!, muscletrained: String!, user_id: String!): exercise!
deleteExercise(id: ID!): ID
deleteComponent(component_id: ID!): ID
createComponent(repetitions: Int!, sets: Int!, exercise_id: ID!): component!
createComponentUser(repetitions: Int!, sets: Int!, exercise_id: ID!, user_id: String!): userComponent!
deleteComponentUser(component_id: ID!): ID
}
`;`
Everything worked fine until i made a custom type as the input (GenderInput). Any help would be appricated .