-
-
Notifications
You must be signed in to change notification settings - Fork 431
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
@can
with injectArgs: true
doesn't inject args passed as variables
#2456
Comments
@can
injectArgs
doesn't injected args passed as variables@can
with injectArgs: true
doesn't inject args passed as variables
There is a test for this, perhaps you can add a failing test case for your scenario? lighthouse/tests/Unit/Auth/CanDirectiveTest.php Lines 251 to 282 in 7b774a8
|
Thanks for the quick response, that test doesn't cover the case, as it doesn't use variables to pass in the arguments. Once I am back in the office on Monday I'll attempt to put together something. But generally speaking, it looks something like the following, for a query using Type rather than a mutation using Input:
|
The actual test is:
and what would you know, it passes.
Because I am an idiot. and I am using Sorry for wasting your time. |
If you use injectArgs on @can, it doesn't pass in arguments that are populated via variables:
Model:
Policy:
graphQL schema:
graphQL Query:
Result:
When dumping out $injectedArgs, it returns an empty array, when the expected is
From my understanding, this makes it impossible to use variables and
@can
withinjectedArgs
Lighthouse Version 6.22.0
The text was updated successfully, but these errors were encountered: