3

I'm getting this error in GraphQl (Apollo JS/ Graphql Ruby): Error Error: GraphQL error: Field 'pagination' doesn't accept argument 'pagination' GraphQL error: Variable $pagination is declared by Clients but not used. Reload the page and try again.

I have this query:

query Clients($pagination: PaginationInput) {
  clients {
     data {
       ....Fragment
     }
     pagination(pagination: $pagination) {
       ....Fragment
     }

  }
}

And I have this as my input type:

class PaginatedClientsType < Types::BaseObject
   field :data, ...
   field :pagination, PaginationType ... do 
     argument :pagination, PaginationInput, required: false
   end
end

And this in my query_type.rb file:

field :clients, ::Types::Paginated::ClientsType, null: false do
   argument :pagination, PaginationInput, required: false
end

def clients(pagination:)
  ...
end

// and i've added to no avail:
field :pagination ... do
   argument :pagination, PaginationInput, required: false
end
def pagination(pagination:)
...
end

Any ideas on how I can pass the argument to something other than this top level client? I've read docs here but can't figure it out.

Thanks!

Taysky
  • 4,331
  • 2
  • 20
  • 28
  • 1
    I just wanted to let you know that I've also had this problem and tried the same things you have and never figured out a way to do this – Christopher Best Oct 04 '19 at 18:49
  • The way that you've written it actually looks correct. Any chance you could provide a dump of the schema? – TonyArra Mar 20 '20 at 13:13

0 Answers0