graphql-go / graphql-go/graphql
Possible issue with apollo client query with variables
- Dominant language
- Go
- Stars
- 10.1k
- Forks
- 845
- PR merge metrics
- No merged PRs in 30d
Description
With query handler:
```
var RootQuery = graphql.NewObject(graphql.ObjectConfig{
Name: "RootQuery",
Description: "A detailed options for querying scrous api. Feel free to navigate for each option.",
Fields: graphql.Fields{
"contacts": &graphql.Field{
Type: graphql.NewList(types.UserType),
Description: "Retrieves all contacts",
Args: graphql.FieldConfigArgument{
"group_id": &graphql.ArgumentConfig{
Description: "Group id",
Type: graphql.String,
},
},
Resolve: func(params graphql.ResolveParams) (interface{}, error) {
return resolvers.Contacts(params)
},
},
},
},
})
```
Apollo request:
```
query {
contacts(group_id: "123") {
fullname
photo
birthdate
gender
}
}
```
send post request:
"{ contacts(group_id: "123") { fullname photo birthdate gender __typename }}"
and works fine, but if use variables:
```
query contacts($group_id: String) {
contacts(group_id: $group_id) {
fullname
photo
birthdate
gender
}
}
```
send post request:
"query contacts($group_id: String) { contacts(group_id: $group_id) { fullname photo birthdate gender __typename }}"
and return Error: GraphQL error: Unknown type "String"
Contributor guide
Assessment
This issue has not been assessed yet.