mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-23 17:01:35 -05:00
add more friendly datetime validator to jsonschema
add `datetime` format (note, not the built-in `date-time`) to our json schemas. this uses the iso8601 library to try and parse the string. also, move `strict-rfc3339` and `rfc3987` (used by jsonschema to validate `date-time` and `uri` formats respectively from test requirements to regular requirements. if they're not installed, validation silently succeeds, so validation wouldnt reject anything bad on prod, only in unit tests.
This commit is contained in:
@@ -11,8 +11,8 @@ create_broadcast_message_schema = {
|
||||
'service_id': uuid,
|
||||
'created_by': uuid,
|
||||
'personalisation': {'type': 'object'},
|
||||
'starts_at': {'type': 'string', 'format': 'date-time'},
|
||||
'finishes_at': {'type': 'string', 'format': 'date-time'},
|
||||
'starts_at': {'type': 'string', 'format': 'datetime'},
|
||||
'finishes_at': {'type': 'string', 'format': 'datetime'},
|
||||
'areas': {"type": "array", "items": {"type": "string"}},
|
||||
},
|
||||
'required': ['template_id', 'service_id', 'created_by'],
|
||||
@@ -26,8 +26,8 @@ update_broadcast_message_schema = {
|
||||
'title': 'Update broadcast_message',
|
||||
'properties': {
|
||||
'personalisation': {'type': 'object'},
|
||||
'starts_at': {'type': 'string', 'format': 'date-time'},
|
||||
'finishes_at': {'type': 'string', 'format': 'date-time'},
|
||||
'starts_at': {'type': 'string', 'format': 'datetime'},
|
||||
'finishes_at': {'type': 'string', 'format': 'datetime'},
|
||||
'areas': {"type": "array", "items": {"type": "string"}},
|
||||
},
|
||||
'required': [],
|
||||
|
||||
Reference in New Issue
Block a user