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

New Rule: Dict #89

Closed CSenshi closed 4 years ago

CSenshi commented 4 years ago

Rule Name: Dict

Rule Description: The field under validation must be a dictionary (Python map)

Rule Usage Example:

reqs = {"data" : {"key1" : "val1", "key2" : "val2"} }
rule = {"data" : "dict"}
validate(reqs, rule) # True

reqs = {"data" : ["val1", "val2", "val3", "val4"]}
rule = {"data" : "dict"}
validate(reqs, rule) # False, It fails because it is list not dict

Before contributing please review RULES.md (check for duplication), also check CONTRIBUTING.md for more details :100: