Hello,
would you consider adding the ability to specify something like allow_empty=True (or False) when declaring a field like fields.Str? This would allow me to check for an empty string without having to code a validator for it (unless there is already another way of doing it that I'm missing...).
Kind regards,
Fabrizio
You can use the built-in Length validator to validate against empty strings:
from marshmallow import validate, fields
not_empty = validate.Length(min=1)
foo = fields.Str(validate=not_empty)
I see. Cool, thank you :)
Most helpful comment
You can use the built-in
Lengthvalidator to validate against empty strings: