Makes container dynamically generated#1430
Conversation
There was a problem hiding this comment.
Pull request overview
This PR makes the container property dynamically generated from relatedItem and description metadata instead of requiring users to manually set it via XML's SeriesInformation description. The change simplifies metadata management by automatically deriving container information when available, falling back to stored database values when metadata is absent.
Key changes:
- Adds a dynamic
containeraccessor method that callsgenerate_containerfrom the bolognese gem - Updates Gemfile to use the bolognese "container" branch (temporary until merged)
- Updates tests to explicitly set
related_items: nilwhere needed to prevent factory defaults from interfering - Updates expected citation formats to include dynamically generated container information
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| app/models/doi.rb | Adds dynamic container method that generates container from metadata or falls back to database value |
| Gemfile | Temporarily uses bolognese from git branch "container" instead of released version |
| Gemfile.lock | Updates dependencies to use bolognese from git branch and modifies Bundler version |
| spec/models/doi_spec.rb | Adds comprehensive tests for dynamic container generation from various metadata sources |
| spec/requests/datacite_dois/post_spec.rb | Adds assertions for container structure and sets related_items: nil to preserve test intent |
| spec/requests/datacite_dois/content_negotiation_spec.rb | Expands CSL JSON expectations to include container-derived fields |
| spec/graphql/types/work_type_spec.rb | Updates formatted citation expectations to include container information and adds related_items: nil |
| spec/graphql/types/software_type_spec.rb | Updates formatted citation expectation to include container information |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jrhoads
left a comment
There was a problem hiding this comment.
Overall the PR looks good. I would wait until the update to bolognese is released and then update this PR with the released version. That way if the bolognese branch is deleted we don't have problems installing this application
Purpose
Historically, users have had to contribute a
descriptionwith descriptionTypeSeriesInformationvia XML to update thecontainerproperty in the Doi model. Thecontainerproperty is then used to create citation and metadata transformations within bolognese. This is a cumbersome and confusing process, and updates were difficult for users of the REST API and Fabrica form, who had to submit XML metadata to see results rather than using familiar interfaces and logical metadata fields, like relatedItem.This PR makes the accessor for
containerdynamic, calling agenerate_containermethod within bolognese to build container information from relatedItem and description metadata where available. See:If that metadata is not available, it defers to the value stored
containervalue in the database if there is any.Note that the factory for the Doi model has a relatedItem that maps to container in the new arrangement, so this metadata was excluded from some tests to preserve original intent.
closes: https://github.com/datacite/product-backlog/issues/513
Approach
Open Questions and Pre-Merge TODOs
Learning
Types of changes
Bug fix (non-breaking change which fixes an issue)
New feature (non-breaking change which adds functionality)
Breaking change (fix or feature that would cause existing functionality to change)
Reviewer, please remember our guidelines: