quiz icon indicating copy to clipboard operation
quiz copied to clipboard

Is it possible to send graphql variables, like the input objects for mutations?

Open x0y-gt opened this issue 4 years ago • 1 comments

How can I accomplish this?

The query:

mutation user($user: CreateUserInput!) {
  createUser(input: $user) {
    user {
      id
      name
      email
    }
  }
}

And send the variables as an input obj:

{
  "user": {
    "name": "Sebas",
    "email": "bla@test...",
    "birthdate": "2001-01-01"
  }
}

x0y-gt avatar Mar 09 '20 10:03 x0y-gt

Hi @x0y-gt thanks for creating this issue.

Variables and mutations are not yet supported. Also not yet in the upcoming release. It is on the backlog of course, but will take some time to be included.

Currently, it is possible to use variables in the Python code creating the queries, for example:

repo_name = "Hello-World"
schema.query[
  _
  .repository(owner='octocat', name=repo_name) [
    _
    .createdAt
  ]
]

The next release should smooth out some issues with input objects as well. Let me know if you run into other issues :).

ariebovenberg avatar Mar 09 '20 11:03 ariebovenberg