graphql-java icon indicating copy to clipboard operation
graphql-java copied to clipboard

assertException during field resolving on mutation

Open mindgame73 opened this issue 4 years ago • 2 comments

Describe the bug Cannot get ImmediateFields from SelectionSet after class field resolver invoked. It throws AssertException.

However, we are using java.kickstart library to create resolvers, but anyway we have common DataFetchingEnvironment context from graphql.schema package

To Reproduce Please provide a code example or even better a test to reproduce the bug.

public CompletableFuture<Foo> foo(Bar bar, DataFetchingEnvironment env) {
        var fields = env.getSelectionSet().getImmediateFields(); <------ here last method throw it
    }
  1. Create mutation
  2. Add resolver for some field
  3. use DataFetchingEnvironment to get selectionSet and then immediateFields.
  4. you will not see probably anything in the logs, but if you can debug and evaluate expression (if you use intellij idea) and then you will see Exception.

cause = graphql.AssertException: no field with name createFoo found in object ApiQueries

Thank you.

mindgame73 avatar Jun 10 '21 08:06 mindgame73

Can you please outline the schema in play here. We have part of the puzzle but not enough for a reproduction

bbakerman avatar Jul 14 '21 09:07 bbakerman

I write the PR to prove it works for master (post 16.2)

https://github.com/graphql-java/graphql-java/pull/2456

Maybe its broken in 16.2 or below?? Can you give us more versions details and reproduction steps

bbakerman avatar Jul 14 '21 10:07 bbakerman