Change schema format name of datetime format

Renamed the 'datetime' format to 'datetime_within_next_day'. This format
is used to validate the date and time of scheduled notifications, not to
check the format of a datetime.
This commit is contained in:
Katie Smith
2018-06-12 12:18:33 +01:00
parent 7f4b828aff
commit 8c22a6afda
2 changed files with 3 additions and 3 deletions

View File

@@ -29,7 +29,7 @@ def validate(json_to_validate, schema):
validate_email_address(instance) validate_email_address(instance)
return True return True
@format_checker.checks('datetime', raises=ValidationError) @format_checker.checks('datetime_within_next_day', raises=ValidationError)
def validate_schema_date_with_hour(instance): def validate_schema_date_with_hour(instance):
if isinstance(instance, str): if isinstance(instance, str):
try: try:

View File

@@ -136,7 +136,7 @@ post_sms_request = {
"phone_number": {"type": "string", "format": "phone_number"}, "phone_number": {"type": "string", "format": "phone_number"},
"template_id": uuid, "template_id": uuid,
"personalisation": personalisation, "personalisation": personalisation,
"scheduled_for": {"type": ["string", "null"], "format": "datetime"}, "scheduled_for": {"type": ["string", "null"], "format": "datetime_within_next_day"},
"sms_sender_id": uuid "sms_sender_id": uuid
}, },
"required": ["phone_number", "template_id"], "required": ["phone_number", "template_id"],
@@ -182,7 +182,7 @@ post_email_request = {
"email_address": {"type": "string", "format": "email_address"}, "email_address": {"type": "string", "format": "email_address"},
"template_id": uuid, "template_id": uuid,
"personalisation": personalisation, "personalisation": personalisation,
"scheduled_for": {"type": ["string", "null"], "format": "datetime"}, "scheduled_for": {"type": ["string", "null"], "format": "datetime_within_next_day"},
"email_reply_to_id": uuid "email_reply_to_id": uuid
}, },
"required": ["email_address", "template_id"], "required": ["email_address", "template_id"],