Skip to content

Is there a way to trigger data fetcher if a specific field is requested irrespective of it's parent #532

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

You must be logged in to vote

I might be misunderstanding the question. But here's an attempt at an answer. You can just define the datafetcher for fromA on either the interface type or the concrete types.

@DgsData(parentType="SourceInformation")
public String fromA() {

}

This would define a single datafetcher that works for both One and Two. Alternatively you can create the datafetcher for the implementing type explicitly:

@DgsData(parentType="One")
public String fromA() {

}

@DgsData(parentType="Two")
public String fromA() {

}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by arunnaparna
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