asaskevich / govalidator

[Go] Package of validators and sanitizers for strings, numerics, slices and structs
MIT License
5.97k stars 554 forks source link

Validation of a pointer to a variable of type bool now checks the value of the variable, not the pointer #460

Open wberdnik opened 2 years ago

wberdnik commented 2 years ago

BC Break Report

Summary

Validation of a pointer to a variable of type bool now checks the value of the variable, not the pointer. Error of compatibility has.

Previous behavior (one month ago)

Q A
Version v0.0.0-20200108200545-475eaeb16496

var v struct { Value *bool json:"value" valid:"required"} json.Unmarshal([]byte({"value":false}), &v)

ok, err := govalidator.ValidateStruct(v) => ok err
True nil

Current behavior

Q A
Version v0.0.0-20210307081110-f21760c49a8d
=> ok err
False error "non zero value required"

How to ensure compatibility?

dex80526 commented 1 year ago

see the same issue. This seems a regression.