marshmallow icon indicating copy to clipboard operation
marshmallow copied to clipboard

Don't check for False return values from validators

Open sloria opened this issue 3 years ago • 1 comments

Currently, validators are allowed to return False which results in ValidationError with a generic message.

https://github.com/marshmallow-code/marshmallow/blob/9ac3241b78b444033f901d51b431ac862d1e21cc/src/marshmallow/fields.py#L249-L251

I'm not convinced this behavior is that useful, and we could improve validation/deserialization performance by removing it. It also is a simpler API, avoiding confusion like in https://github.com/marshmallow-code/marshmallow/issues/1458

Slating this for 4.0 since it's a breaking change.

sloria avatar Mar 30 '21 02:03 sloria

Yes.

Adding a link to the doc section you just added that should be reworded when dealing with this: https://github.com/marshmallow-code/marshmallow/pull/1774/files.

lafrech avatar Mar 30 '21 06:03 lafrech