Adding a resolver with the same parentType as itself #1607
-
I have a data fetcher that returns an EcclesiasticalUnit object. The EcclesiasticalUnit type has fields
The first method works and returns an EcclesiasticalUnit object as expected. However, when either of the other two data fetchers exist in the code, I get an error that says something like:
It seems that it's not recognizing the EcclesiasticalUnit type for some reason. Am I doing something wrong with my configuration? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Maybe check if there are typos and that the type name matches what is
defined in the schema?
…On Mon, Aug 21, 2023 at 9:41 AM Jeffrey Crowley ***@***.***> wrote:
I have a data fetcher that returns an EcclesiasticalUnit object. The
EcclesiasticalUnit type has fields EcclesiasticalUnit parentUnit and List<EcclesiasticalUnit>
childUnits. I'm trying to create two data fetchers that return each of
these pieces of data from my data source, to allow for recursive calling of
the EcclesiasticalUnit type. I've written the following already:
@DgsQuery
public EcclesiasticalUnit ecclesiasticalUnit(DgsDataFetchingEnvironment dfe, @InputArgument Long id) { ... }
@DgsData(parentType = "EcclesiasticalUnit")
public EcclesiasticalUnit parentUnit(DgsDataFetchingEnvironment dfe) { ... }
@DgsData(parentType = "EcclesiasticalUnit")
public List<EcclesiasticalUnit> childUnits(DgsDataFetchingEnvironment dfe) { ... }
The first method works and returns an EcclesiasticalUnit object as
expected. However, when either of the other two data fetchers exist in the
code, I get an error that says something like:
Factory method 'schema' threw exception with message: Parent type EcclesiasticalUnit not found, but it was referenced on com.netflix.graphql.dgs.internal.DgsSchemaProvider in @DgsData annotation for field parentUnit
It seems that it's not recognizing the EcclesiasticalUnit type for some
reason. Am I doing something wrong with my configuration?
—
Reply to this email directly, view it on GitHub
<#1607>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJ5JPXLE2TVCQCB7DTU67ZTXWOFTLANCNFSM6AAAAAA3YU6OFQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I just tried this scenario and it works fine for the schema below:
With data fetchers defined as
I think this is the scenario you have above and it works as expected. You could try running through a debugger to see what's going on with the data fetching. |
Beta Was this translation helpful? Give feedback.
-
After looking further into the issue, I realized that there was a problem with the specific implementation that I'm using. It ended up being unrelated to the fact that it was the same type as its parent. Thank you for the responses! |
Beta Was this translation helpful? Give feedback.
I just tried this scenario and it works fine for the schema below:
With data fetchers defined as