[GH-ISSUE #84] Will not take in multiple types for same variable #51

Open
opened 2026-03-03 00:02:59 +03:00 by kerem · 1 comment
Owner

Originally created by @Rajin-Bains on GitHub (Aug 21, 2023).
Original GitHub issue: https://github.com/atulmy/gql-query-builder/issues/84

I am trying to run GQL query that takes in the "where" variable but it takes them in twice. Each time it is a different type. When I run the query it doesnt recongnize the type of the second where and returns type mismatch.

image

Originally created by @Rajin-Bains on GitHub (Aug 21, 2023). Original GitHub issue: https://github.com/atulmy/gql-query-builder/issues/84 I am trying to run GQL query that takes in the "where" variable but it takes them in twice. Each time it is a different type. When I run the query it doesnt recongnize the type of the second where and returns type mismatch. ![image](https://github.com/atulmy/gql-query-builder/assets/142831672/bbff3b9f-5b07-486b-b360-01cb4ecfac2a)
Author
Owner

@SadScream commented on GitHub (Aug 31, 2023):

In your fragment "where" is just an alias for variable and the problem is that operations telcoActivationStatusPending and subscriptionStatusSuccess have conflicts, because they both trying to use variable "where" and subscriptionStatusSuccess redifines type of this variable. To solve this you should just rename this alias so that there is no name conflict.
For example, you can do it like this

{
    operation: 'telcoActivationStatusPending',
    variables: {
        'where_telcoActivationStatusPending': { // here is solution, it's name(alias) of variable
            name: 'where', // name of the filter
            type: '......',
            value: .....
        }
    }
},
{
    operation: 'subscriptionStatusSuccess',
    variables: {
        'where_subscriptionStatusSuccess': {
            name: 'where',
            type: '......',
            value: ......
        }
    }
}
<!-- gh-comment-id:1700411607 --> @SadScream commented on GitHub (Aug 31, 2023): In your fragment "where" is just an alias for variable and the problem is that operations `telcoActivationStatusPending` and `subscriptionStatusSuccess` have conflicts, because they both trying to use variable "where" and `subscriptionStatusSuccess` redifines type of this variable. To solve this you should just rename this alias so that there is no name conflict. For example, you can do it like this ``` { operation: 'telcoActivationStatusPending', variables: { 'where_telcoActivationStatusPending': { // here is solution, it's name(alias) of variable name: 'where', // name of the filter type: '......', value: ..... } } }, { operation: 'subscriptionStatusSuccess', variables: { 'where_subscriptionStatusSuccess': { name: 'where', type: '......', value: ...... } } } ```
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#51
No description provided.