From 5154646ca2c4e4755cc4e54714ac46693cb15e2c Mon Sep 17 00:00:00 2001 From: David Kilias Date: Fri, 4 Dec 2020 21:03:09 +0100 Subject: [PATCH] more constraints on fields --- test_cerberus.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test_cerberus.py b/test_cerberus.py index fa4ace3..dca081a 100644 --- a/test_cerberus.py +++ b/test_cerberus.py @@ -76,6 +76,7 @@ schema_membership={ 'check_with': valid_money_amount}, 'status': { 'type': 'string', + 'required': True, 'allowed': ['V', 'E', 'F']}, 'von': { 'type': 'string', @@ -103,9 +104,11 @@ schema_base={ 'type': 'string'}, 'email': { 'type': 'string', + 'required': True, 'regex': '^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$'}, 'fullname': { - 'type': 'string'}, + 'type': 'string', + 'required': True}, 'nickname': { 'type': 'string'}, 'pgp-key': { @@ -125,9 +128,11 @@ schema = { 'schema': schema_base}, 'id': { 'type': 'string', + 'required': True, 'regex': '^[a-f0-9]{5}$'}, 'timestamp': { - 'type': 'string'} + 'type': 'string', + 'required': True} } v = Validator()