atulmy/gql-query-builder

handling undefined datatype

derit opened this issue · 1 comments

derit commented

when variable is undefined return a error
how to handling this error ?

When you set a variable to an undefined like this

  variables: {
    email: undefined
  }

you get an error because the generator cannot infer the type of variable to set it. But when you assign your variable by an object value and set the value property to an undefined, like this

  variables: {
    email: { value: undefined }
  }

you have not got an error whether you set type property or not (The default type is String)

For now, you have to use the second format to set your variables (if some of the variables may be undefined). But I think the difference between these behaviors is incorrect and has to be fixed.