jellydator / validation

An idiomatic validation package. Supports configurable and extensible validation rules (validators) using normal language constructs instead of error-prone struct tags.
MIT License
39 stars 6 forks source link

`In` and `NotIn` inconsistent #19

Open andremedeiros opened 1 year ago

andremedeiros commented 1 year ago

While using the In and NotIn rules, I've noticed that their implementations are inconsistent. The former uses DeepEqual to verify equality, whereas the latter uses the equality operator. In cases where pointers are being passed with the same underlying data, the former would work, but the latter falls short.

Can we have a discussion on whether NotIn should incorporate DeepEqual?

swithek commented 1 year ago

That's quite strange. These functions haven't been changed since they were first implemented/updated in the original repository, so I cannot answer why these inconsistencies exist, but we can certainly discuss whether they should be updated here.

andremedeiros commented 1 year ago

That's great! I'd probably prefer going for the DeepEqual approach, which is more in line with the spirit of what these functions are trying to do. Would you accept a PR?

swithek commented 1 year ago

Yes, that sounds good to me. Feel free to open a PR whenever you want!