import dateutil.parser

def validate_iso_datetime(field, value, error):
    try:
        dateutil.parser.parse(value)
    except ValueError:
        error(field, "invalid iso format")

team_schema = {
    "name": {"type": "string", "minlength": 1, 'required': True},
    "days_of_week": {"type": "list", "schema": {'type': 'integer'}, 'required': True},
    "send_time": {"validator": validate_iso_datetime, 'required': True},
    "summary_time": {"validator": validate_iso_datetime, 'required': True},
}

team_update_schema = {
    "days_of_week": {"type": "list", "schema": {'type': 'integer'}},
    "send_time": {"validator": validate_iso_datetime},
    "summary_time": {"validator": validate_iso_datetime},
}

user_schema = {
    "first_name": {"type": "string", "minlength": 1, 'required': True},
    "last_name": {"type": "string", "minlength": 1, 'required': True},
    'email': {'type': 'string', 'regex': '^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$', 'required': True},
    'roles': {'type': 'list', 'required': True, 'schema': {'type':'dict', 
                    'schema': {'id': {'type': ['integer', 'string'], 'required': True}, 'name': {'type': 'string', 'required': True} } } }
}

question_schema = {
    'question': {"type": "string", "minlength": 1, 'required': True},
}
@@ -232,32 +232,49 @@
  %22minlength%22: 1,
+ 'maxlength': 30,
  'required': Tru
@@ -305,32 +305,48 @@
 %7B%22type%22: %22list%22,
+ 'minlength': 1,
  %22schema%22: %7B'typ
@@ -591,16 +591,32 @@
  %22list%22,
+ 'minlength': 1,
  %22schema
@@ -637,16 +637,43 @@
 nteger'%7D
+, 'allowed': list(range(7))
 %7D,%0A    %22
@@ -843,32 +843,49 @@
  %22minlength%22: 1,
+ 'maxlength': 30,
  'required': Tru
@@ -931,32 +931,49 @@
  %22minlength%22: 1,
+ 'maxlength': 30,
  'required': Tru

add more validation for saves and updates