Is there a way to make a GrapqhQL variable in a Postman request "optional"? So if the value is empty/NULL the field is just not included in the request?
For example, if I have the following request:
mutation addCustomer($CustomerInput: CustomerInput!)
{
addCustomer(
input: $CustomerInput
)
{
firstName
lastName
}
}
And I have the GrapqhQL variables defined as:
{
"CustomerInput": {
"firstName": {{firstName}},
"lastName": {{lastName}}
}
}
If firstName is not a required field, how can I only include it if it has a value? Right now I am getting this error:
com.fasterxml.jackson.databind.JsonMappingException: Unexpected character ('{' (code 123)): was expecting double-quote to start field name