You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then it popped to my mind why we don't warn people about this potential issue with rubocop? If it sounds reasonable to you, I'd like to write a new cop suggesting that you should have a string type definition in resolvers.
# Resovers should use strings for type definitions. See: https://graphql-ruby.org/fields/resolvers.html#nesting-resolvers-of-the-same-type# # @example# # good# # module Resolvers# class TasksResolver < GraphQL::Schema::Resolver# type '[Types::TaskType]', null: false# # def resolve# []# end# end# end# # # bad# # module Resolvers# class TasksResolver < GraphQL::Schema::Resolver# type [Types::TaskType], null: false# # def resolve# []# end# end# end
The text was updated successfully, but these errors were encountered:
Can't determine the return type for Task.tasks (it has `resolver: Resolvers::TasksResolver`, perhaps that class is missing a `type ...` declaration, or perhaps its type causes a cyclical loading issue)
Recently I ran into a cyclical load error with resolvers. After searching for a solution, I found that this it a known issue and could be resolved by an easy change described here: https://graphql-ruby.org/fields/resolvers.html#nesting-resolvers-of-the-same-type
Then it popped to my mind why we don't warn people about this potential issue with rubocop? If it sounds reasonable to you, I'd like to write a new cop suggesting that you should have a string type definition in resolvers.
The text was updated successfully, but these errors were encountered: