rmosolgo / rmosolgo/graphql-ruby
Better detection for when items were scoped?
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 5.4k
- Forks
- 1.4k
- Avg merge
- 23h 19m
- Merged PRs (30d)
- 28
Description
Currently, this library checks for whether or not items were scoped by using object equality:
This works when scope_items really did something, but not if you want to skip authorization altogether. For example, if you've got a list of items from an external service, and you want to return them as-is, without scoping or authorization, you'd have to do this:
def self.scope_items(items, ctx)
items.dup # Make a shallow copy so GraphQL-Ruby will know that we authorized this list
end
I bet there's a more robust way to implement this check (and maybe to implement the runtime metadata, too). I'm going to consider it for 3.0.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with lib/graphql/schema/field/scope_extension.rb at the linked lines 14-18, then examine how runtime metadata is handled. Define a more robust way to distinguish authorized, unchanged external-service lists from lists that were actually scoped; the work is done when this no longer requires a shallow copy and the behavior is covered by the relevant tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, ruby
- Domain
- api, authorization
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100