-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve doc of additionalResolvers sourceArgs #3115
Comments
Thanks for raising this. It would be great if you could contribute to improving the documentation. |
Can you run arbitrary js iside the sourceArgs:
inviteeEmail: "{root.fields.filter(x => x.key === 'email')[0].value}" and if this does not work, is there another way to get the same effect? |
Currently it is not possible. You should write the resolver in code. |
Is it possible to write an additional resolver that runs on the source beforehand so that the value can then be extracted using the |
It is possible to define the required selection set in a programmatic resolver definition. {
SomeType: {
myField: {
selectionSet: /* GraphQL */`
{
fields {
key
value
}
}
`,
resolve: (root, args, context, info) => {
return context.SomeAPI.Query.someField({
args: {
inviteeEmail: root.fields.filter(x => x.key === 'email')[0].value
},
context,
info
})
}
}
}
} |
Is someone here willing to take all the info from this issue and add it to the right place to our docs? |
I am trying this, but For reference, when I used the declarative resolver in the yaml file, everything worked fine. |
Ok so the issue is that the call to |
@cancan101 That helper function is useful for declarative API and programmatic API shouldn't need that. If you provide a working example, we can help you better. |
The issue is that the source nests the data under a key:
so when I call |
I just find out by a random test that's possible to specify a value inside object using the dot notation (
condition.assetId
) in thesourceArgs
inadditionalResolvers
:It would be nice to add this to the doc with at least an example.
I think the documentation is missing a section explaining all the features possible in the yaml file.
As another argument for you to consider the doc improvement: I recently experienced the same random discovery about env in the yaml file: #2986.
The text was updated successfully, but these errors were encountered: