graphql-go / graphql-go/graphql
On mutation, should be added binding variables dynamically using placeholder
- Dominant language
- Go
- Stars
- 10.1k
- Forks
- 845
- PR merge metrics
- No merged PRs in 30d
Description
In the apollo documentation, you would have mutation:
```this.$apollo.mutate({
// Query
mutation: gql`mutation ($label: String!) {
addTag(label: $label) {
id
label
}
}`,
// Parameters
variables: {
label: newTag,
},
```
I really like the library but it is missing the critical thing which is you having to bind fields in graphql which is a real problem if we work with entities that have many fields.
Look at this example from the docs:
```
curl \-X POST \-H "Content-Type: application/json" \--data '{ "query": "mutation { createTodo(text:\"My New todo\") { id text done } }" }' \http://localhost:8080/graphql
```
I prefer my graphql calls to be POST calls, and to bind text inside the mutation, instead of just having in the payload body just like this:
```
{
"query": "mutation{ createTODO(input: $input) {id text done } }",
"variables": { "input": { "text":"My New todo" }}
}
```
Apollo for example would be creating a similar request to this one I proposed.
This is an amazing library if you ask me and I would really like this feature to ease my client side development
Contributor guide
Assessment
This issue has not been assessed yet.