allow precognitive requests to use wildcards with array validations (#57437)#57486
allow precognitive requests to use wildcards with array validations (#57437)#57486taylorotwell merged 5 commits intolaravel:12.xfrom
Conversation
|
@markusheinemann, what do you think about making this a little less strict and allow a Just thinking it could be cool to do Then you could do something like |
|
@timacdonald Totally agree. Would be a nice convenience feature... Would we assume that I take a look into a adjusted implementation. |
|
@markusheinemann, I feel that the wildcard should not be greedy with dots, i.e., to match |
|
Thanks @markusheinemann for the PR! I've updated it based on @timacdonald's feedback. Example with nested object $rules = [
'profile' => 'required|array',
'profile.username' => 'required|string',
'profile.email' => 'required|email',
];
Example with nested arrays $rules = [
'users' => 'required|array',
'users.*.name' => 'required|string',
'users.*.email' => 'required|email',
];
|
|
@pascalbaljet Thanks for the completion! Should we update the docs for this change? |
Yes, I've opened a PR: laravel/docs#10989 |
This PR is a proposal to resolve #57437.
With this change, users can specify a wildcard to trigger all validation rules for an array field when using precognitive requests. Before the change the user had to specify all array validation rules manually in the
Precognition-Validate-Onlyheader. Now wildcards can specified to cover all array entries.PS. This is my first PR for Laravel so please forgive me mistakes. I appreciate any feedback :)