It works, and the result is a set of products that match “kiwi” on name.
If however I try to use this function as a resolver like:
type Product {
name: String!
}
type Query {
getProductsByName3(name: String!): [Product!] @resolver(name: "getProductByName3", paginated: true)
}
And use the following query in the GraphQL console:
{
getProductsByName3(name: "kiwi") {
data {
name
}
}
}
The result is an empty data array, while calling the function in the shell still works. Any ideas on what’s going wrong? And I’m creating this resolver for practice, not gonna use this in production.
Oke I suspect it has something to do with scoping? Using the following user defined functions works as expected. (I’ve replaced the variable to equal with a hardcoded kiwi string)