CSenshi / Validator

Easy-to-use, Highly Configurable Python Data Validator. Inspired by Laravel Validator
https://pypi.org/project/validator/
MIT License
46 stars 23 forks source link

Add Same rule #65

Closed bsoyka closed 4 years ago

bsoyka commented 4 years ago

Closes #61.

CSenshi commented 4 years ago

This same rules means something else. check() takes argument that represents other field name in the same dictionary :

Example:

req = {"old_pass": "secret", "new_pass": "secret"}
rule = {"new_pass": "same:old_pass"}
validate(req, rule)  # True

req = {"old_pass": "old_secret", "new_pass": "new_secret"}
rule = {"new_pass": "same:old_pass"}
validate(req, rule)  # False

TBH, I don't know why I assigned this as good first issue label. It makes us change interfaces with validator <-> rules.

I think Issue needs more explanation and removal of good first issue label. Sorry for your time :) Take a look at other Issues if you want to. I'll be closing this now.