cocina-models 0.91.2 → 0.91.3

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: be675cb9628dfffe8a5e2d7bd804966d80d489498e30ce5106ed30165b8296e5
4
- data.tar.gz: a7c51082c4c74bcaaab6bd5a433c9063bf8ec50a25ceb445c273dcba74915884
3
+ metadata.gz: 8062f7e04f843861947c0d53bf9d909620f991d262457f6ecb80842a67dcfe21
4
+ data.tar.gz: 9b1da95041e78c09ec88e70ec63cb940d29edcc22fd408428cd351a665223970
5
5
  SHA512:
6
- metadata.gz: e2bdbb3f395297c0265bc64e10c379f7742c315a62139580c29f84b21adf980a0ad7741b618a2f6102405b36e3040ef374fd12de75942c119d6e9f2d4625d478
7
- data.tar.gz: ea90f6775f38553cc3c6c2a39b6737788d95afb984a486847150e27da67d542f986afc2d97b14e81d440d3acf785773a74bc1a870b8a4d40e9a5acf97f16b67e
6
+ metadata.gz: dc5c8c49ed0765cd5281f7a5c3a05b92862b7c6e6e3d982891c381af2881d05026fe22f8d718c0219522f6dffe7639fda3d59e90c13a141f8fd693d17db3cecd
7
+ data.tar.gz: 78802018f0a02aa4683c01663535bacd89ded3ffe4ff43433e69d267f33283f935182aabf24d23d2abaceb2a748fae7208e6c9f4cb2f0b450ba06d22cab50dbe
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cocina-models (0.91.2)
4
+ cocina-models (0.91.3)
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.0.8)
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.3)
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.3)
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.1)
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.56.3)
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.3)
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.18.0)
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.0)
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.4.2)
151
- zeitwerk (2.6.11)
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
- **NOTE**: You may skip this step if the new release is a patch-level bump only, as the client gems are pinned to a minor release of cocina-models. However, a PR to update Gemfile.lock with the new cocina-models version is welcome ... and not a blocker.
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
 
@@ -87,9 +87,15 @@ module Cocina
87
87
  # rubocop:enable Metrics/ParameterLists
88
88
 
89
89
  def write_note(note)
90
- attributes = {}
91
- attributes[:authority] = note.source.code if note&.source&.code
92
- xml.send(note_tag_for(note), note.value, attributes)
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?(path, type_signature)
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?(path, type_signature)
68
- clean_path(path).last(type_signature.length) == type_signature
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|
@@ -18,16 +18,9 @@ module Cocina
18
18
 
19
19
  def self.validate(clazz, attributes)
20
20
  # This gets rid of nested model objects.
21
- # Once DSA is on Rails 6, this can be:
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|
21
+ attributes_hash = attributes.to_h.deep_transform_values do |value|
29
22
  value.class.name.starts_with?('Cocina::Models') ? value.to_h : value
30
- end.deep_symbolize_keys.with_indifferent_access
23
+ end.with_indifferent_access
31
24
  VALIDATORS.each { |validator| validator.validate(clazz, attributes_hash) }
32
25
  end
33
26
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Cocina
4
4
  module Models
5
- VERSION = '0.91.2'
5
+ VERSION = '0.91.3'
6
6
  end
7
7
  end
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/class/attribute'
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.2
4
+ version: 0.91.3
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-09-19 00:00:00.000000000 Z
11
+ date: 2023-10-17 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.4.13
548
+ rubygems_version: 3.3.7
549
549
  signing_key:
550
550
  specification_version: 4
551
551
  summary: Data models for the SDR