feat: Add support for omitting empty and zero values in validation (including nil pointer and empty content of pointer)
Fixes Or Enhances
Add the omitzero Tag:
- It allows you to ignore the subsequent validations if the value of a field is empty
- If the field is a pointer and the pointer is nil, ignore the subsequent validations
- If the field is a pointer and the pointer is not nil, but the content value of the pointer is zero, the subsequent validations will be ignored
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: 74.347% (+0.03%) from 74.318% when pulling 68a05949d0621e695618b4b32824506598d2275b on zeewell:feature/omitzero into 6c3307e6c64040ebc0efffe9366927c68146ffba on go-playground:master.
Fixes #249 #485 #698 #849
Waiting for this to be merged
@deankarn This PR's merge has been blocked, can you help take a look at the issue?
@deankarn Do you know when this might be merged?
Sorry @chrislentz been getting some more people to help maintain this package as my time is super limited.
No reason I can see not to merge though.
Sorry @chrislentz been getting some more people to help maintain this package as my time is super limited.
No reason I can see not to merge though.
@deankarn If possible, I would like to become a maintainer of this package.