cocina-models 0.96.0 → 0.97.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: da05dda48140bb467d82b84614b44beea26884fcd4cd0891a507a53e6f967e5b
4
- data.tar.gz: 322900e86d817d5d65820389fb7a6a13c92d98e4b9d6f2150e49de4ddd34785a
3
+ metadata.gz: 41b1ed014f467e4d5245d388ba185903b5bd8527399bbc3d52b22f1e5d313255
4
+ data.tar.gz: d7f1c463d42905960332923223bca29492a1f697062ea1dd5d2793484a5ff40f
5
5
  SHA512:
6
- metadata.gz: ce287a4da425257a40eb13e68f7eb7c2819fcd4658cef4d1fa81dae961d4e47df7a33ed2fe385e69a122c5542f73e42a441064e8d4f36fdafa8fdf6cc1bdaa84
7
- data.tar.gz: cf060d2984d736229e2fbd68ba28e7b3b68efae7e4f393ca0c6bdf7d09fa6ccaa8cfc6c2c0924b37c498b2d762b5817c36a74f31953a72550cd68b748ecdd355
6
+ metadata.gz: 0af59e6e0002648b6fe5136b430526b7de35feec48ae4bf8b343d92fe4656b55642ed43a64658d4d0190c0703b9b247ec1ce2c0601463858ee3ba76eab07f742
7
+ data.tar.gz: 59ee48b89dde85e375a5887d28ee2d2bc242aadaf6d5364907309d0e28b801b7ddbe64081688a7a087f33c6cd777b554d4239fc485858ceb816823b887112357
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cocina-models (0.96.0)
4
+ cocina-models (0.97.0)
5
5
  activesupport
6
6
  deprecation
7
7
  dry-struct (~> 1.0)
@@ -13,7 +13,6 @@ PATH
13
13
  nokogiri
14
14
  openapi3_parser
15
15
  openapi_parser (~> 1.0)
16
- rss
17
16
  super_diff
18
17
  thor
19
18
  zeitwerk (~> 2.1)
@@ -34,7 +33,7 @@ GEM
34
33
  ast (2.4.2)
35
34
  attr_extras (7.1.0)
36
35
  base64 (0.2.0)
37
- bigdecimal (3.1.7)
36
+ bigdecimal (3.1.8)
38
37
  byebug (11.1.3)
39
38
  committee (5.0.0)
40
39
  json_schema (~> 0.14, >= 0.14.3)
@@ -72,19 +71,19 @@ GEM
72
71
  activesupport (>= 3.0, < 8.0)
73
72
  equivalent-xml (0.6.0)
74
73
  nokogiri (>= 1.4.3)
75
- i18n (1.14.4)
74
+ i18n (1.14.5)
76
75
  concurrent-ruby (~> 1.0)
77
76
  ice_nine (0.11.2)
78
- json (2.7.1)
77
+ json (2.7.2)
79
78
  json_schema (0.21.0)
80
79
  jsonpath (1.1.5)
81
80
  multi_json
82
81
  language_server-protocol (3.17.0.3)
83
- mini_portile2 (2.8.5)
82
+ mini_portile2 (2.8.6)
84
83
  minitest (5.22.3)
85
84
  multi_json (1.15.0)
86
85
  mutex_m (0.2.0)
87
- nokogiri (1.16.3)
86
+ nokogiri (1.16.5)
88
87
  mini_portile2 (~> 2.8.2)
89
88
  racc (~> 1.4)
90
89
  openapi3_parser (0.9.2)
@@ -92,16 +91,16 @@ GEM
92
91
  openapi_parser (1.0.0)
93
92
  optimist (3.1.0)
94
93
  parallel (1.24.0)
95
- parser (3.3.0.5)
94
+ parser (3.3.1.0)
96
95
  ast (~> 2.4.1)
97
96
  racc
98
97
  patience_diff (1.2.0)
99
98
  optimist (~> 3.0)
100
99
  racc (1.7.3)
101
- rack (3.0.10)
100
+ rack (3.0.11)
102
101
  rainbow (3.1.1)
103
- rake (13.1.0)
104
- regexp_parser (2.9.0)
102
+ rake (13.2.1)
103
+ regexp_parser (2.9.1)
105
104
  rexml (3.2.6)
106
105
  rspec (3.13.0)
107
106
  rspec-core (~> 3.13.0)
@@ -112,15 +111,13 @@ GEM
112
111
  rspec-expectations (3.13.0)
113
112
  diff-lcs (>= 1.2.0, < 2.0)
114
113
  rspec-support (~> 3.13.0)
115
- rspec-mocks (3.13.0)
114
+ rspec-mocks (3.13.1)
116
115
  diff-lcs (>= 1.2.0, < 2.0)
117
116
  rspec-support (~> 3.13.0)
118
117
  rspec-support (3.13.1)
119
118
  rspec_junit_formatter (0.6.0)
120
119
  rspec-core (>= 2, < 4, != 2.12.0)
121
- rss (0.3.0)
122
- rexml
123
- rubocop (1.62.1)
120
+ rubocop (1.63.5)
124
121
  json (~> 2.3)
125
122
  language_server-protocol (>= 3.17.0)
126
123
  parallel (~> 1.10)
@@ -131,18 +128,21 @@ GEM
131
128
  rubocop-ast (>= 1.31.1, < 2.0)
132
129
  ruby-progressbar (~> 1.7)
133
130
  unicode-display_width (>= 2.4.0, < 3.0)
134
- rubocop-ast (1.31.2)
135
- parser (>= 3.3.0.4)
131
+ rubocop-ast (1.31.3)
132
+ parser (>= 3.3.1.0)
136
133
  rubocop-capybara (2.20.0)
137
134
  rubocop (~> 1.41)
138
135
  rubocop-factory_bot (2.25.1)
139
136
  rubocop (~> 1.41)
140
137
  rubocop-rake (0.6.0)
141
138
  rubocop (~> 1.0)
142
- rubocop-rspec (2.27.1)
139
+ rubocop-rspec (2.29.2)
143
140
  rubocop (~> 1.40)
144
141
  rubocop-capybara (~> 2.17)
145
142
  rubocop-factory_bot (~> 2.22)
143
+ rubocop-rspec_rails (~> 2.28)
144
+ rubocop-rspec_rails (2.28.3)
145
+ rubocop (~> 1.40)
146
146
  ruby-progressbar (1.13.0)
147
147
  simplecov (0.22.0)
148
148
  docile (~> 1.1)
@@ -150,7 +150,7 @@ GEM
150
150
  simplecov_json_formatter (~> 0.1)
151
151
  simplecov-html (0.12.3)
152
152
  simplecov_json_formatter (0.1.4)
153
- super_diff (0.11.0)
153
+ super_diff (0.12.1)
154
154
  attr_extras (>= 6.2.4)
155
155
  diff-lcs
156
156
  patience_diff
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) and [Dor-Services-App](https://github.com/sul-dlss/dor-services-app) depend on these gems using the same models.
146
+ 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) 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,9 +164,7 @@ 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, 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.
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. You may need to update how these gems are pinned in the `Gemfile` in order to bump them.
170
168
 
171
169
  #### Step 3C: Merge 'em
172
170
 
@@ -186,7 +184,7 @@ If for some reason the above method does not work, the sul-dlss/access-update-sc
186
184
 
187
185
  #### Step 4B: Merge the Cocina Level 2 PRs
188
186
 
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.
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.
190
188
  ```
191
189
  REPOS_PATH=infrastructure GH_ACCESS_TOKEN=abc123 COCINA_LEVEL2= ./merge-all.rb
192
190
  ```
@@ -37,7 +37,6 @@ Gem::Specification.new do |spec|
37
37
  # Match these version requirements to what committee wants,
38
38
  # so that our client (non-committee) users have the same dependencies.
39
39
  spec.add_dependency 'openapi_parser', '~> 1.0'
40
- spec.add_dependency 'rss' # used for date/time validation
41
40
  spec.add_dependency 'super_diff'
42
41
  spec.add_dependency 'thor'
43
42
  spec.add_dependency 'zeitwerk', '~> 2.1'
@@ -24,8 +24,12 @@ module Cocina
24
24
  attribute? :hasMimeType, Types::Strict::String
25
25
  # BCP 47 language tag: https://www.rfc-editor.org/rfc/rfc4646.txt -- other applications (like media players) expect language codes of this format, see e.g. https://videojs.com/guides/text-tracks/#srclang
26
26
  attribute? :languageTag, LanguageTag.optional
27
- # Use for the File.
27
+ # Use for the File (e.g. "transcription" for OCR).
28
28
  attribute? :use, FileUse.optional
29
+ # Indicates if the text (OCR/captioning) was generated by SDR.
30
+ attribute? :sdrGeneratedText, Types::Strict::Bool.default(false)
31
+ # Indicates if text that has been verified for accessibility/correctness.
32
+ attribute? :correctedForAccessibility, Types::Strict::Bool.default(false)
29
33
  attribute :hasMessageDigests, Types::Strict::Array.of(MessageDigest).default([].freeze)
30
34
  attribute(:access, FileAccess.default { FileAccess.new })
31
35
  attribute(:administrative, FileAdministrative.default { FileAdministrative.new })
@@ -16,8 +16,12 @@ module Cocina
16
16
  # BCP 47 language tag: https://www.rfc-editor.org/rfc/rfc4646.txt -- other applications (like media players) expect language codes of this format, see e.g. https://videojs.com/guides/text-tracks/#srclang
17
17
  attribute? :languageTag, LanguageTag.optional
18
18
  attribute? :externalIdentifier, Types::Strict::String
19
- # Use for the File.
19
+ # Use for the File (e.g. "transcription" for OCR).
20
20
  attribute? :use, FileUse.optional
21
+ # Indicates if the text (OCR/captioning) was generated by SDR.
22
+ attribute? :sdrGeneratedText, Types::Strict::Bool.default(false)
23
+ # Indicates if text that has been verified for accessibility/correctness.
24
+ attribute? :correctedForAccessibility, Types::Strict::Bool.default(false)
21
25
  attribute :hasMessageDigests, Types::Strict::Array.of(MessageDigest).default([].freeze)
22
26
  attribute(:access, FileAccess.default { FileAccess.new })
23
27
  attribute(:administrative, FileAdministrative.default { FileAdministrative.new })
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'edtf'
4
4
  require 'jsonpath'
5
- require 'rss'
6
5
 
7
6
  module Cocina
8
7
  module Models
@@ -87,18 +86,7 @@ module Cocina
87
86
  end
88
87
 
89
88
  def valid_w3cdtf?(value)
90
- Time.w3cdtf(value)
91
- true
92
- rescue StandardError
93
- # NOTE: the upstream W3CDTF implementation in the `rss` gem does not
94
- # allow two patterns that should be valid per the specification:
95
- #
96
- # * YYYY
97
- # * YYYY-MM
98
- #
99
- # This catches the false positives from the upstream gem and allow
100
- # these two patterns to validate
101
- /\A\d{4}(-0[1-9]|-1[0-2])?\Z/.match?(value)
89
+ W3cdtfValidator.validate(value)
102
90
  end
103
91
 
104
92
  def druid
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cocina
4
+ module Models
5
+ module Validators
6
+ # Validates w3cdtf date
7
+ class W3cdtfValidator
8
+ REGEX = /\A(?<year>\d{4})(?:-(?<month>\d\d)(?:-(?<day>\d\d)(?<time>T\d\d:\d\d(?::\d\d(?:.\d+)?)?(?:Z|[+-]\d\d:\d\d))?)?)?\z/ix
9
+
10
+ def self.validate(date)
11
+ new(date).validate
12
+ end
13
+
14
+ def initialize(date)
15
+ @date = date
16
+ end
17
+
18
+ # The W3CDTF format is defined here: http://www.w3.org/TR/NOTE-datetime
19
+ #
20
+ # Year:
21
+ # YYYY (eg 1997)
22
+ # Year and month:
23
+ # YYYY-MM (eg 1997-07)
24
+ # Complete date:
25
+ # YYYY-MM-DD (eg 1997-07-16)
26
+ # Complete date plus hours and minutes:
27
+ # YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00)
28
+ # Complete date plus hours, minutes and seconds:
29
+ # YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00)
30
+ # Complete date plus hours, minutes, seconds and a decimal fraction of a second
31
+ # YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00)
32
+ def validate
33
+ return false unless (matches = @date.match(REGEX))
34
+ return true unless matches[:month]
35
+ return (1..12).include? matches[:month].to_i unless matches[:day]
36
+
37
+ Date.parse(@date)
38
+
39
+ true
40
+ rescue Date::Error
41
+ false
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Cocina
4
4
  module Models
5
- VERSION = '0.96.0'
5
+ VERSION = '0.97.0'
6
6
  end
7
7
  end
data/openapi.yml CHANGED
@@ -1049,6 +1049,14 @@ components:
1049
1049
  $ref: '#/components/schemas/LanguageTag'
1050
1050
  use:
1051
1051
  $ref: '#/components/schemas/FileUse'
1052
+ sdrGeneratedText:
1053
+ description: Indicates if the text (OCR/captioning) was generated by SDR.
1054
+ type: boolean
1055
+ default: false
1056
+ correctedForAccessibility:
1057
+ description: Indicates if text that has been verified for accessibility/correctness.
1058
+ type: boolean
1059
+ default: false
1052
1060
  hasMessageDigests:
1053
1061
  type: array
1054
1062
  items:
@@ -1144,7 +1152,7 @@ components:
1144
1152
  items:
1145
1153
  $ref: '#/components/schemas/File'
1146
1154
  FileUse:
1147
- description: Use for the File.
1155
+ description: Use for the File (e.g. "transcription" for OCR).
1148
1156
  type: string
1149
1157
  nullable: true
1150
1158
  FolioCatalogLink:
@@ -1792,6 +1800,14 @@ components:
1792
1800
  type: string
1793
1801
  use:
1794
1802
  $ref: '#/components/schemas/FileUse'
1803
+ sdrGeneratedText:
1804
+ description: Indicates if the text (OCR/captioning) was generated by SDR.
1805
+ type: boolean
1806
+ default: false
1807
+ correctedForAccessibility:
1808
+ description: Indicates if text that has been verified for accessibility/correctness.
1809
+ type: boolean
1810
+ default: false
1795
1811
  hasMessageDigests:
1796
1812
  type: array
1797
1813
  items:
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.96.0
4
+ version: 0.97.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-03-29 00:00:00.000000000 Z
11
+ date: 2024-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -164,20 +164,6 @@ dependencies:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
166
  version: '1.0'
167
- - !ruby/object:Gem::Dependency
168
- name: rss
169
- requirement: !ruby/object:Gem::Requirement
170
- requirements:
171
- - - ">="
172
- - !ruby/object:Gem::Version
173
- version: '0'
174
- type: :runtime
175
- prerelease: false
176
- version_requirements: !ruby/object:Gem::Requirement
177
- requirements:
178
- - - ">="
179
- - !ruby/object:Gem::Version
180
- version: '0'
181
167
  - !ruby/object:Gem::Dependency
182
168
  name: super_diff
183
169
  requirement: !ruby/object:Gem::Requirement
@@ -536,6 +522,7 @@ files:
536
522
  - lib/cocina/models/validators/open_api_validator.rb
537
523
  - lib/cocina/models/validators/purl_validator.rb
538
524
  - lib/cocina/models/validators/validator.rb
525
+ - lib/cocina/models/validators/w3cdtf_validator.rb
539
526
  - lib/cocina/models/version.rb
540
527
  - lib/cocina/models/vocabulary.rb
541
528
  - lib/cocina/models/world_access.rb
@@ -562,7 +549,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
562
549
  - !ruby/object:Gem::Version
563
550
  version: '0'
564
551
  requirements: []
565
- rubygems_version: 3.5.6
552
+ rubygems_version: 3.5.9
566
553
  signing_key:
567
554
  specification_version: 4
568
555
  summary: Data models for the SDR