graphql-spec icon indicating copy to clipboard operation
graphql-spec copied to clipboard

allow directives on directive definitions

Open benhead opened this issue 5 years ago • 3 comments

This is the minimum viable edit to enable this feature. I imagine we'd also want to allow directive extensions if this feature is approved.

#566

benhead avatar Feb 28 '19 17:02 benhead

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

facebook-github-bot avatar Feb 28 '19 17:02 facebook-github-bot

Original feature request:

We'd like to be able to declare directives on directive definitions.

We have tooling that uses type system directives to perform special processing on a schema, and we'd like users of that tooling to be able to define their own directives, with metadata indicating to the tooling that this directive is for its use. For example, if we could define directive @Handler(class:String!) on DIRECTIVE_DEFINITION then our users could define directive @CustomDirective(...) on FIELD_DEFINITION @Handler(class:"Foo") telling our tooling that their directive is meant to be handled by it, passing arguments we declare to our tooling, and still providing whatever arguments they declare to their own hooks.

That directives can't be declared on directive definitions seems like an oversight.

Please note that I'm a Googler and we're reviewing that we can sign the CLA. I don't anticipate a problem, but bear it in mind until we confirm.

benhead avatar Feb 28 '19 18:02 benhead

I would like to another use case that requires this change that might be a bit more common: Deprecation of directives.

directive @foo on OBJECT @deprecated

spawnia avatar Sep 23 '19 18:09 spawnia