rmosolgo / graphql-ruby

Ruby implementation of GraphQL
http://graphql-ruby.org
MIT License
5.38k stars 1.39k forks source link

Directive definition support #3143

Closed myronmarston closed 3 years ago

myronmarston commented 4 years ago

We've been using directives pretty heavily in our SDL files. Unfortunately, graphql-ruby seems to gladly accept any typo in any directive name or in any directive arg, because it does not seem to support a way to define directives. The GraphQL schema has examples for this, such as:

directive @example on FIELD

This defines @example as a directive, which is only valid on fields. Many other GraphQL implementations use these to reject any undefined directives, or directives defined on the wrong element type, etc.

Is there a plan to add support for this to graphql-ruby at some point?

rmosolgo commented 4 years ago

a plan

There's not exactly a plan, but I'm hoping to improve directive support in 1.12. I've added this issue to the tracking issue! I agree it'd be a nice improvement.

rmosolgo commented 3 years ago

I recently released 1.12.0 which includes a "schema directives" system, please give it a try and open a new issue if you run into any trouble with it!

https://graphql-ruby.org/type_definitions/directives.html#schema-directives