Lambda resolver does not fire when defined at interface level

Report a GraphQL Bug

What edition and version of Dgraph are you using?

Edition:

  • SlashGraphQL
  • [X ] Dgraph (community edition/Dgraph Cloud)

Steps to reproduce the issue (paste the query/schema if possible)

Create this schema:

interface Item {
id: ID
itemType: String! @lambda
}

type Toy implements Item {
color: String
shape: String
}

and create a lambda like this one:

self.addGraphQLResolvers({
    "Item.itemType":  "hello"
    //"Toy.itemType": "hello",
})

Then run an addToy() Mutation and try to read itemType

Expected behaviour and actual result.

The generic resolver Item.itemType should be able to work, but it does not.
If you uncomment Toy.itemType and comment the other one then it works


Also, a bit unrelated to the issue itself but is how i got here:

How can we get the type of the element that fired the resolver? There is no Info object, so if we want to do a generic resolver for example that sets the name of the type as the value, we can’t

For example lets say I want itemType to be the name of the type that fired the resolver. If i can set the resolver at the interface level i won’t need to change the lambda never, even if I keep adding other types that implement this case.

in the current state i will b forced to add a line each time i create a new type that implements Item :thinking: