[ENG-9824] - Add required metadata validation#11691
[ENG-9824] - Add required metadata validation#11691Vlad0n20 wants to merge 2 commits intoCenterForOpenScience:feature/es2-consolidationfrom
Conversation
| self.save() | ||
|
|
||
| def validate_required_metadata(self, osf_obj): | ||
| from jsonschema import validate, ValidationError as JsonSchemaValidationError |
There was a problem hiding this comment.
I think this import hasn't any dependencies and we can move it to the top of the file
|
|
||
| def test_missing_record_raises(self, provider, cedar_template, preprint): | ||
| provider.required_metadata_template = cedar_template | ||
| provider.save() |
There was a problem hiding this comment.
Just curious as I'm not familiar with this functionality yet. Shouldn't we call validate_required_metadata during save call to prevent saving cedar template without cedar metadata record existence?
There was a problem hiding this comment.
This method validates a specific osf_obj (preprint/node) against the provider's required template — not the provider itself. It's intended to be called at publish/submission time for a given object (e.g. before a preprint goes public). Calling it in Provider.save() wouldn't make sense since there's no single object to validate there — a provider may have thousands of associated preprints.
Ticket
Purpose
Changes
Side Effects
QE Notes
CE Notes
Documentation