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

class-based argument prepare doesn't support callable objects #1786

Closed
modosc opened this issue Aug 16, 2018 · 2 comments
Closed

class-based argument prepare doesn't support callable objects #1786

modosc opened this issue Aug 16, 2018 · 2 comments

Comments

@modosc
Copy link
Contributor

modosc commented Aug 16, 2018

in the old api, something like this works:

class MyPreparer
  def call(arg, ctx)
   # ...
   end
end

# then somewhere else
argument :id, !types.ID, "Vehicle Model ID", prepare: MyPreparer.new

but in the class based api it seems that prepare must be a Proc:
https://github.com/rmosolgo/graphql-ruby/blob/master/lib/graphql/schema/argument.rb#L99

would you accept a pr that allows anything that responds to #call here or was this decision intentional?

thanks!

@rmosolgo
Copy link
Owner

It was accidental! A PR would be great.

@modosc
Copy link
Contributor Author

modosc commented Aug 27, 2018

ping - any issues with the pr as-is?

rmosolgo pushed a commit that referenced this issue Sep 10, 2018
support callable prepare objects in Schema::Argument (fixes #1786)
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

2 participants