Fix: Validator panics when 'nil' is used along with required if for slices and maps
Fixes
Added support to check for 'nil' values in case of maps and slices when used with required if. (Previously only lengths were being checked as a result using nil with required if would lead to a panic since the program tried to convert 'nil' to an integer) Created a separate case for arrays to only check lengths since arrays cannot be nil in go.
Check #1437 for more details.
Make sure that you've checked the boxes below before you submit PR:
- [x] Tests exist or have been written that cover this particular change.
@go-playground/validator-maintainers
coverage: 73.686% (+0.008%) from 73.678% when pulling f20d93d9e0c3e65ce6ec548381113d4be63e4d6f on JunaidIslam2105:validator-panic-bug into 0e3e2f997385102062275f226e825b4a109f4833 on go-playground:master.
@nodivbyzero kindly take a look and let me know if I need to change anything else
@nodivbyzero, if everything looks good, can we merge?