Mutation raises Error Field Selections
andrewgryan opened this issue · comments
Minimal, almost Hello, World! code snippet that reproduces the error. I've installed using install.packages
and devtools::install_github
and it fails in the same way for both.
library(magrittr)
library(gqlr)
"
type Query {
votes: Int!
}
type Mutation {
castVote: Int!
}
schema {
query: Query
mutation: Mutation
}
" %>%
gqlr_schema(
Query = function(...) {
list(votes = function(...) {
3
})
},
Mutation = function(...) {
list(castVote = function(...) {
42
})
}
) ->
example_schema
do <- function() {
"
mutation Cast {
castVote
}
" %>%
execute_request(example_schema)
}
I'm trying to migrate from basic query syntax to supporting mutation operations. I've tried to create a minimal example that raises the error. The idea behind the example is to have a voting system that supports casing votes as well as reading the existing votes. For simplicity here I've omitted the Vote
, VoteInput
etc. types that a real system would use, instead I'm using Int
.
> do()
Error: 5.2.1: Field Selections on Objects, Interfaces, and Unions Types
not all requested names are found. missing field: 'castVote' for object: 'Query'
Location: 3:3 to 3:11
Error String: 'castVote'
{
"data": null,
"errors": [
{
"message": "5.2.1: Field Selections on Objects, Interfaces, and Unions Types\nnot all requested names are found. missing field: 'castVote' for object: 'Query'\nLocation: 3:3 to 3:11\nError String: 'castVote'"
}
]
}
@schloerke I'm happy to submit a PR for this if you can point me at a place in the code that handles mutation requests?
👀 ; Thank you for the great reprex!