Refactor/zenodo metadata adapter#67
Open
mbruns91 wants to merge 2 commits into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #67 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 27 27
Lines 1070 1164 +94
=========================================
+ Hits 1070 1164 +94 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds an adapter path from service-independent PublicationMetadata into Zenodo deposition metadata while preserving the existing legacy ZenodoMetadata field-based workflow.
Changes:
- Added
PublicationMetadatawrapping support toZenodoMetadata. - Mapped common creators, contributors, related identifiers, and publication fields into Zenodo payloads.
- Added unit tests for adapter serialization, duplicate common-field rejection, and validation edge cases.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
courier/services/zenodo/metadata.py |
Adds adapter logic, conflict validation, and updated convenience constructors. |
tests/unit/services/zenodo/test_metadata.py |
Adds focused tests covering the new PublicationMetadata adapter behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1d0dbe8 to
0428c36
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds an adapter path from the service-independent
PublicationMetadatamodel to Zenodo deposition metadata.ZenodoMetadatacan now wrap aPublicationMetadatainstance while keeping Zenodo-specific fields and payload generation inside the Zenodo service layer.Summary
PublicationMetadatacomposition toZenodoMetadata.ZenodoMetadatafield-based construction working.ZenodoMetadata.software(publication).Personcreators -> Zenodo creatorsContributor.role-> Zenodo contributor typeRelatedIdentifier-> Zenodo related identifiersZenodoMetadata, including upload type, publication/image type, access control, communities, grants, notes, and DOI reservation.ZenodoMetadataor raw mappings.Unit Tests
Added focused Zenodo metadata tests covering:
PublicationMetadatathroughZenodoMetadataExisting Zenodo metadata tests continue to cover the legacy field-based path.
Validation
Validated with:
ruff check --fix --diff . python -m mypy courier pytest -q coverage run -m pytest -q coverage combine coverage report -mExamples
Legacy Zenodo Metadata
This still works. Common publication fields and Zenodo-specific fields are all set directly on
ZenodoMetadata.New Adapter Style
Here, reusable publication fields live in
PublicationMetadata.ZenodoMetadatasupplies the Zenodo-specific wrapper, especiallyupload_type="software".New Adapter With Zenodo-Specific Fields
This is valid because
publication_type, communities, grants, DOI reservation, and notes are Zenodo-specific adapter fields.Invalid Mixed Usage
This is invalid because
titleis a common publication field. Whenmetadata=publicationis provided, common fields must come fromPublicationMetadata, not also from legacyZenodoMetadatafields.Also invalid:
and:
These are rejected to avoid ambiguous payload generation.