I'm defining a resolver for some fields, using the graphql gem for ruby.
This is the Resolver definition:
module Resolvers
class Events < BaseResolver
type [Types::EventType], null: true
argument :input, Types::EventInput, required: true
def resolve(input:)
# do something
end
end
end
This is the BaseResolver class:
module Resolvers
class BaseResolver < GraphQL::Schema::Resolver
end
end
And this is where I call the Resolver:
module Types
class CommonSpaceType < BaseObject
field :active, Boolean, null: true
field :events, function: Resolvers::Events
end
end
This is what I'm getting as a response, using Insomnia:
"message": "undefined method `deprecation_reason' for Resolvers::Events:Class\nDid you mean? deprecate_constant"
It's pretty old, but maybe someone will use this information. You should change
field :events, function: Resolvers::Events
to
field :events, resovler: Resolvers::Events
as you are using GraphQL::Schema::Resolver
object, not GraphQL::Function
.