diff --git a/app/schemas.py b/app/schemas.py index c7061a5bb..93171dec7 100644 --- a/app/schemas.py +++ b/app/schemas.py @@ -294,6 +294,20 @@ class NotificationWithTemplateSchema(BaseSchema): 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 def handle_personalisation_property(self, in_data): self.personalisation = in_data.personalisation @@ -533,7 +547,6 @@ job_email_template_notification_schema = JobEmailTemplateNotificationSchema() notification_schema = NotificationModelSchema() notification_with_template_schema = NotificationWithTemplateSchema() notification_with_personalisation_schema = NotificationWithPersonalisationSchema() -notification_with_personalisation_schema_load_json = NotificationWithPersonalisationSchema(load_json=True) invited_user_schema = InvitedUserSchema() permission_schema = PermissionSchema() email_data_request_schema = EmailDataSchema()