We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug
If the ListType field is not present, the rule directive is applied to the array itself.
I expect the rules directive for ListType Field to always apply to array elements.
Expected behavior/Solution
the solution I think
https://github.com/nuwave/lighthouse/blob/v6.28.0/src/Validation/RulesGatherer.php#L63-L72
rewrite to
if ( $argument->type instanceof ListType ) { if (is_array($argument->value)) { foreach ($argument->value as $index => $value) { $this->handleArgumentValue($value, $directivesForArgument, array_merge($nestedPath, [$index])); } } } else { $this->handleArgumentValue($argument->value, $directivesForArgument, $nestedPath); }
Steps to reproduce
deleteHoges( ids: [ID!] @rules(apply: ["required", "uuid"]) ): [Hoge!]!
mutation { deleteHoges { id } }
["ids" => ["Required", "Uuid"]]
expected ListType rules derective apply to array elements
["ids.0" => ["Required", "Uuid"]]
Lighthouse Version
v6.22.0
The text was updated successfully, but these errors were encountered:
The proposed solution looks fine. Can you add a pull request? Please start with a failing test case, probably in RulesDirectiveTest.
RulesDirectiveTest
Sorry, something went wrong.
@spawnia
#2489
I created it here.
Please let me know if you have any problems.
Fixed with https://github.com/nuwave/lighthouse/releases/tag/v6.29.1. Please consider sponsoring.
No branches or pull requests
Describe the bug
If the ListType field is not present, the rule directive is applied to the array itself.
I expect the rules directive for ListType Field to always apply to array elements.
Expected behavior/Solution
the solution I think
https://github.com/nuwave/lighthouse/blob/v6.28.0/src/Validation/RulesGatherer.php#L63-L72
rewrite to
Steps to reproduce
expected ListType rules derective apply to array elements
Lighthouse Version
v6.22.0
The text was updated successfully, but these errors were encountered: