Open RafaelKr opened 2 years ago
What's actually being submitted is an array of IDs. The min
/max
rules are doing the right thing - validating the size of the array.
Wow Jason, that's a fast answer right there! I think then it's correct, but the documentation for that is still missing, right? Was expecting it here: https://statamic.dev/validation
Yes good point, we should definitely add it to that page.
Should I open an issue in the docs repo to keep track of that?
I just came across this PR: https://github.com/statamic/cms/pull/4980
In the past
min
andmax
on Statamic file fields were validating the file COUNT whereas in Laravel they are validating the file SIZE.To not break existing pages @jasonvarga decided to keep the behavior of
min
andmax
and add the new parametersmin_filesize
andmax_filesize
additionally. IMO this definitely makes sense for now, but should be changed with the next major release.My suggestion would be:
min
andmax
to comply with Laravel (validate file size)min_filesize
andmax_filesize
min_filecount
andmax_filecount
(or similiar)If possible it would be great to have an automatic migration script which changes all existing validation fields.
Also the very similiar
size
validation should be checked to have the same behavior as in Laravel.Laravel Validation Rules:
CC: @arthurperton