Confusing documentation for plugins
rex-remind101 opened this issue · 1 comments
Describe the bug
There is a hint of documentation about writing Plugin but no detailed description of what interface or class to inherit to do so https://graphql-ruby.org/schema/definition.html#plugins . I'd like to write a plugin for some connection management but cannot figure out how.
Versions
latest
GraphQL schema
n/a
GraphQL query
n/a
Steps to reproduce
https://graphql-ruby.org/schema/definition.html#plugins
Expected behavior
There's clear documentation on how to implement a plugin.
Actual behavior
There's not clear documentation on how to implement a plugin.
n/a
Additional context
n/a
Hi! Sorry for the confusion and thanks for asking about it. In short, use ...
is an API for adding things to your schema. Whatever object is passed to use ...
receives a method call like .use(schema, **kwargs)
, and inside that method, it can do whatever it wants to the passed-in schema
.
There's not anything else special about plugins (yet...?), beside that .use
call. So you can see a few examples inside GraphQL-Ruby:
graphql-ruby/lib/graphql/backtrace.rb
Lines 26 to 28 in f82ed87
graphql-ruby/lib/graphql/schema/visibility.rb
Lines 8 to 14 in f82ed87
graphql-ruby/lib/graphql/schema/timeout.rb
Lines 35 to 39 in f82ed87
graphql-ruby/lib/graphql/subscriptions.rb
Lines 25 to 30 in f82ed87
So, there's not really more to say about that. Arguably, that section could be removed from the docs entirely since it's not useful by itself. (That is, all the relevant plugins have documentation for use ...
).
If you give that API a try and run into any trouble, please let me know!