-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Authorize mutation inputs #1609
Conversation
I added a rough doc of my goal here: https://github.com/rmosolgo/graphql-ruby/blob/mutations-auth/guides/mutations/mutation_authorization.md I'd love some opinions on what you see there if you get a chance! |
I'm not completely clear on what methods / names need to exist, that's one tricky part |
I'm wondering if "Loading objects" is too implicit/magical. The only clue that it's not a normal argument is that a non-input object type is used? I believe this is the only instance in the API right now where a schema member definition isn't what will end up in the schema. I know it's opt-in, but it's not really visible or obvious as to what's different about just by looking at the code. We have a similar feature for dealing with ID arguments and doing GlobalID parsing: argument :id, :id, required: true, gid_type: Types::Employee I'm thinking the same thing could be achieved with an optional kwarg: argument :id, :id, required: true, load_as: Types::Employee I think every feature mentioned in the doc could still be done in the same way, with being slightly more explicit. |
Yep, I'm on the fence about the same thing. Adding another keyword arg (or two) is another implementation we were kicking around over here. One question is, does the argument change names? For example, when you have: argument :id, :id, required: true, load_as: Types::Employee Does the resolve method accept |
Good point! By making the argument name less implicit, the resolver arguments become more implicit 🙈 Actually is having both |
Woah, interesting, so you might take |
Pushed a change to use the |
Building on the integrated authorization framework from #1494, I want to add first-class support for a workflow where:
This is the kind of auth we really want for mutations. (Usually, authorization is run after a field returns a value, but for mutations, that's too late!)