Inject directive not working in scopes
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.5k
- Forks
- 468
- Avg merge
- 3h 9m
- Merged PRs (30d)
- 2
Description
f I want to make a pagination (eg. user blog entries) and make sure that the user is the logged user in the system, I’d like to use @inject
entires(
order: [OrderByClause!] @orderBy,
filters: Filters @filters(columns: ["id", "name", "display_name", "description"])
)[Role!]
@can(ability: "view")
@inject(context: "user.id", name: "id")
@paginate(scopes: ["assignedToUser"])
Then I imagine to use scopes in order to filter the blog entries for that user
The problem is that id never goes to scope as an argument (I think it should) because the arguments are set here:
$query = $resolveInfo
**->argumentSet**
->enhanceBuilder(
$query,
$this->directiveArgValue('scopes', [])
);
argumentSet is not considering the @inject directive that’s why id is not appending to args, when you call:
`public function assignedToUser(array $args) {
dd($args["id"]); _// it is never goes to here!_
}
Lighthouse Version: latest
Laravel Version: latest
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
Trace how resolveInfo->argumentSet and enhanceBuilder handle directive arguments, starting from the scope application shown in the issue. Compare that path with @inject(context: "user.id", name: "id") and verify that assignedToUser receives the injected id in its $args array.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, laravel, php
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100