jazzband / jsonmodels

jsonmodels is library to make it easier for you to deal with structures that are converted to, or read from JSON.
http://jsonmodels.readthedocs.org/en/latest/
BSD 3-Clause "New" or "Revised" License
334 stars 51 forks source link

Length validator does not validate when only maximum value is set #113

Closed avrahamshukron closed 6 years ago

avrahamshukron commented 6 years ago

There's a typo in the Length validator:

if self.minimum_value is not None and len_ > self.maximum_value:

Notice how self.miminum_value is checked for None-ness instead of self.maximum_value. This means that when setting max length alone, no validation is performed.

DanielSchiavini commented 6 years ago

When setting only the minimum you len_ > None gives an error, too

DanielSchiavini commented 6 years ago

This is fixed in https://github.com/beregond/jsonmodels/pull/120 as well