cocina-models 0.94.2 → 0.95.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e147c55355cc4c2f11ed358c5091c0942e48168948da875a1fd1ff97f7dfb95a
4
- data.tar.gz: fd668019a9193c1620d419b9a3815115a1bc0d8a93e635721bbf1251db80df10
3
+ metadata.gz: b9e38c26d285ece89fdd8adb1faf3cc5fd19bb4c905d7cdb7a3a338948bcd43d
4
+ data.tar.gz: 27aec9cce87dff1300ae06216eed4b9b8c7d2f449e6d8e5eebf209c99a201b94
5
5
  SHA512:
6
- metadata.gz: 3f9485a94c43606870b8d47f7b0d29597660fe82a884fab5128922501e65eccee5787c43a27f796dd35af36992bb04a417eb89e045e2bd74be4c8b30212e2d04
7
- data.tar.gz: 0707161a4e5399762878ed9d9215ae59a807d046fa7f3b199e09227f8fb5da69484b32dc0a942df5fb1281aafd8ec29a054b0eae04f40a68ceddc84fda15e406
6
+ metadata.gz: f9c71b2c8b8740baf151eb3dfe150e9a614cc9c655c03f8cbf4924f884d7ce94c2909ec9e5d9a229eac56bc694cc8b9d8142072762b120e2edba98e7fe49f137
7
+ data.tar.gz: 8cd9dd1787b286a9816714bf75b5d99a246ac390a914ffc83bbd6c9e79bc0d0cca1644cb4d2c16e1bbbd687a2407b3565645693ab6ac5ef60bf9ab564c4eef59
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cocina-models (0.94.2)
4
+ cocina-models (0.95.0)
5
5
  activesupport
6
6
  deprecation
7
7
  dry-struct (~> 1.0)
@@ -121,7 +121,7 @@ GEM
121
121
  rspec-core (>= 2, < 4, != 2.12.0)
122
122
  rss (0.3.0)
123
123
  rexml
124
- rubocop (1.60.1)
124
+ rubocop (1.60.2)
125
125
  json (~> 2.3)
126
126
  language_server-protocol (>= 3.17.0)
127
127
  parallel (~> 1.10)
data/README.md CHANGED
@@ -143,7 +143,7 @@ which pushes the gem to rubygems.org.
143
143
 
144
144
  ### Step 2: Update client gems coupled to the models
145
145
 
146
- Release new versions of [sdr-client](https://github.com/sul-dlss/sdr-client), [dor-services-client](https://github.com/sul-dlss/dor-services-client/), and [dor_indexing](https://github.com/sul-dlss/dor_indexing/) pinned to use the new cocina-models version because applications such as [Argo](https://github.com/sul-dlss/argo) depend on both of these gems using the same models.
146
+ Release new versions of [sdr-client](https://github.com/sul-dlss/sdr-client), [dor-services-client](https://github.com/sul-dlss/dor-services-client/), and [dor_indexing](https://github.com/sul-dlss/dor_indexing/) pinned to use the new cocina-models version because applications such as [Argo](https://github.com/sul-dlss/argo) and [Dor-Services-App](https://github.com/sul-dlss/dor-services-app)depend on these gems using the same models.
147
147
 
148
148
  ### Step 3: Update services directly coupled to the models
149
149
 
@@ -164,7 +164,9 @@ This can be accomplished by copying and pasting the cocina-models schemas to the
164
164
 
165
165
  If step 3A was needed, use the same PRs to also bump the versions of cocina-models, sdr-client, and dor-services-client in these applications/services. Why? When [dor-services-app](https://github.com/sul-dlss/dor-services-app), for example, is updated to use the new models (via the auto-update script), these clients should be updated at the same time or there is risk of models produced by dor-services-app not being acceptable to the clients.
166
166
 
167
- With or without step 3A, perform `bundle update` for cocina-models, sdr-client, and dor-services-client gems in the listed services and then make PRs for those repos.
167
+ With or without step 3A, perform `bundle update` for cocina-models, sdr-client, dor-services-client and dor_indexing* gems in the listed services and then make PRs for those repos.
168
+
169
+ * dor_indexing gem is used by dor_indexing_app and dor-services-app only.
168
170
 
169
171
  #### Step 3C: Merge 'em
170
172
 
@@ -14,6 +14,7 @@ module Cocina
14
14
  @attributes = attributes
15
15
  @error_paths_multiple = []
16
16
  @error_paths_blank = []
17
+ @error_paths_missing_title_type = []
17
18
  end
18
19
 
19
20
  def validate
@@ -23,11 +24,12 @@ module Cocina
23
24
 
24
25
  raise ValidationError, "Multiple value, groupedValue, structuredValue, and parallelValue in description: #{error_paths_multiple.join(', ')}" unless error_paths_multiple.empty?
25
26
  raise ValidationError, "Blank value in description: #{error_paths_blank.join(', ')}" unless error_paths_blank.empty?
27
+ raise ValidationError, "Missing type for value in description: #{error_paths_missing_title_type.join(', ')}" unless error_paths_missing_title_type.empty?
26
28
  end
27
29
 
28
30
  private
29
31
 
30
- attr_reader :clazz, :attributes, :error_paths_blank, :error_paths_multiple
32
+ attr_reader :clazz, :attributes, :error_paths_blank, :error_paths_multiple, :error_paths_missing_title_type
31
33
 
32
34
  def meets_preconditions?
33
35
  [Cocina::Models::Description, Cocina::Models::RequestDescription].include?(clazz)
@@ -36,6 +38,7 @@ module Cocina
36
38
  def validate_hash(hash, path)
37
39
  validate_values_for_blanks(hash, path)
38
40
  validate_values_for_multiples(hash, path)
41
+ validate_title_type(hash, path)
39
42
  hash.each do |key, obj|
40
43
  validate_obj(obj, path + [key])
41
44
  end
@@ -64,6 +67,19 @@ module Cocina
64
67
  error_paths_multiple << path_to_s(path)
65
68
  end
66
69
 
70
+ def validate_title_type(hash, path)
71
+ # only apply to title.structuredValue, title.parallelValue.structuredValue, or relatedResource.title with a value
72
+ return unless hash[:value] && (path.first == :title || related_resource_title?(path)) && path.include?(:structuredValue)
73
+
74
+ # if there is a "value" key, make sure there is also a "type" key, only for title.structuredValue
75
+ error_paths_missing_title_type << path_to_s(path) unless hash[:type]
76
+ end
77
+
78
+ def related_resource_title?(path)
79
+ # title is directly within relatedResource, e.g [:relatedResource, 0, :title, 0, :structuredValue, 0])
80
+ path.first == :relatedResource && path[2] == :title
81
+ end
82
+
67
83
  def path_to_s(path)
68
84
  # This matches the format used by descriptive spreadsheets
69
85
  path_str = ''
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Cocina
4
4
  module Models
5
- VERSION = '0.94.2'
5
+ VERSION = '0.95.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocina-models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.94.2
4
+ version: 0.95.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-26 00:00:00.000000000 Z
11
+ date: 2024-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -562,7 +562,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
562
562
  - !ruby/object:Gem::Version
563
563
  version: '0'
564
564
  requirements: []
565
- rubygems_version: 3.4.13
565
+ rubygems_version: 3.4.10
566
566
  signing_key:
567
567
  specification_version: 4
568
568
  summary: Data models for the SDR