Accessing Root Object Nested objects #1599
Replies: 1 comment
-
No, you can't access sibilings in GraphQL field resolvers. The required data has to be available in |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am wondering if it is possible to access the root object's nested types within a custom field resolver. For example, I have the following field resolver:
@FieldResolver(() => Int || null, { nullable: true }) async daysBehind( @Root() parent: Part, @Arg("bomId") bomId: number ): Promise<number | null> {
When I console.log the parent variable, I only see the scalar fields associated with the Part type. However, the part type has several nested non-scalar types that I would like to be able to access within my custom field resolver. Is there a way to do something like parent.nestedField to access that nested object, or is this not possible?
Beta Was this translation helpful? Give feedback.
All reactions