We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Owner change does not modify notifications.
When a certificate changes ownership, we should try to also update the notifications by removing the old defaults owners and applying new defaults. 


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `lemur/certificates/schemas.py`
Content:
```
1 """
2 .. module: lemur.certificates.schemas
3     :platform: unix
4     :copyright: (c) 2015 by Netflix Inc., see AUTHORS for more
5     :license: Apache, see LICENSE for more details.
6 .. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
7 """
8 from flask import current_app
9 from marshmallow import fields, validates_schema, post_load, pre_load
10 from marshmallow.exceptions import ValidationError
11 
12 from lemur.schemas import AssociatedAuthoritySchema, AssociatedDestinationSchema, AssociatedCertificateSchema, \
13     AssociatedNotificationSchema, PluginInputSchema, ExtensionSchema, AssociatedRoleSchema, EndpointNestedOutputSchema
14 
15 from lemur.authorities.schemas import AuthorityNestedOutputSchema
16 from lemur.destinations.schemas import DestinationNestedOutputSchema
17 from lemur.notifications.schemas import NotificationNestedOutputSchema
18 from lemur.roles.schemas import RoleNestedOutputSchema
19 from lemur.domains.schemas import DomainNestedOutputSchema
20 from lemur.users.schemas import UserNestedOutputSchema
21 
22 from lemur.common.schema import LemurInputSchema, LemurOutputSchema
23 from lemur.common import validators, missing
24 from lemur.notifications import service as notification_service
25 
26 
27 class CertificateSchema(LemurInputSchema):
28     owner = fields.Email(required=True)
29     description = fields.String()
30 
31 
32 class CertificateCreationSchema(CertificateSchema):
33     @post_load
34     def default_notification(self, data):
35         if not data['notifications']:
36             notification_name = "DEFAULT_{0}".format(data['owner'].split('@')[0].upper())
37             data['notifications'] += notification_service.create_default_expiration_notifications(notification_name, [data['owner']])
38 
39         notification_name = 'DEFAULT_SECURITY'
40         data['notifications'] += notification_service.create_default_expiration_notifications(notification_name, current_app.config.get('LEMUR_SECURITY_TEAM_EMAIL'))
41         return data
42 
43 
44 class CertificateInputSchema(CertificateCreationSchema):
45     name = fields.String()
46     common_name = fields.String(required=True, validate=validators.sensitive_domain)
47     authority = fields.Nested(AssociatedAuthoritySchema, required=True)
48 
49     validity_start = fields.DateTime()
50     validity_end = fields.DateTime()
51     validity_years = fields.Integer()
52 
53     destinations = fields.Nested(AssociatedDestinationSchema, missing=[], many=True)
54     notifications = fields.Nested(AssociatedNotificationSchema, missing=[], many=True)
55     replacements = fields.Nested(AssociatedCertificateSchema, missing=[], many=True)
56     roles = fields.Nested(AssociatedRoleSchema, missing=[], many=True)
57 
58     csr = fields.String(validate=validators.csr)
59 
60     # certificate body fields
61     organizational_unit = fields.String(missing=lambda: current_app.config.get('LEMUR_DEFAULT_ORGANIZATIONAL_UNIT'))
62     organization = fields.String(missing=lambda: current_app.config.get('LEMUR_DEFAULT_ORGANIZATION'))
63     location = fields.String(missing=lambda: current_app.config.get('LEMUR_DEFAULT_LOCATION'))
64     country = fields.String(missing=lambda: current_app.config.get('LEMUR_DEFAULT_COUNTRY'))
65     state = fields.String(missing=lambda: current_app.config.get('LEMUR_DEFAULT_STATE'))
66 
67     extensions = fields.Nested(ExtensionSchema)
68 
69     @validates_schema
70     def validate_dates(self, data):
71         validators.dates(data)
72 
73     @pre_load
74     def ensure_dates(self, data):
75         return missing.convert_validity_years(data)
76 
77 
78 class CertificateEditInputSchema(CertificateSchema):
79     notify = fields.Boolean()
80     destinations = fields.Nested(AssociatedDestinationSchema, missing=[], many=True)
81     notifications = fields.Nested(AssociatedNotificationSchema, missing=[], many=True)
82     replacements = fields.Nested(AssociatedCertificateSchema, missing=[], many=True)
83     roles = fields.Nested(AssociatedRoleSchema, missing=[], many=True)
84 
85 
86 class CertificateNestedOutputSchema(LemurOutputSchema):
87     __envelope__ = False
88     id = fields.Integer()
89     active = fields.Boolean()
90     bits = fields.Integer()
91     body = fields.String()
92     chain = fields.String()
93     description = fields.String()
94     name = fields.String()
95     cn = fields.String()
96     not_after = fields.DateTime()
97     not_before = fields.DateTime()
98     owner = fields.Email()
99     status = fields.Boolean()
100     creator = fields.Nested(UserNestedOutputSchema)
101     issuer = fields.Nested(AuthorityNestedOutputSchema)
102 
103 
104 class CertificateOutputSchema(LemurOutputSchema):
105     id = fields.Integer()
106     active = fields.Boolean()
107     notify = fields.Boolean()
108     bits = fields.Integer()
109     body = fields.String()
110     chain = fields.String()
111     deleted = fields.Boolean(default=False)
112     description = fields.String()
113     issuer = fields.String()
114     name = fields.String()
115     cn = fields.String()
116     not_after = fields.DateTime()
117     not_before = fields.DateTime()
118     owner = fields.Email()
119     san = fields.Boolean()
120     serial = fields.String()
121     signing_algorithm = fields.String()
122     status = fields.Boolean()
123     user = fields.Nested(UserNestedOutputSchema)
124     domains = fields.Nested(DomainNestedOutputSchema, many=True)
125     destinations = fields.Nested(DestinationNestedOutputSchema, many=True)
126     notifications = fields.Nested(NotificationNestedOutputSchema, many=True)
127     replaces = fields.Nested(CertificateNestedOutputSchema, many=True)
128     authority = fields.Nested(AuthorityNestedOutputSchema)
129     roles = fields.Nested(RoleNestedOutputSchema, many=True)
130     endpoints = fields.Nested(EndpointNestedOutputSchema, many=True, missing=[])
131 
132 
133 class CertificateUploadInputSchema(CertificateCreationSchema):
134     name = fields.String()
135     notify = fields.Boolean(missing=True)
136 
137     private_key = fields.String(validate=validators.private_key)
138     body = fields.String(required=True, validate=validators.public_certificate)
139     chain = fields.String(validate=validators.public_certificate)  # TODO this could be multiple certificates
140 
141     destinations = fields.Nested(AssociatedDestinationSchema, missing=[], many=True)
142     notifications = fields.Nested(AssociatedNotificationSchema, missing=[], many=True)
143     replacements = fields.Nested(AssociatedCertificateSchema, missing=[], many=True)
144     roles = fields.Nested(AssociatedRoleSchema, missing=[], many=True)
145 
146     @validates_schema
147     def keys(self, data):
148         if data.get('destinations'):
149             if not data.get('private_key'):
150                 raise ValidationError('Destinations require private key.')
151 
152 
153 class CertificateExportInputSchema(LemurInputSchema):
154     plugin = fields.Nested(PluginInputSchema)
155 
156 
157 certificate_input_schema = CertificateInputSchema()
158 certificate_output_schema = CertificateOutputSchema()
159 certificates_output_schema = CertificateOutputSchema(many=True)
160 certificate_upload_input_schema = CertificateUploadInputSchema()
161 certificate_export_input_schema = CertificateExportInputSchema()
162 certificate_edit_input_schema = CertificateEditInputSchema()
163
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/lemur/certificates/schemas.py b/lemur/certificates/schemas.py
--- a/lemur/certificates/schemas.py
+++ b/lemur/certificates/schemas.py
@@ -77,11 +77,25 @@
 
 class CertificateEditInputSchema(CertificateSchema):
     notify = fields.Boolean()
+    owner = fields.String()
     destinations = fields.Nested(AssociatedDestinationSchema, missing=[], many=True)
     notifications = fields.Nested(AssociatedNotificationSchema, missing=[], many=True)
     replacements = fields.Nested(AssociatedCertificateSchema, missing=[], many=True)
     roles = fields.Nested(AssociatedRoleSchema, missing=[], many=True)
 
+    @post_load
+    def enforce_notifications(self, data):
+        """
+        Ensures that when an owner changes, default notifications are added for the new owner.
+        Old owner notifications are retained unless explicitly removed.
+        :param data:
+        :return:
+        """
+        if data['owner']:
+            notification_name = "DEFAULT_{0}".format(data['owner'].split('@')[0].upper())
+            data['notifications'] += notification_service.create_default_expiration_notifications(notification_name, [data['owner']])
+        return data
+
 
 class CertificateNestedOutputSchema(LemurOutputSchema):
     __envelope__ = False

{"golden_diff": "diff --git a/lemur/certificates/schemas.py b/lemur/certificates/schemas.py\n--- a/lemur/certificates/schemas.py\n+++ b/lemur/certificates/schemas.py\n@@ -77,11 +77,25 @@\n \n class CertificateEditInputSchema(CertificateSchema):\n     notify = fields.Boolean()\n+    owner = fields.String()\n     destinations = fields.Nested(AssociatedDestinationSchema, missing=[], many=True)\n     notifications = fields.Nested(AssociatedNotificationSchema, missing=[], many=True)\n     replacements = fields.Nested(AssociatedCertificateSchema, missing=[], many=True)\n     roles = fields.Nested(AssociatedRoleSchema, missing=[], many=True)\n \n+    @post_load\n+    def enforce_notifications(self, data):\n+        \"\"\"\n+        Ensures that when an owner changes, default notifications are added for the new owner.\n+        Old owner notifications are retained unless explicitly removed.\n+        :param data:\n+        :return:\n+        \"\"\"\n+        if data['owner']:\n+            notification_name = \"DEFAULT_{0}\".format(data['owner'].split('@')[0].upper())\n+            data['notifications'] += notification_service.create_default_expiration_notifications(notification_name, [data['owner']])\n+        return data\n+\n \n class CertificateNestedOutputSchema(LemurOutputSchema):\n     __envelope__ = False\n", "issue": "Owner change does not modify notifications.\nWhen a certificate changes ownership, we should try to also update the notifications by removing the old defaults owners and applying new defaults. \n\n", "before_files": [{"content": "\"\"\"\n.. module: lemur.certificates.schemas\n    :platform: unix\n    :copyright: (c) 2015 by Netflix Inc., see AUTHORS for more\n    :license: Apache, see LICENSE for more details.\n.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>\n\"\"\"\nfrom flask import current_app\nfrom marshmallow import fields, validates_schema, post_load, pre_load\nfrom marshmallow.exceptions import ValidationError\n\nfrom lemur.schemas import AssociatedAuthoritySchema, AssociatedDestinationSchema, AssociatedCertificateSchema, \\\n    AssociatedNotificationSchema, PluginInputSchema, ExtensionSchema, AssociatedRoleSchema, EndpointNestedOutputSchema\n\nfrom lemur.authorities.schemas import AuthorityNestedOutputSchema\nfrom lemur.destinations.schemas import DestinationNestedOutputSchema\nfrom lemur.notifications.schemas import NotificationNestedOutputSchema\nfrom lemur.roles.schemas import RoleNestedOutputSchema\nfrom lemur.domains.schemas import DomainNestedOutputSchema\nfrom lemur.users.schemas import UserNestedOutputSchema\n\nfrom lemur.common.schema import LemurInputSchema, LemurOutputSchema\nfrom lemur.common import validators, missing\nfrom lemur.notifications import service as notification_service\n\n\nclass CertificateSchema(LemurInputSchema):\n    owner = fields.Email(required=True)\n    description = fields.String()\n\n\nclass CertificateCreationSchema(CertificateSchema):\n    @post_load\n    def default_notification(self, data):\n        if not data['notifications']:\n            notification_name = \"DEFAULT_{0}\".format(data['owner'].split('@')[0].upper())\n            data['notifications'] += notification_service.create_default_expiration_notifications(notification_name, [data['owner']])\n\n        notification_name = 'DEFAULT_SECURITY'\n        data['notifications'] += notification_service.create_default_expiration_notifications(notification_name, current_app.config.get('LEMUR_SECURITY_TEAM_EMAIL'))\n        return data\n\n\nclass CertificateInputSchema(CertificateCreationSchema):\n    name = fields.String()\n    common_name = fields.String(required=True, validate=validators.sensitive_domain)\n    authority = fields.Nested(AssociatedAuthoritySchema, required=True)\n\n    validity_start = fields.DateTime()\n    validity_end = fields.DateTime()\n    validity_years = fields.Integer()\n\n    destinations = fields.Nested(AssociatedDestinationSchema, missing=[], many=True)\n    notifications = fields.Nested(AssociatedNotificationSchema, missing=[], many=True)\n    replacements = fields.Nested(AssociatedCertificateSchema, missing=[], many=True)\n    roles = fields.Nested(AssociatedRoleSchema, missing=[], many=True)\n\n    csr = fields.String(validate=validators.csr)\n\n    # certificate body fields\n    organizational_unit = fields.String(missing=lambda: current_app.config.get('LEMUR_DEFAULT_ORGANIZATIONAL_UNIT'))\n    organization = fields.String(missing=lambda: current_app.config.get('LEMUR_DEFAULT_ORGANIZATION'))\n    location = fields.String(missing=lambda: current_app.config.get('LEMUR_DEFAULT_LOCATION'))\n    country = fields.String(missing=lambda: current_app.config.get('LEMUR_DEFAULT_COUNTRY'))\n    state = fields.String(missing=lambda: current_app.config.get('LEMUR_DEFAULT_STATE'))\n\n    extensions = fields.Nested(ExtensionSchema)\n\n    @validates_schema\n    def validate_dates(self, data):\n        validators.dates(data)\n\n    @pre_load\n    def ensure_dates(self, data):\n        return missing.convert_validity_years(data)\n\n\nclass CertificateEditInputSchema(CertificateSchema):\n    notify = fields.Boolean()\n    destinations = fields.Nested(AssociatedDestinationSchema, missing=[], many=True)\n    notifications = fields.Nested(AssociatedNotificationSchema, missing=[], many=True)\n    replacements = fields.Nested(AssociatedCertificateSchema, missing=[], many=True)\n    roles = fields.Nested(AssociatedRoleSchema, missing=[], many=True)\n\n\nclass CertificateNestedOutputSchema(LemurOutputSchema):\n    __envelope__ = False\n    id = fields.Integer()\n    active = fields.Boolean()\n    bits = fields.Integer()\n    body = fields.String()\n    chain = fields.String()\n    description = fields.String()\n    name = fields.String()\n    cn = fields.String()\n    not_after = fields.DateTime()\n    not_before = fields.DateTime()\n    owner = fields.Email()\n    status = fields.Boolean()\n    creator = fields.Nested(UserNestedOutputSchema)\n    issuer = fields.Nested(AuthorityNestedOutputSchema)\n\n\nclass CertificateOutputSchema(LemurOutputSchema):\n    id = fields.Integer()\n    active = fields.Boolean()\n    notify = fields.Boolean()\n    bits = fields.Integer()\n    body = fields.String()\n    chain = fields.String()\n    deleted = fields.Boolean(default=False)\n    description = fields.String()\n    issuer = fields.String()\n    name = fields.String()\n    cn = fields.String()\n    not_after = fields.DateTime()\n    not_before = fields.DateTime()\n    owner = fields.Email()\n    san = fields.Boolean()\n    serial = fields.String()\n    signing_algorithm = fields.String()\n    status = fields.Boolean()\n    user = fields.Nested(UserNestedOutputSchema)\n    domains = fields.Nested(DomainNestedOutputSchema, many=True)\n    destinations = fields.Nested(DestinationNestedOutputSchema, many=True)\n    notifications = fields.Nested(NotificationNestedOutputSchema, many=True)\n    replaces = fields.Nested(CertificateNestedOutputSchema, many=True)\n    authority = fields.Nested(AuthorityNestedOutputSchema)\n    roles = fields.Nested(RoleNestedOutputSchema, many=True)\n    endpoints = fields.Nested(EndpointNestedOutputSchema, many=True, missing=[])\n\n\nclass CertificateUploadInputSchema(CertificateCreationSchema):\n    name = fields.String()\n    notify = fields.Boolean(missing=True)\n\n    private_key = fields.String(validate=validators.private_key)\n    body = fields.String(required=True, validate=validators.public_certificate)\n    chain = fields.String(validate=validators.public_certificate)  # TODO this could be multiple certificates\n\n    destinations = fields.Nested(AssociatedDestinationSchema, missing=[], many=True)\n    notifications = fields.Nested(AssociatedNotificationSchema, missing=[], many=True)\n    replacements = fields.Nested(AssociatedCertificateSchema, missing=[], many=True)\n    roles = fields.Nested(AssociatedRoleSchema, missing=[], many=True)\n\n    @validates_schema\n    def keys(self, data):\n        if data.get('destinations'):\n            if not data.get('private_key'):\n                raise ValidationError('Destinations require private key.')\n\n\nclass CertificateExportInputSchema(LemurInputSchema):\n    plugin = fields.Nested(PluginInputSchema)\n\n\ncertificate_input_schema = CertificateInputSchema()\ncertificate_output_schema = CertificateOutputSchema()\ncertificates_output_schema = CertificateOutputSchema(many=True)\ncertificate_upload_input_schema = CertificateUploadInputSchema()\ncertificate_export_input_schema = CertificateExportInputSchema()\ncertificate_edit_input_schema = CertificateEditInputSchema()\n", "path": "lemur/certificates/schemas.py"}], "after_files": [{"content": "\"\"\"\n.. module: lemur.certificates.schemas\n    :platform: unix\n    :copyright: (c) 2015 by Netflix Inc., see AUTHORS for more\n    :license: Apache, see LICENSE for more details.\n.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>\n\"\"\"\nfrom flask import current_app\nfrom marshmallow import fields, validates_schema, post_load, pre_load\nfrom marshmallow.exceptions import ValidationError\n\nfrom lemur.schemas import AssociatedAuthoritySchema, AssociatedDestinationSchema, AssociatedCertificateSchema, \\\n    AssociatedNotificationSchema, PluginInputSchema, ExtensionSchema, AssociatedRoleSchema, EndpointNestedOutputSchema\n\nfrom lemur.authorities.schemas import AuthorityNestedOutputSchema\nfrom lemur.destinations.schemas import DestinationNestedOutputSchema\nfrom lemur.notifications.schemas import NotificationNestedOutputSchema\nfrom lemur.roles.schemas import RoleNestedOutputSchema\nfrom lemur.domains.schemas import DomainNestedOutputSchema\nfrom lemur.users.schemas import UserNestedOutputSchema\n\nfrom lemur.common.schema import LemurInputSchema, LemurOutputSchema\nfrom lemur.common import validators, missing\nfrom lemur.notifications import service as notification_service\n\n\nclass CertificateSchema(LemurInputSchema):\n    owner = fields.Email(required=True)\n    description = fields.String()\n\n\nclass CertificateCreationSchema(CertificateSchema):\n    @post_load\n    def default_notification(self, data):\n        if not data['notifications']:\n            notification_name = \"DEFAULT_{0}\".format(data['owner'].split('@')[0].upper())\n            data['notifications'] += notification_service.create_default_expiration_notifications(notification_name, [data['owner']])\n\n        notification_name = 'DEFAULT_SECURITY'\n        data['notifications'] += notification_service.create_default_expiration_notifications(notification_name, current_app.config.get('LEMUR_SECURITY_TEAM_EMAIL'))\n        return data\n\n\nclass CertificateInputSchema(CertificateCreationSchema):\n    name = fields.String()\n    common_name = fields.String(required=True, validate=validators.sensitive_domain)\n    authority = fields.Nested(AssociatedAuthoritySchema, required=True)\n\n    validity_start = fields.DateTime()\n    validity_end = fields.DateTime()\n    validity_years = fields.Integer()\n\n    destinations = fields.Nested(AssociatedDestinationSchema, missing=[], many=True)\n    notifications = fields.Nested(AssociatedNotificationSchema, missing=[], many=True)\n    replacements = fields.Nested(AssociatedCertificateSchema, missing=[], many=True)\n    roles = fields.Nested(AssociatedRoleSchema, missing=[], many=True)\n\n    csr = fields.String(validate=validators.csr)\n\n    # certificate body fields\n    organizational_unit = fields.String(missing=lambda: current_app.config.get('LEMUR_DEFAULT_ORGANIZATIONAL_UNIT'))\n    organization = fields.String(missing=lambda: current_app.config.get('LEMUR_DEFAULT_ORGANIZATION'))\n    location = fields.String(missing=lambda: current_app.config.get('LEMUR_DEFAULT_LOCATION'))\n    country = fields.String(missing=lambda: current_app.config.get('LEMUR_DEFAULT_COUNTRY'))\n    state = fields.String(missing=lambda: current_app.config.get('LEMUR_DEFAULT_STATE'))\n\n    extensions = fields.Nested(ExtensionSchema)\n\n    @validates_schema\n    def validate_dates(self, data):\n        validators.dates(data)\n\n    @pre_load\n    def ensure_dates(self, data):\n        return missing.convert_validity_years(data)\n\n\nclass CertificateEditInputSchema(CertificateSchema):\n    notify = fields.Boolean()\n    owner = fields.String()\n    destinations = fields.Nested(AssociatedDestinationSchema, missing=[], many=True)\n    notifications = fields.Nested(AssociatedNotificationSchema, missing=[], many=True)\n    replacements = fields.Nested(AssociatedCertificateSchema, missing=[], many=True)\n    roles = fields.Nested(AssociatedRoleSchema, missing=[], many=True)\n\n    @post_load\n    def enforce_notifications(self, data):\n        \"\"\"\n        Ensures that when an owner changes, default notifications are added for the new owner.\n        Old owner notifications are retained unless explicitly removed.\n        :param data:\n        :return:\n        \"\"\"\n        if data['owner']:\n            notification_name = \"DEFAULT_{0}\".format(data['owner'].split('@')[0].upper())\n            data['notifications'] += notification_service.create_default_expiration_notifications(notification_name, [data['owner']])\n        return data\n\n\nclass CertificateNestedOutputSchema(LemurOutputSchema):\n    __envelope__ = False\n    id = fields.Integer()\n    active = fields.Boolean()\n    bits = fields.Integer()\n    body = fields.String()\n    chain = fields.String()\n    description = fields.String()\n    name = fields.String()\n    cn = fields.String()\n    not_after = fields.DateTime()\n    not_before = fields.DateTime()\n    owner = fields.Email()\n    status = fields.Boolean()\n    creator = fields.Nested(UserNestedOutputSchema)\n    issuer = fields.Nested(AuthorityNestedOutputSchema)\n\n\nclass CertificateOutputSchema(LemurOutputSchema):\n    id = fields.Integer()\n    active = fields.Boolean()\n    notify = fields.Boolean()\n    bits = fields.Integer()\n    body = fields.String()\n    chain = fields.String()\n    deleted = fields.Boolean(default=False)\n    description = fields.String()\n    issuer = fields.String()\n    name = fields.String()\n    cn = fields.String()\n    not_after = fields.DateTime()\n    not_before = fields.DateTime()\n    owner = fields.Email()\n    san = fields.Boolean()\n    serial = fields.String()\n    signing_algorithm = fields.String()\n    status = fields.Boolean()\n    user = fields.Nested(UserNestedOutputSchema)\n    domains = fields.Nested(DomainNestedOutputSchema, many=True)\n    destinations = fields.Nested(DestinationNestedOutputSchema, many=True)\n    notifications = fields.Nested(NotificationNestedOutputSchema, many=True)\n    replaces = fields.Nested(CertificateNestedOutputSchema, many=True)\n    authority = fields.Nested(AuthorityNestedOutputSchema)\n    roles = fields.Nested(RoleNestedOutputSchema, many=True)\n    endpoints = fields.Nested(EndpointNestedOutputSchema, many=True, missing=[])\n\n\nclass CertificateUploadInputSchema(CertificateCreationSchema):\n    name = fields.String()\n    notify = fields.Boolean(missing=True)\n\n    private_key = fields.String(validate=validators.private_key)\n    body = fields.String(required=True, validate=validators.public_certificate)\n    chain = fields.String(validate=validators.public_certificate)  # TODO this could be multiple certificates\n\n    destinations = fields.Nested(AssociatedDestinationSchema, missing=[], many=True)\n    notifications = fields.Nested(AssociatedNotificationSchema, missing=[], many=True)\n    replacements = fields.Nested(AssociatedCertificateSchema, missing=[], many=True)\n    roles = fields.Nested(AssociatedRoleSchema, missing=[], many=True)\n\n    @validates_schema\n    def keys(self, data):\n        if data.get('destinations'):\n            if not data.get('private_key'):\n                raise ValidationError('Destinations require private key.')\n\n\nclass CertificateExportInputSchema(LemurInputSchema):\n    plugin = fields.Nested(PluginInputSchema)\n\n\ncertificate_input_schema = CertificateInputSchema()\ncertificate_output_schema = CertificateOutputSchema()\ncertificates_output_schema = CertificateOutputSchema(many=True)\ncertificate_upload_input_schema = CertificateUploadInputSchema()\ncertificate_export_input_schema = CertificateExportInputSchema()\ncertificate_edit_input_schema = CertificateEditInputSchema()\n", "path": "lemur/certificates/schemas.py"}]}