I have defined a mutation like below with email field marked as mandatory
type Mutation {
bookTicket (person: PersonInput! ,email: String!): Ticket
}
input PersonInput{
personId: ID!
name: String!
date: String!
comment: String
}
When I try to execute the mutation through GraphIQl UI withou passing email field the UI doesn't throw validation error and the calls the endpoint with empty value for the email field .
mutation($personInput:PersonInput!, $email :String!){
bookTicket(person:$personInput,email: $email){
id
}
}
Variables
{
"personInput": {
"personId": "111",
"name": "test",
"date": "10-Oct-2018",
"comment": "Book"
}
}
If I try to run the mutation with inline variables the validation works fine and shows exception that email cannot be empty .
mutation{
bookTicket(person:{personId: "111", name: "test", date: "10-Oct-
2018",comment: "Book"}
email:""){
id
}
}
Can anyone help me on why the validation doesn't work in the first case ?