1818# 59 Temple Place, Suite 330, Boston, MA 02D111-1307, USA.
1919"""Video JSON schema."""
2020
21+ from cds .modules .records .serializers .json import (
22+ CUSTOM_ALLOWED_ATTRS ,
23+ CUSTOM_ALLOWED_CSS ,
24+ )
2125from invenio_jsonschemas import current_jsonschemas
2226from marshmallow import Schema , fields , pre_load , post_load
23- from marshmallow_utils .fields import SanitizedHTML
2427from ....deposit .api import Video
2528from ..fields .datetime import DateString
2629from .common import (
3841 OaiSchema ,
3942 RelatedIdentifiersSchema ,
4043 RelatedLinksSchema ,
44+ SanitizedHTMLWithCSS ,
4145 StrictKeysSchema ,
4246 TitleSchema ,
4347 TranslationsSchema ,
@@ -131,7 +135,9 @@ class VideoSchema(StrictKeysSchema):
131135 contributors = fields .Nested (ContributorSchema , many = True , required = True )
132136 copyright = fields .Nested (CopyrightSchema )
133137 date = DateString (required = True )
134- description = SanitizedHTML (required = True )
138+ description = SanitizedHTMLWithCSS (
139+ attrs = CUSTOM_ALLOWED_ATTRS , css_styles = CUSTOM_ALLOWED_CSS , required = True
140+ )
135141 doi = DOI ()
136142 duration = fields .Str ()
137143 external_system_identifiers = fields .Nested (
@@ -147,7 +153,7 @@ class VideoSchema(StrictKeysSchema):
147153 note = fields .Str ()
148154 publication_date = fields .Str ()
149155 recid = fields .Number ()
150- legacy_recid = fields .Number ()
156+ legacy_recid = fields .Number ()
151157 related_links = fields .Nested (RelatedLinksSchema , many = True )
152158 report_number = fields .List (fields .Str , many = True )
153159 schema = fields .Str (attribute = "$schema" , data_key = "$schema" )
@@ -158,15 +164,11 @@ class VideoSchema(StrictKeysSchema):
158164 _curation = fields .Nested (CurationSchema )
159165 additional_titles = fields .List (fields .Nested (AdditionalTitlesSchema ))
160166 additional_descriptions = fields .List (fields .Nested (AdditionalDescriptionsSchema ))
161- alternate_identifiers = fields .Nested (
162- AlternateIdentifiersSchema , many = True
163- )
164- related_identifiers = fields .Nested (
165- RelatedIdentifiersSchema , many = True
166- )
167+ alternate_identifiers = fields .Nested (AlternateIdentifiersSchema , many = True )
168+ related_identifiers = fields .Nested (RelatedIdentifiersSchema , many = True )
167169 collections = fields .List (fields .Str , many = True )
168170 additional_languages = fields .List (fields .Str , many = True )
169-
171+
170172 # Preservation fields
171173 location = fields .Str ()
172174 original_source = fields .Str ()
0 commit comments