go-playground / validator

:100:Go Struct and Field validation, including Cross Field, Cross Struct, Map, Slice and Array diving
MIT License
16.41k stars 1.31k forks source link

fix: excluded_* and required_* checks aren't triggered on pointers to structs #1124

Open iradmt opened 1 year ago

iradmt commented 1 year ago

Fixes Or Enhances

Fix for https://github.com/go-playground/validator/issues/906 Trigger excluded_* and required_* checks on pointers to structs. Before fix all default backed-in tags were ignored for non-nil pointers to structs.
Now it's possible to check whether pointer to struct is nil or not depending on another field value.

Make sure that you've checked the boxes below before you submit PR:

@go-playground/validator-maintainers

coveralls commented 1 year ago

Coverage Status

coverage: 73.975% (+0.003%) from 73.972% when pulling 3453fec5870bebb8a25e76814b66594cb190b40d on iradmt:bugfix/nil_checkable_on_struct_ptr into bd1113d5c1901c5205fc0a7af031a11268ff13ee on go-playground:master.