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

Usage with resolvers possible? #152

Open
sixtyfive opened this issue May 8, 2024 · 0 comments
Open

Usage with resolvers possible? #152

sixtyfive opened this issue May 8, 2024 · 0 comments

Comments

@sixtyfive
Copy link

I've tried to make this work with resolver-based queries today, which doesn't seem to be possible at the moment.

module Resolvers
    class Fruits < BaseResolver
      graphql_name 'FruitsResolver'
      
      # Schema being dumped just fine, but self-documentation containing neither
      # `collection` nor `metadata` with any of its subfields... instead, graphql-ruby's
      # cursor-based pagination fields are present
      type Types::Fruit::Fields.connection_type, null: false

      argument :page, Integer, required: false
      argument :limit, Integer, required: false

      def resolve(page: nil, limit: nil)
        # with Fruit being the ActiveRecord model and the kaminari-activerecord Gem
        # installed, this still doesn't seem to be a Kaminari object (lacking the methods,
        # anyways)
        ::Fruit.all.page(page).per(limit)
      end
  end
end

Am I simply doing it wrong? If not, what would a PR to make it work have to do?

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

No branches or pull requests

1 participant