vektah / dataloaden

go generate based DataLoader
MIT License
528 stars 79 forks source link

Pass fields collection from context to Dataloader #48

Closed mariosttass closed 4 years ago

mariosttass commented 4 years ago

What happened?

The target is to pass field collection context GetOperationContext into the Dataloader. In the resolvers we are passing the context into the retriever but it doesn't contain the the info that we need to get the fields of the query on that level. So I tried to change that on the Middleware layer but without hope. Do you know if there is a way to pass that context on the Dataloaders ? FYI the error happen when I try to pass the field collection of the nested model in Dataloader, panic missing operation context

What did you expect?

When I was passing the context in the resolver I was expecting that I will have all the info to get the fields and use GetOperationContext to get them and pass them in Dataloader.

Minimal graphql.schema and models to reproduce


  rootQuery(
    name: ["Alex"]) {
    name
    email
    tel
    ProductsInfo{
      id
      name
      description
    }
  }
}
mariosttass commented 4 years ago

I am closing it because is more related to gqlgen framework.