[ENG-9827] - save collection-submission custom metadata to CedarMetadataRecord on create/update#11735
Conversation
| if waffle.switch_is_active(features.COLLECTION_SUBMISSION_WITH_CEDAR) and collection.provider_id: | ||
| try: | ||
| collection.provider.validate_required_metadata(guid.referent) | ||
| except ValidationError as e: | ||
| raise InvalidModelValueError(e.message) |
There was a problem hiding this comment.
how about calling validate_required_metadata after sync_cedar_metadata, instead of removing the validation entirely? (looks like now it's never validated)
| if not (self.collection.provider_id and self.collection.provider.required_metadata_template): | ||
| return | ||
| template = self.collection.provider.required_metadata_template | ||
| metadata = {f: getattr(self, f) for f in CEDAR_METADATA_FIELDS if getattr(self, f, '')} |
There was a problem hiding this comment.
the main thing this has to do is make a valid cedar record (is why calling validate_required_metadata seems relevant) -- to index for search, will at least need a "@context" to be parsable as json-ld (either build one on the fly from the template jsonschema or hard-code one based on the specific properties used for the existing collection fields)
There was a problem hiding this comment.
So I have a question: why don't we use the Cedar Metadata Editor on the FE and change the collection submission process so that the FE would create a Cedar Metadata Record by posting to the respective endpoints, instead of having the BE do the "sync"?
There was a problem hiding this comment.
Using the Cedar Metadata Editor on the FE would give cleaner separation of concerns, but the custom fields (status, volume, issue, etc.) are already part of the existing collection submission payload — splitting that into a separate cedar record creation step adds coordination complexity and risk of partial failure on the client side. The BE sync keeps the existing submission flow unchanged for all clients while ensuring the cedar record stays consistent with the submission fields.
b81d6b5 to
096f486
Compare
Ticket
Purpose
Changes
Side Effects
QE Notes
CE Notes
Documentation