-
Notifications
You must be signed in to change notification settings - Fork 770
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
Allow Min
, Max
, and Each
to wrap chained rules.
#1501
Conversation
This follows the same pattern as `Length`. I've also removed the separate named and standard templates from these rules. I didn't see a good way to implement these in the new pattern, and also felt the language of the old standard template was somewhat difficult to read anyway. This also contains a small update to a few of the test helper functions to prevent issues when running tests on systems with different line endings.
I've done Still looking at This also contains a small update to a few of the test helper functions to prevent issues when running tests on systems with different line endings. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1501 +/- ##
============================================
+ Coverage 96.56% 96.57% +0.01%
- Complexity 978 979 +1
============================================
Files 201 202 +1
Lines 2417 2426 +9
============================================
+ Hits 2334 2343 +9
Misses 83 83 ☔ View full report in Codecov by Sentry. |
…class. This base class could also be used for other aggregate operations on arrays, e.g. a sum. (It can't be used for `Length` though, as we would not be able to validate a length of 0.)
I'm not actually sure what needs to be done for @henriquemoody, do the tests I added in the most recent commit reflect intended behavior, or is there something that needs changed? The only things that seemed like they might be incorrect to me are:
|
Hey, @dmjohnsson23 ! Thank you so much for your changes! What I would expect from when v::each(v::intType())->assert([1, 2, 3, 'B']);
// Message: All items in `[1, 2, 3, 'B']` must be an integer type But that's quite complicated, and I'm not sure if I want to replicate the same behaviour from other rules, if I'm honest. I will think a bit better about that, and I will let you know. I created #1502 with your changes, but with atomic commits and changing the commits slightly to look like the other commits in the repo. I've noticed that your email is not configured properly, so I changed your author to |
That's fine, thank you |
Closed by #1502 Thank you so much for contributing, @dmjohnsson23! |
Thank you! Much appreciated 🐼 |
Following the pattern set in #1485, allow, the
Min
,Max
, andEach
rules to elegantly support chained rules with well-formatted validation messages.