flask-rebar
flask-rebar copied to clipboard
CommaSeparatedList length validation
How can I validate length of CommaSeparatedList
? This is not working:
from marshmallow import fields, validate, Schema
from flask_rebar.validation import CommaSeparatedList
class Dummy(Schema):
extent = CommaSeparatedList(
fields.Float(),
required=True,
validates=validate.Length(equal=4)
)
Change that validates=
to validate=
and you should be good to go!
Would be good to document that.
Hmm, seems like that would be covered under https://marshmallow.readthedocs.io/en/stable/api_reference.html#module-marshmallow.fields since it's just standard Marshmallow behaviour.
I could see adding it as a recipe might be helpful though.
Whoops accidentally closed this one early - agreed we could add a recipe to help with this