asaskevich / govalidator

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

fix: support negative range values #452

Open Jesse0Michael opened 2 years ago

Jesse0Michael commented 2 years ago
Q A
Documentation no
Bugfix no
BC Break no
New Feature yes
RFC no
QA yes

Description

allow the range validator to support negative param values by adjusting the regex. ie: range(-10|10)

Currently you would get the error: Range3: The following validator is invalid or can't be applied to the field: "range(-10|10)"

Jesse0Michael commented 2 years ago

Sorry, When i initially went looking for this feature i didn't find:

https://github.com/asaskevich/govalidator/issues/441 https://github.com/asaskevich/govalidator/pull/442

but found those when looking into another issue

sergeyglazyrindev commented 2 years ago

Hello guys! I forked this package cause owner disappeared. Hope, he will be back, but it would be easier to merge these changes back if he is back Link to my repo: create issue there and we'll discuss it.