Skip to content

Commit

Permalink
Add validation to contentdm for is_shown_at and by
Browse files Browse the repository at this point in the history
  • Loading branch information
barbarahui committed Nov 5, 2024
1 parent cb14126 commit 5422d28
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions metadata_mapper/mappers/oai/content_dm/contentdm_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import requests
from requests.adapters import HTTPAdapter, Retry

from ...mapper import Validator
from ..oai_mapper import OaiRecord, OaiVernacular


Expand Down Expand Up @@ -173,6 +174,24 @@ def get_matching_identifier(self, last=False):
return identifiers[-1]
return identifiers[0]

class ContentdmValidator(Validator):

def setup(self):
self.add_validatable_fields([
{
"field": "is_shown_by",
"validations": [
Validator.content_match
]
},
{
"field": "is_shown_at",
"validations": [
Validator.content_match
]
}
])

class ContentdmVernacular(OaiVernacular):
record_cls = ContentdmRecord
validator = ContentdmValidator

0 comments on commit 5422d28

Please sign in to comment.