cocina-models 0.91.2 → 0.91.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +22 -11
- data/README.md +8 -5
- data/description_types.yml +2 -0
- data/lib/cocina/models/mapping/to_mods/event.rb +9 -3
- data/lib/cocina/models/validators/description_types_validator.rb +8 -6
- data/lib/cocina/models/validators/validator.rb +5 -10
- data/lib/cocina/models/version.rb +1 -1
- data/lib/cocina/models.rb +1 -5
- 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: a36a4c39bf28e6e40d3adccaccf0c89cd14b24c3807c8bde9ac6ee58fcb1b42e
|
4
|
+
data.tar.gz: 4898c15f9fbe3c6b1b3d3fb33edbe93b4fea5d2c1ca96edd25b91b9166967b29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 790a2ec388b08ace732d85d27b6544343f658b037791bff63d69527c3baa036073785ff52d4a67a5d483b7bda6da075068f3589db612130df9c15d76b29b7946
|
7
|
+
data.tar.gz: 9b73c7b24751999006863cb8c181f715ff7ff844b83db3d74b5f94a2297860b2a18b4fc31f41fb2ff5af8654d6e7ef1c6701299142b1b232f8d96b55dcd8f2c4
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cocina-models (0.91.
|
4
|
+
cocina-models (0.91.4)
|
5
5
|
activesupport
|
6
6
|
deprecation
|
7
7
|
dry-struct (~> 1.0)
|
@@ -20,14 +20,20 @@ PATH
|
|
20
20
|
GEM
|
21
21
|
remote: https://rubygems.org/
|
22
22
|
specs:
|
23
|
-
activesupport (7.
|
23
|
+
activesupport (7.1.1)
|
24
|
+
base64
|
25
|
+
bigdecimal
|
24
26
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
27
|
+
connection_pool (>= 2.2.5)
|
28
|
+
drb
|
25
29
|
i18n (>= 1.6, < 2)
|
26
30
|
minitest (>= 5.1)
|
31
|
+
mutex_m
|
27
32
|
tzinfo (~> 2.0)
|
28
33
|
ast (2.4.2)
|
29
34
|
attr_extras (7.1.0)
|
30
35
|
base64 (0.1.1)
|
36
|
+
bigdecimal (3.1.4)
|
31
37
|
byebug (11.1.3)
|
32
38
|
committee (5.0.0)
|
33
39
|
json_schema (~> 0.14, >= 0.14.3)
|
@@ -35,10 +41,13 @@ GEM
|
|
35
41
|
rack (>= 1.5)
|
36
42
|
commonmarker (0.23.10)
|
37
43
|
concurrent-ruby (1.2.2)
|
44
|
+
connection_pool (2.4.1)
|
38
45
|
deprecation (1.1.0)
|
39
46
|
activesupport
|
40
47
|
diff-lcs (1.5.0)
|
41
48
|
docile (1.4.0)
|
49
|
+
drb (2.1.1)
|
50
|
+
ruby2_keywords
|
42
51
|
dry-core (1.0.1)
|
43
52
|
concurrent-ruby (~> 1.0)
|
44
53
|
zeitwerk (~> 2.6)
|
@@ -67,12 +76,13 @@ GEM
|
|
67
76
|
ice_nine (0.11.2)
|
68
77
|
json (2.6.3)
|
69
78
|
json_schema (0.21.0)
|
70
|
-
jsonpath (1.1.
|
79
|
+
jsonpath (1.1.5)
|
71
80
|
multi_json
|
72
81
|
language_server-protocol (3.17.0.3)
|
73
82
|
mini_portile2 (2.8.4)
|
74
83
|
minitest (5.20.0)
|
75
84
|
multi_json (1.15.0)
|
85
|
+
mutex_m (0.1.2)
|
76
86
|
nokogiri (1.15.4)
|
77
87
|
mini_portile2 (~> 2.8.2)
|
78
88
|
racc (~> 1.4)
|
@@ -81,7 +91,7 @@ GEM
|
|
81
91
|
openapi_parser (1.0.0)
|
82
92
|
optimist (3.1.0)
|
83
93
|
parallel (1.23.0)
|
84
|
-
parser (3.2.2.
|
94
|
+
parser (3.2.2.4)
|
85
95
|
ast (~> 2.4.1)
|
86
96
|
racc
|
87
97
|
patience_diff (1.2.0)
|
@@ -90,7 +100,7 @@ GEM
|
|
90
100
|
rack (3.0.8)
|
91
101
|
rainbow (3.1.1)
|
92
102
|
rake (13.0.6)
|
93
|
-
regexp_parser (2.8.
|
103
|
+
regexp_parser (2.8.2)
|
94
104
|
rexml (3.2.6)
|
95
105
|
rspec (3.12.0)
|
96
106
|
rspec-core (~> 3.12.0)
|
@@ -109,12 +119,12 @@ GEM
|
|
109
119
|
rspec-core (>= 2, < 4, != 2.12.0)
|
110
120
|
rss (0.3.0)
|
111
121
|
rexml
|
112
|
-
rubocop (1.
|
122
|
+
rubocop (1.57.1)
|
113
123
|
base64 (~> 0.1.1)
|
114
124
|
json (~> 2.3)
|
115
125
|
language_server-protocol (>= 3.17.0)
|
116
126
|
parallel (~> 1.10)
|
117
|
-
parser (>= 3.2.2.
|
127
|
+
parser (>= 3.2.2.4)
|
118
128
|
rainbow (>= 2.2.2, < 4.0)
|
119
129
|
regexp_parser (>= 1.8, < 3.0)
|
120
130
|
rexml (>= 3.2.5, < 4.0)
|
@@ -123,17 +133,18 @@ GEM
|
|
123
133
|
unicode-display_width (>= 2.4.0, < 3.0)
|
124
134
|
rubocop-ast (1.29.0)
|
125
135
|
parser (>= 3.2.1.0)
|
126
|
-
rubocop-capybara (2.
|
136
|
+
rubocop-capybara (2.19.0)
|
127
137
|
rubocop (~> 1.41)
|
128
138
|
rubocop-factory_bot (2.24.0)
|
129
139
|
rubocop (~> 1.33)
|
130
140
|
rubocop-rake (0.6.0)
|
131
141
|
rubocop (~> 1.0)
|
132
|
-
rubocop-rspec (2.24.
|
142
|
+
rubocop-rspec (2.24.1)
|
133
143
|
rubocop (~> 1.33)
|
134
144
|
rubocop-capybara (~> 2.17)
|
135
145
|
rubocop-factory_bot (~> 2.22)
|
136
146
|
ruby-progressbar (1.13.0)
|
147
|
+
ruby2_keywords (0.0.5)
|
137
148
|
simplecov (0.22.0)
|
138
149
|
docile (~> 1.1)
|
139
150
|
simplecov-html (~> 0.11)
|
@@ -147,8 +158,8 @@ GEM
|
|
147
158
|
thor (1.2.2)
|
148
159
|
tzinfo (2.0.6)
|
149
160
|
concurrent-ruby (~> 1.0)
|
150
|
-
unicode-display_width (2.
|
151
|
-
zeitwerk (2.6.
|
161
|
+
unicode-display_width (2.5.0)
|
162
|
+
zeitwerk (2.6.12)
|
152
163
|
|
153
164
|
PLATFORMS
|
154
165
|
ruby
|
data/README.md
CHANGED
@@ -51,7 +51,7 @@ Beyond what is necessary to test the generator, the Cocina model classes are not
|
|
51
51
|
|
52
52
|
## Testing validation changes
|
53
53
|
|
54
|
-
If there is a possibility that a model or validation change will conflict with some existing objects then [validate-cocina](https://github.com/sul-dlss/dor-services-app/blob/main/bin/validate-cocina) should be used for testing. This must be run on sdr-infra since it requires deploying a branch of cocina-models.
|
54
|
+
If there is a possibility that a model, mapping, or validation change will conflict with some existing objects then [validate-cocina](https://github.com/sul-dlss/dor-services-app/blob/main/bin/validate-cocina) should be used for testing. This must be run on sdr-infra since it requires deploying a branch of cocina-models.
|
55
55
|
|
56
56
|
1. Create a cocina-models branch containing the proposed change and push to GitHub.
|
57
57
|
2. On sdr-infra, check out `main`, update the `Gemfile` so that cocina-models references the branch, and `bundle install`.
|
@@ -120,7 +120,12 @@ bundle exec bin/rails r -e production "BadIso8601Dates.report" > BadIso8601Dates
|
|
120
120
|
scp deploy@sdr-infra:/opt/app/deploy/dor-services-app/BadIso8601Dates.csv BadIso8601Dates.csv
|
121
121
|
```
|
122
122
|
|
123
|
-
## Releasing
|
123
|
+
## Releasing a patch change
|
124
|
+
A patch change is a change that (1) does not affect the data model; (2) does not alter the openapi.yml; and more broadly (3) does not matter if some applications have the change and others do not.
|
125
|
+
|
126
|
+
A patch change can be released as part of regular dependency updates or selectively released for individual applications.
|
127
|
+
|
128
|
+
## Releasing major or minor change
|
124
129
|
|
125
130
|
### Step 0: Share intent to change the models
|
126
131
|
|
@@ -136,9 +141,7 @@ which pushes the gem to rubygems.org.
|
|
136
141
|
|
137
142
|
### Step 2: Update client gems coupled to the models
|
138
143
|
|
139
|
-
|
140
|
-
|
141
|
-
If this is a minor or major cocina-models version change, release new versions of [sdr-client](https://github.com/sul-dlss/sdr-client) and [dor-services-client](https://github.com/sul-dlss/dor-services-client/) 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.
|
144
|
+
Release new versions of [sdr-client](https://github.com/sul-dlss/sdr-client) and [dor-services-client](https://github.com/sul-dlss/dor-services-client/) 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.
|
142
145
|
|
143
146
|
### Step 3: Update services directly coupled to the models
|
144
147
|
|
data/description_types.yml
CHANGED
@@ -87,9 +87,15 @@ module Cocina
|
|
87
87
|
# rubocop:enable Metrics/ParameterLists
|
88
88
|
|
89
89
|
def write_note(note)
|
90
|
-
|
91
|
-
|
92
|
-
|
90
|
+
if note.parallelValue.present?
|
91
|
+
note.parallelValue.each do |parallel_note|
|
92
|
+
write_note(parallel_note)
|
93
|
+
end
|
94
|
+
else
|
95
|
+
attributes = {}
|
96
|
+
attributes[:authority] = note.source.code if note&.source&.code
|
97
|
+
xml.send(note_tag_for(note), note.value, attributes)
|
98
|
+
end
|
93
99
|
end
|
94
100
|
|
95
101
|
def note_tag_for(note)
|
@@ -35,7 +35,7 @@ module Cocina
|
|
35
35
|
|
36
36
|
def validate_hash(hash, path)
|
37
37
|
hash.each do |key, obj|
|
38
|
-
if key == :type
|
38
|
+
if key.to_sym == :type
|
39
39
|
validate_type(obj, path)
|
40
40
|
else
|
41
41
|
validate_obj(obj, path + [key])
|
@@ -55,8 +55,10 @@ module Cocina
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def validate_type(type, path)
|
58
|
+
clean_path = clean_path(path)
|
58
59
|
valid_types.each do |type_signature, types|
|
59
|
-
next unless match?(
|
60
|
+
next unless match?(clean_path, type_signature)
|
61
|
+
|
60
62
|
break if types.include?(type.downcase)
|
61
63
|
|
62
64
|
error_paths << "#{path_to_s(path)} (#{type})"
|
@@ -64,15 +66,15 @@ module Cocina
|
|
64
66
|
end
|
65
67
|
end
|
66
68
|
|
67
|
-
def match?(
|
68
|
-
clean_path
|
69
|
+
def match?(clean_path, type_signature)
|
70
|
+
clean_path.last(type_signature.length) == type_signature
|
69
71
|
end
|
70
72
|
|
71
73
|
# Some part of the path are ignored for the purpose of matching.
|
72
74
|
def clean_path(path)
|
73
75
|
new_path = path.reject do |part|
|
74
|
-
part.is_a?(Integer) || %i[parallelValue parallelContributor parallelEvent].include?(part)
|
75
|
-
end
|
76
|
+
part.is_a?(Integer) || %i[parallelValue parallelContributor parallelEvent].include?(part.to_sym)
|
77
|
+
end.map(&:to_sym)
|
76
78
|
# This needs to happen after parallelValue is removed
|
77
79
|
# to handle structuredValue > parallelValue > structuredValue
|
78
80
|
new_path.reject.with_index do |part, index|
|
@@ -11,23 +11,18 @@ module Cocina
|
|
11
11
|
PurlValidator,
|
12
12
|
CatalogLinksValidator,
|
13
13
|
AssociatedNameValidator,
|
14
|
-
|
14
|
+
# Removing until production data can be remediated and/or additional types can be added to configuration.
|
15
|
+
# See also spec/cocina/models/validatable_spec.rb:59
|
16
|
+
# DescriptionTypesValidator,
|
15
17
|
DescriptionValuesValidator,
|
16
18
|
DateTimeValidator
|
17
19
|
].freeze
|
18
20
|
|
19
21
|
def self.validate(clazz, attributes)
|
20
22
|
# This gets rid of nested model objects.
|
21
|
-
|
22
|
-
# attributes_hash = attributes.to_h.deep_transform_values do |value|
|
23
|
-
# value.class.name.starts_with?('Cocina::Models') ? value.to_h : value
|
24
|
-
# end.with_indifferent_access
|
25
|
-
# And add require 'active_support/core_ext/hash/deep_transform_values' to models file.
|
26
|
-
|
27
|
-
# In the meantime, copying code.
|
28
|
-
attributes_hash = deep_transform_values(attributes.to_h) do |value|
|
23
|
+
attributes_hash = attributes.to_h.deep_transform_values do |value|
|
29
24
|
value.class.name.starts_with?('Cocina::Models') ? value.to_h : value
|
30
|
-
end.
|
25
|
+
end.with_indifferent_access
|
31
26
|
VALIDATORS.each { |validator| validator.validate(clazz, attributes_hash) }
|
32
27
|
end
|
33
28
|
|
data/lib/cocina/models.rb
CHANGED
@@ -9,11 +9,7 @@ require 'yaml'
|
|
9
9
|
require 'openapi_parser'
|
10
10
|
require 'openapi3_parser'
|
11
11
|
require 'active_support'
|
12
|
-
require 'active_support/core_ext
|
13
|
-
require 'active_support/core_ext/enumerable'
|
14
|
-
require 'active_support/core_ext/hash/indifferent_access'
|
15
|
-
require 'active_support/core_ext/string'
|
16
|
-
require 'active_support/core_ext/object/deep_dup'
|
12
|
+
require 'active_support/core_ext'
|
17
13
|
require 'thor'
|
18
14
|
|
19
15
|
# Help Zeitwerk find some of our classes
|
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.91.
|
4
|
+
version: 0.91.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -545,7 +545,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
545
545
|
- !ruby/object:Gem::Version
|
546
546
|
version: '0'
|
547
547
|
requirements: []
|
548
|
-
rubygems_version: 3.
|
548
|
+
rubygems_version: 3.3.7
|
549
549
|
signing_key:
|
550
550
|
specification_version: 4
|
551
551
|
summary: Data models for the SDR
|