From 8c22a6afdad87a6318934691bbea680650938928 Mon Sep 17 00:00:00 2001 From: Katie Smith Date: Tue, 12 Jun 2018 12:18:33 +0100 Subject: [PATCH] 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. --- app/schema_validation/__init__.py | 2 +- app/v2/notifications/notification_schemas.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/schema_validation/__init__.py b/app/schema_validation/__init__.py index b17efec6d..44cb0f9ce 100644 --- a/app/schema_validation/__init__.py +++ b/app/schema_validation/__init__.py @@ -29,7 +29,7 @@ def validate(json_to_validate, schema): validate_email_address(instance) return True - @format_checker.checks('datetime', raises=ValidationError) + @format_checker.checks('datetime_within_next_day', raises=ValidationError) def validate_schema_date_with_hour(instance): if isinstance(instance, str): try: diff --git a/app/v2/notifications/notification_schemas.py b/app/v2/notifications/notification_schemas.py index 1e66ab7f6..39c78d727 100644 --- a/app/v2/notifications/notification_schemas.py +++ b/app/v2/notifications/notification_schemas.py @@ -136,7 +136,7 @@ post_sms_request = { "phone_number": {"type": "string", "format": "phone_number"}, "template_id": uuid, "personalisation": personalisation, - "scheduled_for": {"type": ["string", "null"], "format": "datetime"}, + "scheduled_for": {"type": ["string", "null"], "format": "datetime_within_next_day"}, "sms_sender_id": uuid }, "required": ["phone_number", "template_id"], @@ -182,7 +182,7 @@ post_email_request = { "email_address": {"type": "string", "format": "email_address"}, "template_id": uuid, "personalisation": personalisation, - "scheduled_for": {"type": ["string", "null"], "format": "datetime"}, + "scheduled_for": {"type": ["string", "null"], "format": "datetime_within_next_day"}, "email_reply_to_id": uuid }, "required": ["email_address", "template_id"],