Dataloader for attributes that are not at top level does not work

1.3k Views Asked by At

I am using Netflix's DGS framework to build a java graphqQL service. I tried to use the data loader (https://netflix.github.io/dgs/data-loaders/) and it works fine as long as the parent type is a top level attribute (i.e. immediate child of Query).

For example, consider the following schema:

type Person{
  location: Location
  preferences: Preferences
}

type Location {
   x: Int
}

type Preferences {
  typeA: TypeAPreferences
  typeB: TypeBPreferences
}

If I try using a dataloader for a child of a level 1 type it works fine, example:

@DgsData(parentType = "Person" field="location")
public Location loadLocation(DgsDatafetchingEnvironment dfe){
  ... //use data loader here

However if the parent type is not level 1 , the data loader is never invoked (no errors are thrown). Example:

@DgsData(parentType = "Preferences" field="typeA")
public TypeAPreferences loadTypeAPreferences(DgsDatafetchingEnvironment dfe){
... //use data loader here

Wondering if others have been able to make this work successfully and if there is something I am missing here that is causing it not to work?

1

There are 1 best solutions below

0
On

This was just me doing something silly - i had the parent type and field attributes incorrectly filled out.