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

Support for the class based GraphQL API #30

Closed
phyrog opened this Issue Nov 22, 2017 · 13 comments

Comments

Projects
None yet
6 participants
@phyrog
Collaborator

phyrog commented Nov 22, 2017

The block passed to field is now executed in a different context (a proxy object), so the authorization helpers are not available here. The field is still accessible via @field, so if we find a way to call the helpers in the proxy object, we can still set the metadata on the fields.

@phyrog phyrog added the new feature label Nov 22, 2017

@phyrog phyrog added this to the v0.6 milestone Nov 22, 2017

@gastonmorixe

This comment has been minimized.

gastonmorixe commented May 20, 2018

1.8.0 released with heavy class based support. Any plans on supporting it?

@phyrog

This comment has been minimized.

Collaborator

phyrog commented May 21, 2018

Thanks for the ping on this!

Plans sure, however I currently can't give an estimate (at least a couple of weeks) on how soon due to a lot of other work at the moment. Using this gem with 1.8 should still be possible with the old style of definitions for now.

@casiodk

This comment has been minimized.

casiodk commented Jun 1, 2018

I also really need this :)

@phyrog

This comment has been minimized.

Collaborator

phyrog commented Jun 2, 2018

I'll probably be able to get to it next week, after I have taken another look at the new API to see how instrumenters can be used now with classes (last time I checked this was not implemented yet).

@phyrog phyrog self-assigned this Jun 6, 2018

@casiodk

This comment has been minimized.

casiodk commented Jun 7, 2018

Hey :) How is it coming along. Can I do something to help?

@phyrog

This comment has been minimized.

Collaborator

phyrog commented Jun 7, 2018

I started playing around with the new API yesterday; as most changes are internally, I still need to check out the interaction between the .define based API and the class based one, to see if my planned approach works for both.

Usage-wise, I don't expect much change here:

field :foobar, ... do
  authorize :foo, policy: FooPolicy ... # this should still work without changes
end

but I'm also thinking about supporting one-line field definitions (which did not work previously, I think):

field :foobar, ..., authorize: :foo, policy: FooPolicy

It'll definitely take me a couple more days to figure all that out, but I think a PR and new release next week should definitely be realistic.

@casiodk

This comment has been minimized.

casiodk commented Jun 8, 2018

That sounds awesome, looking forward!

@haizop

This comment has been minimized.

haizop commented Jun 8, 2018

Thanks for working on this. I am building a new class based api and I would really like to use this gem.

@phyrog phyrog referenced this issue Jun 9, 2018

Merged

Class API #50

@phyrog

This comment has been minimized.

Collaborator

phyrog commented Jun 12, 2018

Alright, implementation should be ready (#50). Please give it a shot and let me know if you encounter any problems.

To use the PR branch, you can use this in your Gemfile:

gem 'graphql-pundit', github: 'ontohub/graphql-pundit', branch: 'class_api'

For usage information, check out the README.md file on the branch.

Make sure to revert this change once the new version is released, as the branch will be deleted then.

@itsjbecks

This comment has been minimized.

itsjbecks commented Jun 17, 2018

Is there an estimated time on #50 being merged into master?

@eugenk

This comment has been minimized.

Member

eugenk commented Jun 17, 2018

By the end of the day, I presume :)

@itsjbecks

This comment has been minimized.

itsjbecks commented Jun 17, 2018

Awesome! Looking forward to taking this for a spin. Looking forward to contribute a bit in the future as well.

@phyrog phyrog closed this in #50 Jun 17, 2018

@phyrog

This comment has been minimized.

Collaborator

phyrog commented Jun 17, 2018

Version 0.7.0 was just released. If there are any problems, don't hesitate to open issues 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment