graphql-java / graphql-java/graphql-java

`LightDataFetcher` implementation not getting executed as intended

Open
#3,650 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

keep-open
Dominant language
Java
Stars
6.2k
Forks
1.1k
Avg merge
22m
Merged PRs (30d)
14

Description

Describe the bug
This condition in ExecutionStrategy:invokeDataFetcher():

if (dataFetcher instanceof LightDataFetcher) {

is evaluating to False even if the dataFetcher is actually created by implementing LightDataFetcher interface.

I have tried to debug why it is so, and I found this object being passed as datafetcher to the invokeDataFetcher function which is being evaluated as not a LightDataFetcher:
image

Context
I am creating a LightOperationExecutor as a lightweight alternative to OperationExecutor in GraphQL-SPQR by implementing LightDataFetcher. Open PR #502

To Reproduce
To reproduce, checkout commit 05642488bc and run test in Maven. You should see the tests SchemaTest.testSchema and RelayTest.testRelayMutations produce errors.

Note that even though the commit uses GraphQL-Java 21.3, this is also reproducible on 22.1 (latest), however in this situation we have this datafetcher object,
image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/main/java/graphql/execution/ExecutionStrategy.java at invokeDataFetcher(), focusing on the LightDataFetcher condition and the object passed there. Reproduce the report by checking out commit 05642488bc and running Maven tests, especially SchemaTest.testSchema and RelayTest.testRelayMutations. Done means the reported LightDataFetcher implementation is handled as intended and those tests no longer produce the described errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, java
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.