Skip to content
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

Directives #40

Open
mishushakov opened this issue Mar 9, 2023 · 5 comments
Open

Directives #40

mishushakov opened this issue Mar 9, 2023 · 5 comments

Comments

@mishushakov
Copy link
Member

mishushakov commented Mar 9, 2023

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' })
@danstarns
Copy link

+1 for Directives. Want to add isAuthenticated to my schema.

@mishushakov
Copy link
Member Author

Thanks, @danstarns. I will add some more details to the details

@mishushakov
Copy link
Member Author

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?

@redbar0n
Copy link

Here is a relevant issue, with a lot of resources on how directives are used:

gqty-dev/gqty#448

@mishushakov
Copy link
Member Author

@danstarns Would you rather use middleware/plugins instead of directives?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants