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

Custom Directives #86

Open
Sherlouk opened this issue Sep 17, 2022 · 2 comments
Open

Custom Directives #86

Sherlouk opened this issue Sep 17, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@Sherlouk
Copy link
Contributor

This is probably one of those features which needs adopting at both the Graphiti level and in Pioneer but it would be awesome if we could create our own directives.

The most obvious and helpful one would be some form of Auth directive documented here. This could feed into Vapor's authentication solution to allow us to only return certain types or fields if the user is authenticated to view them.

This is kind of possible loosely with the validation rules released in #72, however that has a couple flaws:

  1. The rules are not made fully transparent to the end user which could cause them to make requests they're not eligible unintentionally and cause confusion
  2. An error thrown in a validation rule will prevent any of the request from being made. It would be nice if, for example, the user requested 5 fields and only one of them was protected to still return the other 4.
@Sherlouk Sherlouk added the enhancement New feature or request label Sep 17, 2022
@d-exclaimation
Copy link
Owner

I'll look into this and see what I can do on both Pioneer and Graphiti level

@Sherlouk
Copy link
Contributor Author

This could also feed into cost analysis by attributing a directive to a type or field it would indicate elegantly how much each type costs.

Type() {

}
.description("")
.directive(AuthDirective(...))
.directive(CostDirective(...))

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

No branches or pull requests

2 participants