mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 10:21:14 -05:00
require fields in marshmallow schema to try and make it as hard
to break backwards compatability as possible
This commit is contained in:
@@ -294,6 +294,20 @@ class NotificationWithTemplateSchema(BaseSchema):
|
|||||||
|
|
||||||
|
|
||||||
class NotificationWithPersonalisationSchema(NotificationWithTemplateSchema):
|
class NotificationWithPersonalisationSchema(NotificationWithTemplateSchema):
|
||||||
|
class Meta(NotificationWithTemplateSchema.Meta):
|
||||||
|
# mark as many fields as possible as required since this is a public api.
|
||||||
|
# WARNING: Does _not_ reference fields computed in handle_template_merge, such as
|
||||||
|
# 'body', 'subject' [for emails], and 'content_char_count'
|
||||||
|
fields = (
|
||||||
|
# db rows
|
||||||
|
'id', 'to', 'job_row_number', 'template_version', 'billable_units', 'notification_type', 'created_at',
|
||||||
|
'sent_at', 'sent_by', 'updated_at', 'status', 'reference',
|
||||||
|
# computed fields
|
||||||
|
'personalisation',
|
||||||
|
# relationships
|
||||||
|
'service', 'job', 'api_key', 'template'
|
||||||
|
)
|
||||||
|
|
||||||
@pre_dump
|
@pre_dump
|
||||||
def handle_personalisation_property(self, in_data):
|
def handle_personalisation_property(self, in_data):
|
||||||
self.personalisation = in_data.personalisation
|
self.personalisation = in_data.personalisation
|
||||||
@@ -533,7 +547,6 @@ job_email_template_notification_schema = JobEmailTemplateNotificationSchema()
|
|||||||
notification_schema = NotificationModelSchema()
|
notification_schema = NotificationModelSchema()
|
||||||
notification_with_template_schema = NotificationWithTemplateSchema()
|
notification_with_template_schema = NotificationWithTemplateSchema()
|
||||||
notification_with_personalisation_schema = NotificationWithPersonalisationSchema()
|
notification_with_personalisation_schema = NotificationWithPersonalisationSchema()
|
||||||
notification_with_personalisation_schema_load_json = NotificationWithPersonalisationSchema(load_json=True)
|
|
||||||
invited_user_schema = InvitedUserSchema()
|
invited_user_schema = InvitedUserSchema()
|
||||||
permission_schema = PermissionSchema()
|
permission_schema = PermissionSchema()
|
||||||
email_data_request_schema = EmailDataSchema()
|
email_data_request_schema = EmailDataSchema()
|
||||||
|
|||||||
Reference in New Issue
Block a user