-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Field Extensions (second try) #1758
Conversation
Wow, amazingly this seems like it might work. Still lots of clean-up to do though. |
I renamed it to |
"Extensions" makes sense to me, it's similar to ActiveRecord's extending method. The other name that comes to mind for composing fields out of behaviors is "traits," but I think one advantage of "extensions" is that you'd sort of expect to have to pass it a module. |
class_based_api: true | ||
--- | ||
|
||
{{ "GraphQL::Schema::FieldExtension" | api_doc }} provides a way to modify user-defined fields in a programmatic way. For example, Relay connections may are implemented as a field extension. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relay connections may are implemented as a field extension
Typo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, thanks!
This has an odd side-effect, since connections are now implemented via class-based API, It's a bit of a breakage that i wasn't expecting 😅 |
This is nice, but the compatibility issue is no joke. I'm going to revert it from 1.8.x and put it in 1.9.x instead. |
Field Extensions (second try)
Trying the same notion from #1411:
TODO:
before_
andafter_
stepsscope:
to use filtersfilters
, raise when scope is used with a legacy resolver (requirescope: false
to opt out)Extractrefactored to useField#to_options
to a separate PR to reduce this diff.add_field
insteadField#with_filters
to not create a giant stack trace (as in Changecall_hooks
to be iterative rather than recursive #1738)function:
or legacyfield:
Make sure that promises, errors, nil and skip are all handled by the library, let's wait and see, because you might want to handle those things, I don't want to hide them all.