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

Not required rule doesnot work #125

Closed dzhaugasharov closed 3 years ago

dzhaugasharov commented 3 years ago

Bug Description: Is there not a required rule? Im tryin this rule:

params = {'otherParam': 'ABC'}
valid = Validator(params, {
        'mark': 'integer|min:1|max:3'
    })

The param mark is not required, so it can be None. But I get this errors: {'mark': {'Integer': "Expected Type of Int or Str, Got: <class 'NoneType'>", 'Min': "Could not get size from data. type = <class 'NoneType'>", 'Max': "Could not get size from data. type = <class 'NoneType'>"}}

CSenshi commented 3 years ago

Currently we don't support not required rule, but we are going to implement 'nullable' rule, so it can handle cases like this.

dzhaugasharov commented 3 years ago

Currently we don't support not required rule, but we are going to implement 'nullable' rule, so it can handle cases like this.

That would be awesome. Looking forward to it.

CSenshi commented 3 years ago

Thanks, for some time we stopped development of package, but we will be on the rails soon, if you would like to contribute I'd accept PR for this issue