Define JavaScript mutation functions and add them as resolvers in your JS source code
@lambda
directive.
For example, to define a lambda function for the rank
and bio
fields in
Author
:
@lambda
fields on interfaces, as follows:
addGraphQLResolvers
or addMultiParentGraphQLResolvers
methods.
parents
, parent
, dql
,
or graphql
inside the function.parent
for the resolver function. You can find additional
resolver examples using dql
in the Lambda queries article, and
using graphql
in the Lambda mutations article.Author
Character
Human
Droid
rank
using a graphql
call, as
follows:
true
if the custom claim for USER
from the JWT matches the id
of the
Author
.
Character
interface:
Human
and Droid
types inherit the bio
lambda field from the
Character
interface.queryHuman
query with a selection set containing
bio
, then the lambda function registered for Human.bio
is executed, as
follows: