atulmy/gql-query-builder

Question: nested variables as object

Closed this issue · 2 comments

Hi, thank you all for the wonderful library,

I have to create a quey as follow:

   "query":"mutation($params:StoreCreateRequest!){
      createStore(params: $params){
       name
      }
   }",
   "variables":{
       "params":{
           "organization_id":"abc-def",
           "name":"my-store",
           "type":"Kafka",
           "uris":["http://ds.io"],
           "availability_zone":"a",
           "secret":{"value":[ { key: "a", value: "b" }] },
           "metadata":{"value":[ { key: "c", value: "d" } ]}
       }
    }


Is it possible to generate it with gql-query-builder?

Many thanks in advance!

@psyCodelist I don't think so - I'm trying something similar and this library keeps freaking out on nested variables

Hi, thank you all for the wonderful library,

I have to create a quey as follow:

   "query":"mutation($params:StoreCreateRequest!){
      createStore(params: $params){
       name
      }
   }",
   "variables":{
       "params":{
           "organization_id":"abc-def",
           "name":"my-store",
           "type":"Kafka",
           "uris":["http://ds.io"],
           "availability_zone":"a",
           "secret":{"value":[ { key: "a", value: "b" }] },
           "metadata":{"value":[ { key: "c", value: "d" } ]}
       }
    }


Is it possible to generate it with gql-query-builder?

Many thanks in advance!

@psyCodelist yes you can, try this

"variables": {
    "params": {
        "value": {
             "organization_id":"abc-def",
             "name":"my-store",
             "type":"Kafka",
             "uris":["http://ds.io"],
             "availability_zone":"a",
             "secret":{"value":[ { key: "a", value: "b" }] },
             "metadata":{"value":[ { key: "c", value: "d" } ]}
        },
        "required": true,
        "type": "StoreCreateRequest"
    }
}