[GH-ISSUE #23] handling undefined datatype #110

Closed
opened 2026-03-15 11:31:40 +03:00 by kerem · 1 comment
Owner

Originally created by @derit on GitHub (Aug 23, 2019).
Original GitHub issue: https://github.com/atulmy/gql-query-builder/issues/23

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

Originally created by @derit on GitHub (Aug 23, 2019). Original GitHub issue: https://github.com/atulmy/gql-query-builder/issues/23 when variable is undefined return a error how to handling this error ?
kerem closed this issue 2026-03-15 11:31:45 +03:00
Author
Owner

@ARHariri commented on GitHub (Apr 1, 2020):

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.

<!-- gh-comment-id:607353221 --> @ARHariri commented on GitHub (Apr 1, 2020): 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.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/gql-query-builder#110
No description provided.