Lambda Field Resolvers: Add fields from complex childs

Currently, complex fields are not included in the parents variable delivered to the lambda resolver.

This makes it hard (or inefficient because you need to do an extra query from the lambda resolver) if the data from complex types incluences the lambda result.

It would be great if you could add complex fields to your @lambda field directives, e.g. like this:

type Foo {
   id: String! @id
   url: @lambda(include: [owner.username, owner.id])
   owner: User!
}

In my use-case, user files are stored in separate, user-specific directories. The url field should generate a file-URL, but this URL depends on the username.

@graphql any opinion on this?

The question here is of course: How deep can we go? Or is there a better approach to this?

Another proprosal for a fitting directive could be to describe needed fields using graphql syntax (like it is done with @auth directives):

type Foo {
   id: String! @id
   url: @lambda(include: "query{queryFoo{owner{id username }}}")
   owner: User!
}

What do you think? :slight_smile:

3 Likes