Я создал новое приложение rails с graphql
, но у меня было много проблем с руководствами в возрасте от 6 месяцев.Я подозреваю, что graphql-ruby
меняется довольно быстро.
Итак, моя последняя проблема в методе resolve
:
module Types
class QueryType < Types::BaseObject
graphql_name "Root Query"
description "The query root of this schema"
field :allProducts, [ProductType], null: false do
resolve ->(_obj, _args, _ctx) { Product.all }
end
end
end
Ошибка:
wrong number of arguments (given 1, expected 3)
/usr/local/var/rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/graphql-1.9.0.pre1/lib/graphql/schema/field.rb:430:in `resolve'
/Users/alder/Projects/_apps/service_exchange/any-do-api/app/graphql/types/query_type.rb:7:in `block in <class:QueryType>'
/usr/local/var/rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/graphql-1.9.0.pre1/lib/graphql/schema/field.rb:222:in `instance_eval'
/usr/local/var/rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/graphql-1.9.0.pre1/lib/graphql/schema/field.rb:222:in `initialize'
/usr/local/var/rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/graphql-1.9.0.pre1/lib/graphql/schema/member/accepts_definition.rb:142:in `initialize'
/usr/local/var/rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/graphql-1.9.0.pre1/lib/graphql/schema/field.rb:88:in `new'
/usr/local/var/rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/graphql-1.9.0.pre1/lib/graphql/schema/field.rb:88:in `from_options'
/usr/local/var/rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/graphql-1.9.0.pre1/lib/graphql/schema/member/has_fields.rb:52:in `field'
/Users/alder/Projects/_apps/service_exchange/any-do-api/app/graphql/types/query_type.rb:6:in `<class:QueryType>'
/Users/alder/Projects/_apps/service_exchange/any-do-api/app/graphql/types/query_type.rb:2:in `<module:Types>'
/Users/alder/Projects/_apps/service_exchange/any-do-api/app/graphql/types/query_type.rb:1:in `<main>'
Полнаяlog
Вы можете проверить полный проект здесь
Я использую последнюю версию:
gem "graphql", "~> 1.9.0.pre1"
Но то же самоеошибка с 1.8.*