-
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
NotImplementedError (schema contains Interfaces or Unions, so you must define a resolve_type -> (obj, ctx) { ... } function): #1205
Comments
Sounds like a problem with the guide you're using. Check out graphql-ruby's website. Specifically, the Interface and Union types guide. It explains how to fix your problem. |
Yep, thanks for the link to those docs above! |
It doesn't work. I don't undestand how to do. I receive all the time this error:
|
To fix this problem I used this in my ProjectSchema = GraphQL::Schema.define do
query(Types::QueryType)
mutation(Types::MutationType)
resolve_type lambda { |_obj, _ctx|
}
end But I TOTALLY don't understand why! Why? |
Now I can use interfaces in my types files. |
I ended up using this in ...
resolve_type ->(type, obj, ctx) {} But please explain it to me what it does. And why it doesn't work here: Interfaces::ActiveRecordTimestamp = GraphQL::InterfaceType.define do
name 'ActiveRecordTimestamp'
field :createdAt, types.String, property: :created_at
field :updatedAt, types.String, property: :updated_at
resolve_type ->(type, obj, ctx) {}
end like it says here (http://graphql-ruby.org/types/abstract_types.html):
MyUnion = GraphQL::UnionType.define do
resolve_type ->(obj, ctx) {
# resolve `obj` as a member of `MyUnion`
}
end
MyInterface = GraphQL::InterfaceType.define do
resolve_type ->(obj, ctx) {
# resolve `obj` as a member of `MyInterface`
}
end
@thefliik @rmosolgo please. |
I have exactly the same question. Why |
Any update on that? I have the same problem.. I have to add the resolve_type in the schema |
The schema requires a https://graphql-ruby.org/schema/definition.html#object-identification-hooks Please let me know if it doesn't work for you! |
If I follow this guide: http://tech.eshaiju.in/blog/2017/06/09/dry-graphql-definitions-using-interfaces/
I have this error:
NotImplementedError (schema contains Interfaces or Unions, so you must define a resolve_type -> (obj, ctx) { ... } function):
I'm using a simple
player_type.rb
:and this:
The text was updated successfully, but these errors were encountered: