Graphql-ruby: ArgumentError (missing keyword: field):

Created on 20 Aug 2016  路  8Comments  路  Source: rmosolgo/graphql-ruby

Hey @rmosolgo

Getting follow error when creating a new relation connection object - ArgumentError (missing keyword: field):

I see addition of new field argument. Does this require passing a field option?

Most helpful comment

When I upgraded from 1.9.14 to 1.9.16 this may have been introduced. In my rspec I initialize the mutation like this:

Mutations::Auth::Login.new(object: nil, context: {}).resolve(args)

And all my mutations fail when field: is missing. The following passes:

Mutations::Auth::Login.new(object: nil, field: nil, context: {}).resolve(args)

All 8 comments

Oops, we forgot about the range add use case! This was added in #206, I guess it should be optional

Definitely need a range add test to avoid this in the future, sorry!

Yeah, I think not needed in all use cases. No worries! 馃槃

All works! Fixed by #215

When I upgraded from 1.9.14 to 1.9.16 this may have been introduced. In my rspec I initialize the mutation like this:

Mutations::Auth::Login.new(object: nil, context: {}).resolve(args)

And all my mutations fail when field: is missing. The following passes:

Mutations::Auth::Login.new(object: nil, field: nil, context: {}).resolve(args)

Thanks for sharing your solution! It's also listed here https://github.com/rmosolgo/graphql-ruby/blob/master/CHANGELOG.md#breaking-changes-1

Sorry I don't get it, I did interit from my own Base class but I didn't override initialize. Why do I have to add field: nil everywhere?

The method has a new required argument. It's meant to be called by GraphQL-Ruby internals, which I already updated. If you're using it in some other way, you'll have to update it.

I am updating all tests. I thought it meant to be an optional argument. Guess it wasn't.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

EAdeveloper picture EAdeveloper  路  3Comments

jturkel picture jturkel  路  3Comments

jesster2k10 picture jesster2k10  路  3Comments

rmosolgo picture rmosolgo  路  4Comments

crice88 picture crice88  路  3Comments