Open dzhaugasharov opened 3 years ago
Validating 'aaa' as an integer is pretty confusing.
>>> validate({"d":'aaa'}, {"d":'integer|min:1'}, return_info=True)
(True, {'d': 'aaa'}, {})
I think the root issue is that the request is somehow converted to an integer, which has not much to do with the original string. In this example the error message indicates this conversion: 'aaa' -> 2730
>>> validate({"d":'aaa'}, {"d":'integer|max:1'}, return_info=True)
(False, {}, {'d': {'Max': 'Expected Maximum: 1, Got: 2730'}})
This i caused by the function Hex.convert in this line: https://github.com/CSenshi/Validator/blob/master/validator/rules_src/integer.py#L46. The function converts the hex chars ("abcdef") to integers. In fact hex:aaa = dec:2730. I know that is not a solution but just a workaround, but if you don't need the hex check you can remove that function
Bug Description: This rule is valid? An integer expected, but the text can be a valid value.
Code Fragment: