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::EmployeeI'm thinking the same thing could be achieved with an optional kwarg: argument :id, :id, required: true, load_as: Types::EmployeeI 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::EmployeeDoes 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!)