Skip to content

Commit

Permalink
Merge pull request #5084 from sul-dlss/bump-cocina
Browse files Browse the repository at this point in the history
Bump cocina models
  • Loading branch information
aaron-collier authored Jun 13, 2024
2 parents 21ac887 + cf2ae55 commit 879d75b
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 84 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem 'rails', '~> 7.1.0'

# DLSS/domain-specific dependencies
gem 'cocina-models', '~> 0.97.0'
gem 'cocina-models', '~> 0.98.0'
gem 'datacite', '~> 0.3.0'
gem 'dor-workflow-client', '~> 7.3'
gem 'druid-tools', '~> 2.2'
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ GEM
capistrano-bundler (>= 1.1, < 3)
capistrano-shared_configs (0.2.2)
chronic (0.10.2)
cocina-models (0.97.0)
cocina-models (0.98.0)
activesupport
deprecation
dry-struct (~> 1.0)
Expand Down Expand Up @@ -581,7 +581,7 @@ DEPENDENCIES
capistrano-passenger
capistrano-rails
capistrano-shared_configs
cocina-models (~> 0.97.0)
cocina-models (~> 0.98.0)
committee
config
daemons
Expand Down
4 changes: 1 addition & 3 deletions app/services/publish/public_cocina_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ def build
# remove partOfProject (similar to how we remove tags from identityMetadata)
# and rewrite release tags with the tags from the collection.
def build_administrative
Cocina::Models::Administrative.new(cocina.administrative.to_h
.except(:partOfProject)
.merge(releaseTags: ReleaseTagService.for_public_metadata(cocina_object: cocina)))
Cocina::Models::Administrative.new(cocina.administrative.to_h.except(:partOfProject))
end

def build_structural
Expand Down
5 changes: 0 additions & 5 deletions openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1484,11 +1484,6 @@ components:
properties:
hasAdminPolicy:
$ref: "#/components/schemas/Druid"
releaseTags:
description: Tags for release
type: array
items:
$ref: "#/components/schemas/ReleaseTag"
required:
- hasAdminPolicy
AdminPolicyAccessTemplate:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
"download": "world"
},
"administrative": {
"hasAdminPolicy": "druid:hy787xj5878",
"releaseTags": [

]
"hasAdminPolicy": "druid:hy787xj5878"
}
}
4 changes: 2 additions & 2 deletions spec/requests/create_collection_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"cocinaVersion":"#{Cocina::Models::VERSION}",
"type":"#{Cocina::Models::ObjectType.collection}",
"label":"#{label}","version":1,"access":{"view":"world"},
"administrative":{"releaseTags":[],"hasAdminPolicy":"druid:dd999df4567"},
"administrative":{"hasAdminPolicy":"druid:dd999df4567"},
"description":{"title":[{"value":"#{title}"}]},
"identification":#{identification.to_json}}
JSON
Expand Down Expand Up @@ -97,7 +97,7 @@
"cocinaVersion":"#{Cocina::Models::VERSION}",
"type":"#{Cocina::Models::ObjectType.collection}",
"label":"#{label}","version":1,"access":{"view":"world"},
"administrative":{"releaseTags":[],"hasAdminPolicy":"druid:dd999df4567","partOfProject":"Hydrus"},
"administrative":{"hasAdminPolicy":"druid:dd999df4567","partOfProject":"Hydrus"},
"identification":{"sourceId":"hydrus:collection-456"},
"description":{"title":[{"value":"#{title}"}]}
}
Expand Down
12 changes: 6 additions & 6 deletions spec/requests/create_object_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"copyright":"All rights reserved unless otherwise indicated.",
"useAndReproductionStatement":"Property rights reside with the repository..."
},
"administrative":{"releaseTags":[],"hasAdminPolicy":"#{admin_policy_id}","partOfProject":"Google Books"},
"administrative":{"hasAdminPolicy":"#{admin_policy_id}","partOfProject":"Google Books"},
"description":{"title":[{"value":"#{title}"}]},
"identification":#{identification.to_json},
"structural":#{structural.to_json}}
Expand Down Expand Up @@ -492,7 +492,7 @@
"cocinaVersion":"#{Cocina::Models::VERSION}",
"type":"#{Cocina::Models::ObjectType.image}",
"label":"#{label}","version":1,
"administrative":{"releaseTags":[],"hasAdminPolicy":"#{admin_policy_id}","partOfProject":"Google Books"},
"administrative":{"hasAdminPolicy":"#{admin_policy_id}","partOfProject":"Google Books"},
"description":{"title":[{"value":"#{title}"}]},
"identification":#{identification.to_json},
"structural":#{structural.to_json}}
Expand Down Expand Up @@ -540,7 +540,7 @@
"cocinaVersion":"#{Cocina::Models::VERSION}",
"type":"#{Cocina::Models::ObjectType.book}",
"label":"#{label}","version":1,"access":{"view":"world","download":"world"},
"administrative":{"releaseTags":[],"hasAdminPolicy":"#{admin_policy_id}"},
"administrative":{"hasAdminPolicy":"#{admin_policy_id}"},
"description":{"title":[{"value":"#{title}"}]},
"identification":{"sourceId":"googlebooks:999999"},
"structural":{"hasMemberOrders":[{"viewingDirection":"right-to-left"}]}}
Expand Down Expand Up @@ -692,7 +692,7 @@
"type":"#{Cocina::Models::ObjectType.book}",
"label":"This is my label","version":1,"access":{"view":"stanford","download":"none","controlledDigitalLending":false,
"embargo":{"view":"world","download":"world","releaseDate":"2020-02-29T07:00:00.000+00:00"}},
"administrative":{"releaseTags":[],"hasAdminPolicy":"#{admin_policy_id}"},
"administrative":{"hasAdminPolicy":"#{admin_policy_id}"},
"description":{"title":[{"value":"This is my title"}]},
"identification":{"sourceId":"googlebooks:999999"},
"structural":{"hasMemberOrders":[{"viewingDirection":"right-to-left"}]}}
Expand Down Expand Up @@ -749,7 +749,7 @@
"type":"#{Cocina::Models::ObjectType.book}",
"label":"This is my label","version":1,
"access":{"view":"location-based","download":"location-based","location":"m&m"},
"administrative":{"releaseTags":[],"hasAdminPolicy":"#{admin_policy_id}"},
"administrative":{"hasAdminPolicy":"#{admin_policy_id}"},
"description":{"title":[{"value":"This is my title"}]},
"identification":{"sourceId":"googlebooks:999999"},
"structural":{"hasMemberOrders":[{"viewingDirection":"right-to-left"}]}}
Expand Down Expand Up @@ -795,7 +795,7 @@
"type":"#{Cocina::Models::ObjectType.book}",
"label":"This is my label","version":1,
"access":{"view":"world","download":"none"},
"administrative":{"releaseTags":[],"hasAdminPolicy":"#{admin_policy_id}"},
"administrative":{"hasAdminPolicy":"#{admin_policy_id}"},
"description":{"title":[{"value":"This is my title"}]},
"identification":{"sourceId":"googlebooks:999999"},
"structural":{"hasMemberOrders":[{"viewingDirection":"right-to-left"}]}}
Expand Down
22 changes: 2 additions & 20 deletions spec/requests/show_object_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,7 @@
useAndReproductionStatement: 'Property rights reside with the repository...'
},
administrative: {
hasAdminPolicy: 'druid:df123cd4567',
releaseTags: [
{
to: 'Searchworks',
what: 'self',
date: '2014-08-30T01:06:28.000+00:00',
who: 'petucket',
release: true
}
]
hasAdminPolicy: 'druid:df123cd4567'
},
description: {
title: [
Expand Down Expand Up @@ -74,16 +65,7 @@
useAndReproductionStatement: 'Property rights reside with the repository...'
},
administrative: {
hasAdminPolicy: 'druid:df123cd4567',
releaseTags: [
{
to: 'Searchworks',
what: 'self',
date: '2014-08-30T01:06:28.000+00:00',
who: 'petucket',
release: true
}
]
hasAdminPolicy: 'druid:df123cd4567'
},
description: {
title: [
Expand Down
16 changes: 8 additions & 8 deletions spec/requests/update_metadata_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"copyright":"All rights reserved unless otherwise indicated.",
"useAndReproductionStatement":"Property rights reside with the repository..."
},
"administrative":{"releaseTags":[],"hasAdminPolicy":"#{apo_druid}"},
"administrative":{"hasAdminPolicy":"#{apo_druid}"},
"description":#{description.to_json},
"identification":#{identification.to_json},
"structural":{
Expand Down Expand Up @@ -124,7 +124,7 @@
"copyright":"All rights reserved unless otherwise indicated.",
"useAndReproductionStatement":"Property rights reside with the repository..."
},
"administrative":{"releaseTags":[],"hasAdminPolicy":"druid:dd999df4567"},
"administrative":{"hasAdminPolicy":"druid:dd999df4567"},
"description":#{description.to_json},
"identification":#{identification.to_json},
"structural":{
Expand Down Expand Up @@ -239,7 +239,7 @@
"copyright":"All rights reserved unless otherwise indicated.",
"useAndReproductionStatement":"Property rights reside with the repository..."
},
"administrative":{"releaseTags":[],"hasAdminPolicy":"druid:dd999df4567"},
"administrative":{"hasAdminPolicy":"druid:dd999df4567"},
"description":{
"title":[{"value":"#{title}"}],
"purl":"#{purl}"
Expand Down Expand Up @@ -433,7 +433,7 @@
"copyright":"All rights reserved unless otherwise indicated.",
"useAndReproductionStatement":"Property rights reside with the repository..."
},
"administrative":{"releaseTags":[],"hasAdminPolicy":"druid:dd999df4567"},
"administrative":{"hasAdminPolicy":"druid:dd999df4567"},
"description":{
"title":[{"value":"#{title}"}],
"purl":"#{purl}"
Expand Down Expand Up @@ -560,7 +560,7 @@
"copyright":"All rights reserved unless otherwise indicated.",
"useAndReproductionStatement":"Property rights reside with the repository..."
},
"administrative":{"releaseTags":[],"hasAdminPolicy":"druid:dd999df4567"},
"administrative":{"hasAdminPolicy":"druid:dd999df4567"},
"description":{
"title":[{"value":"#{title}"}],
"purl":"#{purl}"
Expand Down Expand Up @@ -607,7 +607,7 @@
"view":"world",
"download":"world"
},
"administrative":{"releaseTags":[],"hasAdminPolicy":"druid:dd999df4567"},
"administrative":{"hasAdminPolicy":"druid:dd999df4567"},
"description":{
"title":[{"value":"#{title}"}],
"purl":"#{purl}"
Expand Down Expand Up @@ -661,7 +661,7 @@
"label":"#{label}","version":1,
"access":{},
"identification":#{identification.to_json},
"administrative":{"releaseTags":[],"hasAdminPolicy":"druid:dd999df4567"},
"administrative":{"hasAdminPolicy":"druid:dd999df4567"},
"description":{
"title":[{"value":"#{title}"}],
"purl":"#{purl}"
Expand Down Expand Up @@ -817,7 +817,7 @@
"access":{"view":"stanford","download":"stanford",
"embargo":{"view":"world","download":"world","releaseDate":"2020-02-29T07:00:00.000+00:00"}
},
"administrative":{"releaseTags":[],"hasAdminPolicy":"#{apo_druid}"},
"administrative":{"hasAdminPolicy":"#{apo_druid}"},
"description":{
"title":[{"value":"This is my title"}],
"purl":"#{purl}"
Expand Down
3 changes: 1 addition & 2 deletions spec/services/cocina/serializer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@
license: 'https://creativecommons.org/publicdomain/zero/1.0/legalcode'
},
administrative: {
hasAdminPolicy: 'druid:zw306xn5593',
releaseTags: []
hasAdminPolicy: 'druid:zw306xn5593'
},
description: {
title: [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
<<~JSON
{ "type":"#{object_type}",
"label":"The object label","version":1,"access":{"view":"world","download":"world"},
"administrative":{"releaseTags":[],"hasAdminPolicy":"druid:dd999df4567"},
"administrative":{"hasAdminPolicy":"druid:dd999df4567"},
"description":{"title":[{"status":"primary","value":"the object title"}]},
"identification":{"sourceId":"sul:9999999"},
"structural":#{structural.to_json}}
Expand Down Expand Up @@ -688,7 +688,7 @@
{ "externalIdentifier":"druid:bc123df5678",
"type":"#{object_type}",
"label":"The object label","version":1,"access":{"view":"world","download":"world"},
"administrative":{"releaseTags":[],"hasAdminPolicy":"druid:dd999df4567"},
"administrative":{"hasAdminPolicy":"druid:dd999df4567"},
"description":{
"title":[{"status":"primary","value":"the object title"}],
"purl":"https://purl.stanford.edu/bc123df5678"
Expand Down Expand Up @@ -767,7 +767,7 @@
{ "externalIdentifier":"druid:bc123df5678",
"type":"#{object_type}",
"label":"The object label","version":1,"access":{"view":"world","download":"world"},
"administrative":{"releaseTags":[],"hasAdminPolicy":"druid:dd999df4567"},
"administrative":{"hasAdminPolicy":"druid:dd999df4567"},
"description":{
"title":[{"status":"primary","value":"the object title"}],
"purl":"https://purl.stanford.edu/bc123df5678"
Expand Down
8 changes: 2 additions & 6 deletions spec/services/indexing/indexers/releasable_indexer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
let(:cocina) { build(:dro).new(administrative:) }
let(:administrative) do
{
hasAdminPolicy: apo_id,
releaseTags: release_tags
hasAdminPolicy: apo_id
}
end
let(:apo_id) { 'druid:gf999hb9999' }
Expand Down Expand Up @@ -86,10 +85,7 @@
context 'with a parent collection' do
let(:parent_collections) { [collection] }
let(:collection) do
instance_double(Cocina::Models::Collection, externalIdentifier: collection_druid, administrative: collection_administrative)
end
let(:collection_administrative) do
instance_double(Cocina::Models::Administrative, releaseTags: collection_release_tags)
instance_double(Cocina::Models::Collection, externalIdentifier: collection_druid)
end
let(:collection_druid) { 'druid:bc123fg4567' }
let(:collection_release_tags) { [] }
Expand Down
19 changes: 0 additions & 19 deletions spec/services/publish/public_cocina_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,24 +157,5 @@
expect { create }.to raise_error(RuntimeError, 'unexpected call to PublicCocinaService.build for druid:bc123df4567')
end
end

context 'when there are multiple release tags per target' do
subject(:release_tags) { create.administrative.releaseTags }

let(:cocina_object) { build(:dro) }
let(:druid) { cocina_object.externalIdentifier }

before do
ReleaseTag.create!(druid:, who: 'petucket', what: 'self', released_to: 'Searchworks', release: true)
ReleaseTag.create!(druid:, who: 'petucket', what: 'self', released_to: 'Searchworks', release: false, created_at: 1.year.ago)
ReleaseTag.create!(druid:, who: 'petucket', what: 'self', released_to: 'PURL sitemap', release: true)
end

it 'includes only the latest releaseData element from release tags for each target' do
expect(release_tags.size).to eq 2
expect(release_tags.map(&:release)).to eq [true, true]
expect(release_tags.map(&:to)).to eq ['Searchworks', 'PURL sitemap']
end
end
end
end
4 changes: 1 addition & 3 deletions spec/services/release_tag_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@
let(:cocina_object) do
build(:dro, id: druid, collection_ids:).new(
administrative: {
hasAdminPolicy: apo_id,
releaseTags: cocina_release_tags
hasAdminPolicy: apo_id
}
)
end
let(:apo_id) { 'druid:qv648vd4392' }
let(:collection_druid) { 'druid:xh235dd9059' }
let(:druid) { 'druid:bb004bn8654' }
let(:cocina_release_tags) { [] }
let(:collection_ids) { [] }

describe '.for_public_metadata' do
Expand Down

0 comments on commit 879d75b

Please sign in to comment.