cocina-models 0.94.2 → 0.95.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -0
- data/Gemfile.lock +27 -29
- data/README.md +9 -5
- data/lib/cocina/models/mapping/from_mods/note.rb +1 -6
- data/lib/cocina/models/validators/description_values_validator.rb +17 -1
- data/lib/cocina/models/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8438f0415f1a77a6d36bd426d7d363437bc8f1ff0764124d58e150a3c4b158a
|
4
|
+
data.tar.gz: 979ae98d269ca980a49851525fe517690d910ebbfc81b3c67180c0928002667f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8d79cc6e824f1456fe192f7b81c150b212bf9c2b678ec5b3195d1bbac481dd9787cbffb8f566ca0b0da21a1898c3c872d1643cb9fe30f55b6d8d2db6ac8018f
|
7
|
+
data.tar.gz: bf0e7dda581ec2b88fb35d26fd76f8efe2c353aa052abf1bdac580fafddbb6f5aeea7637f54cc5cf581e28ec402f88b15231b69a47a9590b857e6877af633162
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cocina-models (0.
|
4
|
+
cocina-models (0.95.1)
|
5
5
|
activesupport
|
6
6
|
deprecation
|
7
7
|
dry-struct (~> 1.0)
|
@@ -21,7 +21,7 @@ PATH
|
|
21
21
|
GEM
|
22
22
|
remote: https://rubygems.org/
|
23
23
|
specs:
|
24
|
-
activesupport (7.1.3)
|
24
|
+
activesupport (7.1.3.2)
|
25
25
|
base64
|
26
26
|
bigdecimal
|
27
27
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
@@ -45,10 +45,9 @@ GEM
|
|
45
45
|
connection_pool (2.4.1)
|
46
46
|
deprecation (1.1.0)
|
47
47
|
activesupport
|
48
|
-
diff-lcs (1.5.
|
48
|
+
diff-lcs (1.5.1)
|
49
49
|
docile (1.4.0)
|
50
|
-
drb (2.2.
|
51
|
-
ruby2_keywords
|
50
|
+
drb (2.2.1)
|
52
51
|
dry-core (1.0.1)
|
53
52
|
concurrent-ruby (~> 1.0)
|
54
53
|
zeitwerk (~> 2.6)
|
@@ -73,7 +72,7 @@ GEM
|
|
73
72
|
activesupport (>= 3.0, < 8.0)
|
74
73
|
equivalent-xml (0.6.0)
|
75
74
|
nokogiri (>= 1.4.3)
|
76
|
-
i18n (1.14.
|
75
|
+
i18n (1.14.4)
|
77
76
|
concurrent-ruby (~> 1.0)
|
78
77
|
ice_nine (0.11.2)
|
79
78
|
json (2.7.1)
|
@@ -82,10 +81,10 @@ GEM
|
|
82
81
|
multi_json
|
83
82
|
language_server-protocol (3.17.0.3)
|
84
83
|
mini_portile2 (2.8.5)
|
85
|
-
minitest (5.
|
84
|
+
minitest (5.22.2)
|
86
85
|
multi_json (1.15.0)
|
87
86
|
mutex_m (0.2.0)
|
88
|
-
nokogiri (1.16.
|
87
|
+
nokogiri (1.16.2)
|
89
88
|
mini_portile2 (~> 2.8.2)
|
90
89
|
racc (~> 1.4)
|
91
90
|
openapi3_parser (0.9.2)
|
@@ -99,29 +98,29 @@ GEM
|
|
99
98
|
patience_diff (1.2.0)
|
100
99
|
optimist (~> 3.0)
|
101
100
|
racc (1.7.3)
|
102
|
-
rack (3.0.
|
101
|
+
rack (3.0.9.1)
|
103
102
|
rainbow (3.1.1)
|
104
103
|
rake (13.1.0)
|
105
104
|
regexp_parser (2.9.0)
|
106
105
|
rexml (3.2.6)
|
107
|
-
rspec (3.
|
108
|
-
rspec-core (~> 3.
|
109
|
-
rspec-expectations (~> 3.
|
110
|
-
rspec-mocks (~> 3.
|
111
|
-
rspec-core (3.
|
112
|
-
rspec-support (~> 3.
|
113
|
-
rspec-expectations (3.
|
106
|
+
rspec (3.13.0)
|
107
|
+
rspec-core (~> 3.13.0)
|
108
|
+
rspec-expectations (~> 3.13.0)
|
109
|
+
rspec-mocks (~> 3.13.0)
|
110
|
+
rspec-core (3.13.0)
|
111
|
+
rspec-support (~> 3.13.0)
|
112
|
+
rspec-expectations (3.13.0)
|
114
113
|
diff-lcs (>= 1.2.0, < 2.0)
|
115
|
-
rspec-support (~> 3.
|
116
|
-
rspec-mocks (3.
|
114
|
+
rspec-support (~> 3.13.0)
|
115
|
+
rspec-mocks (3.13.0)
|
117
116
|
diff-lcs (>= 1.2.0, < 2.0)
|
118
|
-
rspec-support (~> 3.
|
119
|
-
rspec-support (3.
|
117
|
+
rspec-support (~> 3.13.0)
|
118
|
+
rspec-support (3.13.1)
|
120
119
|
rspec_junit_formatter (0.6.0)
|
121
120
|
rspec-core (>= 2, < 4, != 2.12.0)
|
122
121
|
rss (0.3.0)
|
123
122
|
rexml
|
124
|
-
rubocop (1.
|
123
|
+
rubocop (1.62.0)
|
125
124
|
json (~> 2.3)
|
126
125
|
language_server-protocol (>= 3.17.0)
|
127
126
|
parallel (~> 1.10)
|
@@ -129,38 +128,37 @@ GEM
|
|
129
128
|
rainbow (>= 2.2.2, < 4.0)
|
130
129
|
regexp_parser (>= 1.8, < 3.0)
|
131
130
|
rexml (>= 3.2.5, < 4.0)
|
132
|
-
rubocop-ast (>= 1.
|
131
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
133
132
|
ruby-progressbar (~> 1.7)
|
134
133
|
unicode-display_width (>= 2.4.0, < 3.0)
|
135
|
-
rubocop-ast (1.
|
136
|
-
parser (>= 3.
|
134
|
+
rubocop-ast (1.31.2)
|
135
|
+
parser (>= 3.3.0.4)
|
137
136
|
rubocop-capybara (2.20.0)
|
138
137
|
rubocop (~> 1.41)
|
139
138
|
rubocop-factory_bot (2.25.1)
|
140
139
|
rubocop (~> 1.41)
|
141
140
|
rubocop-rake (0.6.0)
|
142
141
|
rubocop (~> 1.0)
|
143
|
-
rubocop-rspec (2.
|
142
|
+
rubocop-rspec (2.27.1)
|
144
143
|
rubocop (~> 1.40)
|
145
144
|
rubocop-capybara (~> 2.17)
|
146
145
|
rubocop-factory_bot (~> 2.22)
|
147
146
|
ruby-progressbar (1.13.0)
|
148
|
-
ruby2_keywords (0.0.5)
|
149
147
|
simplecov (0.22.0)
|
150
148
|
docile (~> 1.1)
|
151
149
|
simplecov-html (~> 0.11)
|
152
150
|
simplecov_json_formatter (~> 0.1)
|
153
151
|
simplecov-html (0.12.3)
|
154
152
|
simplecov_json_formatter (0.1.4)
|
155
|
-
super_diff (0.
|
153
|
+
super_diff (0.11.0)
|
156
154
|
attr_extras (>= 6.2.4)
|
157
155
|
diff-lcs
|
158
156
|
patience_diff
|
159
|
-
thor (1.3.
|
157
|
+
thor (1.3.1)
|
160
158
|
tzinfo (2.0.6)
|
161
159
|
concurrent-ruby (~> 1.0)
|
162
160
|
unicode-display_width (2.5.0)
|
163
|
-
zeitwerk (2.6.
|
161
|
+
zeitwerk (2.6.13)
|
164
162
|
|
165
163
|
PLATFORMS
|
166
164
|
ruby
|
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
|
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,
|
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. You may need to update how these gems are pinned in the `Gemfile` in order to bump them.
|
168
|
+
|
169
|
+
NOTE: dor_indexing gem is used by dor-services-app and dor_indexing_app only. dor_indexing_app does NOT need to be updated in this step.
|
168
170
|
|
169
171
|
#### Step 3C: Merge 'em
|
170
172
|
|
@@ -180,12 +182,14 @@ There are scripts to help with updating other dependent applications:
|
|
180
182
|
|
181
183
|
There is a Jenkins CI job that you can run manually to create all the PRs you need. Head to https://sul-ci-prod.stanford.edu/job/SUL-DLSS/job/access-update-scripts/job/cocina-level2-updates/ and then click `Build Now`. Click the new build that is created and then `Console Output` to watch the build. Once it has completed, you can proceed with the next step.
|
182
184
|
|
183
|
-
If for some reason the above method does not work, the sul-dlss/access-update-scripts repo has a script for this: `cocina_level2_prs.rb
|
185
|
+
If for some reason the above method does not work, the sul-dlss/access-update-scripts repo has a script for this: [`cocina_level2_prs.rb`](https://github.com/sul-dlss/access-update-scripts/blob/master/cocina_level2_prs.rb). You will need a github access token with scopes of "read:org" and "repo" (see https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) to run it, as noted in the comments at the top of that script.
|
184
186
|
|
185
187
|
#### Step 4B: Merge the Cocina Level 2 PRs
|
186
188
|
|
187
|
-
[sul-dlss/access-update-scripts](https://github.com/sul-dlss/access-update-scripts) has a switch in the `merge-all.rb` script for this, as noted in the comments at the top of that script.
|
188
|
-
|
189
|
+
[sul-dlss/access-update-scripts](https://github.com/sul-dlss/access-update-scripts) has a switch in the `merge-all.rb` script for this, as noted in the comments at the top of that script.
|
190
|
+
```
|
191
|
+
REPOS_PATH=infrastructure GH_ACCESS_TOKEN=abc123 COCINA_LEVEL2= ./merge-all.rb
|
192
|
+
```
|
189
193
|
### Step 5: Deploy all affected applications together
|
190
194
|
|
191
195
|
[sul-dlss/sdr-deploy](https://github.com/sul-dlss/sdr-deploy) has a flag (-c) in the deploy script to limit deploys to cocina dependent applications. Refer to instructions in the [sdr-deploy/README](https://github.com/sul-dlss/sdr-deploy/blob/main/README.md#only-deploy-repos-related-to-cocina-models-update).
|
@@ -141,12 +141,7 @@ module Cocina
|
|
141
141
|
}.tap do |attributes|
|
142
142
|
value_language = LanguageScript.build(node: node)
|
143
143
|
attributes[:valueLanguage] = value_language if value_language
|
144
|
-
|
145
|
-
if value_parts.size == 1
|
146
|
-
attributes[:value] = node.content
|
147
|
-
elsif value_parts.present?
|
148
|
-
attributes[:structuredValue] = value_parts.map { |value_part| { value: value_part } }
|
149
|
-
end
|
144
|
+
attributes[:value] = node.content if node.content.present?
|
150
145
|
end.compact
|
151
146
|
end
|
152
147
|
|
@@ -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 = ''
|
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.
|
4
|
+
version: 0.95.1
|
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-
|
11
|
+
date: 2024-03-11 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.
|
565
|
+
rubygems_version: 3.4.10
|
566
566
|
signing_key:
|
567
567
|
specification_version: 4
|
568
568
|
summary: Data models for the SDR
|