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

feat(ObjectType) lookup field implementations from interface, too #108

Merged
merged 3 commits into from
Mar 1, 2016

Conversation

rmosolgo
Copy link
Owner

As described in our earlier conversation, this allows interfaces to be used as mixins.

You can get field implementations from the interface or you can override them in the object type.

One outstanding issue is, can we cache the result of looking up a field? At what level? Some things I want to support, but don't support well yet, are:

  • Rails development reloading
  • Multiple schemas in one application


# @return [Array<GraphQL::Field>] All fields, including ones inherited from interfaces
def all_fields
interface_fields = interfaces.inject({}) do |memo, iface|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about interfaces.reduce({}, :merge) ? 💃

@xuorig
Copy link
Contributor

xuorig commented Feb 29, 2016

I like this! it's going to be super useful 🎉

@rmosolgo rmosolgo force-pushed the interface-field-lookup branch from 6331d86 to a75c2a0 Compare February 29, 2016 16:38
rmosolgo pushed a commit that referenced this pull request Mar 1, 2016
feat(ObjectType) lookup field implementations from interface, too
@rmosolgo rmosolgo merged commit c270431 into master Mar 1, 2016
@rmosolgo rmosolgo deleted the interface-field-lookup branch March 1, 2016 14:22
@peterhorne
Copy link

Yay! Looking forward to giving this a spin 😁 🎉

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

Successfully merging this pull request may close these issues.

3 participants