Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
synedra opened this issue Aug 12, 2021 · 2 comments
Open

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

synedra opened this issue Aug 12, 2021 · 2 comments

Comments

@synedra
Copy link

synedra commented Aug 12, 2021

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
Copy link
Author

synedra commented Aug 12, 2021

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

@PieterT2000
Copy link

Any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants