graphql-tag icon indicating copy to clipboard operation
graphql-tag copied to clipboard

Is it possible to create a gql document from an existing variable?

Open synedra opened this issue 3 years ago • 2 comments

I want people to be able to put graphql queries into a text box and then run those queries against the GraphQL server.

So I have this: let mutation = await astra.getQuery();

and then I want to do this: astra.client.mutate(mutation: gql{mutation})

Or some such. Any way to do this?

synedra avatar Aug 12 '21 19:08 synedra

I got this far: let mutation = await astra.getQuery(); console.log(mutation) console.log(gql([mutation]))

Neither works. The string is:

mutation createTables { cavemen: createTable( keyspaceName: "workshop", tableName: "cavemen", partitionKeys: [{name: "lastname", type: {basic: TEXT}}], clusteringKeys: [{name: "firstname", type: {basic: TEXT}}], values: [ { name: "occupation", type: {basic: TEXT} } ] )}

It works fine when I pass it explicitly but I need the user to be able to copy/paste

synedra avatar Aug 12 '21 23:08 synedra

Any updates on this?

PieterT2000 avatar Oct 20 '23 19:10 PieterT2000