hasura / hasura/graphql-engine

Passing variables between mutations (or queries)

Open
#8,094 2 comments 0 reactions 0 assignees View on GitHub
k/question
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

Hi sorry for the direct question, but I can't seem to find an answer to this anywhere.

I have a GraphQL mutation that creates an item and returns the data that's created. I need to pass some of the created fields into another nested mutation or query. Is this possible? This is almost working but I can't figure out how to get the data between the mutations:

```GraphQL
mutation {
createToken(
input: { tokenname: "my token", tokendescription: "my valuable token" }
) {
id
randomdata
}
insert__helloworld_article(objects: [{randomdata: "Hello" , author_id: 1}]) {
returning {
id
}
}
}
```

So the question is getting "randomdata" from the mutation to insert into the helloworld_article query.

Contributor guide

Open the contributing guide

Research direction

Start by checking whether the shown GraphQL operation can pass createToken's returned randomdata into insert__helloworld_article, then verify the behavior against the project's GraphQL mutation semantics or documentation. Done means a documented yes-or-no answer with a supported operation or an explicit limitation; the issue names no file or test to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.