Skip to content

Data fetcher not being invoked, query fails with non-null field is null #648

Answered by paulbakker
shuston asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @shuston, the reason is that your items datafetcher was missing the public keyword.
This works:

@DgsData(parentType = "DefinedGroup", field = "items")
	public 	List<ItemRange> items(DgsDataFetchingEnvironment dfe) {
		DefinedGroup group = dfe.getSource();
		return groupService.findItemsForGroup(group.getLabel());
	}

I have to admit that it took me quite a bit of head-scratching to find this, it's really not obvious. I wasn't really aware the public is required, and nobody has complained so far. I'll create an issue to fix this.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@shuston
Comment options

Answer selected by shuston
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants