garph
garph copied to clipboard
Directives
Add support for specifying and implementing GraphQL directives in Garph
Example:
const d = g.directive('Name', { param: g.string() }, ['FIELD', 'ARGUMENT'])
g.type('Query', {
test: g.string()
.args({
test: g.string().addDirective(d, { param: 'Hello' })
})
.addDirective(d, { param: 'Hello' })
})
.addDirective(d, { param: 'Hello' })
+1 for Directives. Want to add isAuthenticated to my schema.
Thanks, @danstarns. I will add some more details to the details
Hey @danstarns, I've updated the issue. Could you take a look and tell me what you think?
I'm also curious about the use-case for directives. What are people are using them for? Are they used on client-side when making requests?
Here is a relevant issue, with a lot of resources on how directives are used:
https://github.com/gqty-dev/gqty/issues/448
@danstarns Would you rather use middleware/plugins instead of directives?