atulmy/gql-query-builder

Will not take in multiple types for same variable

Opened this issue · 1 comments

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

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: ......
        }
    }
}