cocina-models 0.131.0 → 0.133.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +18 -18
- data/{description_types.yml → config/description_types.yml} +0 -2
- data/docs/description_types.md +0 -2
- data/lib/cocina/generator/generator.rb +1 -1
- data/lib/cocina/models/mapping/from_mods/name_builder.rb +6 -6
- data/lib/cocina/models/validators/description_date_time_visitor_validator.rb +5 -1
- data/lib/cocina/models/validators/description_form_resource_type_visitor_validator.rb +1 -1
- data/lib/cocina/models/validators/description_form_source_code_visitor_validator.rb +1 -1
- data/lib/cocina/models/validators/description_identifier_source_code_visitor_validator.rb +1 -1
- data/lib/cocina/models/validators/description_language_source_code_visitor_validator.rb +1 -1
- data/lib/cocina/models/validators/description_language_uri_visitor_validator.rb +2 -2
- data/lib/cocina/models/validators/description_location_visitor_validator.rb +1 -1
- data/lib/cocina/models/validators/description_name_source_code_visitor_validator.rb +1 -1
- data/lib/cocina/models/validators/description_role_source_code_visitor_validator.rb +4 -7
- data/lib/cocina/models/validators/description_script_visitor_validator.rb +1 -1
- data/lib/cocina/models/validators/description_subject_source_code_visitor_validator.rb +1 -1
- data/lib/cocina/models/validators/description_subject_temporal_encoding_visitor_validator.rb +1 -1
- data/lib/cocina/models/validators/description_title_source_code_visitor_validator.rb +1 -1
- data/lib/cocina/models/validators/description_types_visitor_validator.rb +1 -1
- data/lib/cocina/models/validators/json_schema_validator.rb +2 -1
- data/lib/cocina/models/version.rb +1 -1
- data/schema.json +10 -5
- metadata +15 -15
- /data/{form_source_codes.yml → config/form_source_codes.yml} +0 -0
- /data/{identifier_source_codes.yml → config/identifier_source_codes.yml} +0 -0
- /data/{iso15924_codes.yml → config/iso15924_codes.yml} +0 -0
- /data/{language_source_codes.yml → config/language_source_codes.yml} +0 -0
- /data/{language_uri_iso639_2_codes.yml → config/language_uri_iso639_2_codes.yml} +0 -0
- /data/{language_uri_languages_codes.yml → config/language_uri_languages_codes.yml} +0 -0
- /data/{location_source_codes.yml → config/location_source_codes.yml} +0 -0
- /data/{name_source_codes.yml → config/name_source_codes.yml} +0 -0
- /data/{name_title_source_codes.yml → config/name_title_source_codes.yml} +0 -0
- /data/{resource_type_values.yml → config/resource_type_values.yml} +0 -0
- /data/{subject_source_codes.yml → config/subject_source_codes.yml} +0 -0
- /data/{temporal_subject_encoding_codes.yml → config/temporal_subject_encoding_codes.yml} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7b806e4bcc314de6d4a213bfbbb889f4b431ccd7f674699d3b5affd65e1729c9
|
|
4
|
+
data.tar.gz: 291cf8886445c123942797831ed7045c8bce623ce5834cd4f77f2eda54152ab0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 798b0ba266e87554a519d5c6246b327e47b07f5591b86661040d2435ebb499bde858cbcc4c168786dc975c47b6b62eb4544aa5045d4f5409e7eaba1e0f031bef
|
|
7
|
+
data.tar.gz: e590597ff938d9ffe8e2fa1df0aca395e2547fb7d0938e1735dd14d9beeeb1bf1ee9441af323a79d122600eca7c813c0afa398611eccda5f68d64759512ef614
|
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.133.0)
|
|
5
5
|
activesupport
|
|
6
6
|
cocina_display
|
|
7
7
|
deprecation
|
|
@@ -19,7 +19,7 @@ PATH
|
|
|
19
19
|
GEM
|
|
20
20
|
remote: https://rubygems.org/
|
|
21
21
|
specs:
|
|
22
|
-
activesupport (8.1.3)
|
|
22
|
+
activesupport (8.1.3.1)
|
|
23
23
|
base64
|
|
24
24
|
bigdecimal
|
|
25
25
|
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
@@ -37,7 +37,7 @@ GEM
|
|
|
37
37
|
base64 (0.3.0)
|
|
38
38
|
bigdecimal (4.1.2)
|
|
39
39
|
builder (3.3.0)
|
|
40
|
-
cocina_display (2.
|
|
40
|
+
cocina_display (2.10.0)
|
|
41
41
|
activesupport (>= 7)
|
|
42
42
|
edtf (~> 3.2)
|
|
43
43
|
geo_coord (~> 0.2)
|
|
@@ -99,11 +99,11 @@ GEM
|
|
|
99
99
|
rdoc (>= 4.0.0)
|
|
100
100
|
reline (>= 0.4.2)
|
|
101
101
|
iso8601 (0.13.0)
|
|
102
|
-
janeway-jsonpath (1.
|
|
103
|
-
json (2.21.
|
|
104
|
-
jsonschema_rs (0.49.
|
|
102
|
+
janeway-jsonpath (1.1.0)
|
|
103
|
+
json (2.21.2)
|
|
104
|
+
jsonschema_rs (0.49.3-arm64-darwin)
|
|
105
105
|
bigdecimal (>= 3.1, < 5)
|
|
106
|
-
jsonschema_rs (0.49.
|
|
106
|
+
jsonschema_rs (0.49.3-x86_64-linux)
|
|
107
107
|
bigdecimal (>= 3.1, < 5)
|
|
108
108
|
language_server-protocol (3.17.0.6)
|
|
109
109
|
lint_roller (1.1.0)
|
|
@@ -131,7 +131,7 @@ GEM
|
|
|
131
131
|
racc (1.8.1)
|
|
132
132
|
rainbow (3.1.1)
|
|
133
133
|
rake (13.4.2)
|
|
134
|
-
rbs (4.1.
|
|
134
|
+
rbs (4.1.2)
|
|
135
135
|
logger
|
|
136
136
|
prism (>= 1.6.0)
|
|
137
137
|
tsort
|
|
@@ -197,7 +197,7 @@ GEM
|
|
|
197
197
|
unicode-emoji (~> 4.1)
|
|
198
198
|
unicode-emoji (4.2.0)
|
|
199
199
|
uri (1.1.1)
|
|
200
|
-
zeitwerk (2.8.
|
|
200
|
+
zeitwerk (2.8.3)
|
|
201
201
|
|
|
202
202
|
PLATFORMS
|
|
203
203
|
arm64-darwin
|
|
@@ -219,15 +219,15 @@ DEPENDENCIES
|
|
|
219
219
|
simplecov
|
|
220
220
|
|
|
221
221
|
CHECKSUMS
|
|
222
|
-
activesupport (8.1.3) sha256=
|
|
222
|
+
activesupport (8.1.3.1) sha256=85458765f25ea48b9019c46b6bb3fa5683197bf4280d9f06710a6e8d7a831376
|
|
223
223
|
ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
|
|
224
224
|
attr_extras (7.1.0) sha256=d96fc9a9dd5d85ba2d37762440a816f840093959ae26bb90da994c2d9f1fc827
|
|
225
225
|
base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
|
|
226
226
|
bigdecimal (4.1.2) sha256=53d217666027eab4280346fba98e7d5b66baaae1b9c3c1c0ffe89d48188a3fbd
|
|
227
227
|
builder (3.3.0) sha256=497918d2f9dca528fdca4b88d84e4ef4387256d984b8154e9d5d3fe5a9c8835f
|
|
228
228
|
bundler (4.0.17) sha256=214e21431b5665dd2f99df8a5511c6b151d7a72e8015c8b38f8b775b61cbb6c1
|
|
229
|
-
cocina-models (0.
|
|
230
|
-
cocina_display (2.
|
|
229
|
+
cocina-models (0.133.0)
|
|
230
|
+
cocina_display (2.10.0) sha256=846b6c1608154f5f7c8130cfc0b8c956af7ddb427da37b2e8d5ca9cd05401274
|
|
231
231
|
concurrent-ruby (1.3.8) sha256=b2f1be836e968ccc78ccfce277ea79c72a88633f22306782c16ff23fb415d1e1
|
|
232
232
|
connection_pool (3.0.2) sha256=33fff5ba71a12d2aa26cb72b1db8bba2a1a01823559fb01d29eb74c286e62e0a
|
|
233
233
|
csv (3.3.6) sha256=aba61e7e507a66f03d45cb1f3c4b6359861c3504038b422962875dce099e4456
|
|
@@ -251,10 +251,10 @@ CHECKSUMS
|
|
|
251
251
|
io-console (0.8.2) sha256=d6e3ae7a7cc7574f4b8893b4fca2162e57a825b223a177b7afa236c5ef9814cc
|
|
252
252
|
irb (1.18.0) sha256=de9454a0703a54704b9811a5ef31a60c86949fbf4013fcf244fabc7c775248e3
|
|
253
253
|
iso8601 (0.13.0) sha256=298c2b15b7be5fa95a1372813d36a2257656cd8e906dfbc1f5cb409851425aa2
|
|
254
|
-
janeway-jsonpath (1.
|
|
255
|
-
json (2.21.
|
|
256
|
-
jsonschema_rs (0.49.
|
|
257
|
-
jsonschema_rs (0.49.
|
|
254
|
+
janeway-jsonpath (1.1.0) sha256=82f71dccbdc29bf788815bc3b66e7ab5ddee2bdeea3a3121512aca63cfbcd9a9
|
|
255
|
+
json (2.21.2) sha256=1f1d3b7cf2b3ba1a69beca0bb6db13d5438b80bff3cd54cdaaa620b9b07c1c6a
|
|
256
|
+
jsonschema_rs (0.49.3-arm64-darwin) sha256=427e4c08b05adb1a5ff1f471e663dfd57b4372ae8bf314a12369d7bca3f94f0d
|
|
257
|
+
jsonschema_rs (0.49.3-x86_64-linux) sha256=392d3ea2f86a3f4fbf288154fdecccce1c599d225541101d8058b52a4d9ee3f7
|
|
258
258
|
language_server-protocol (3.17.0.6) sha256=5ef2c0c138f8267e1bc631d3328347d354f96724b0af22f2c79516120443b7f0
|
|
259
259
|
lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
|
|
260
260
|
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
|
|
@@ -272,7 +272,7 @@ CHECKSUMS
|
|
|
272
272
|
racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
|
|
273
273
|
rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
|
|
274
274
|
rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701
|
|
275
|
-
rbs (4.1.
|
|
275
|
+
rbs (4.1.2) sha256=050eb1d8b508f1233bed929c0f2c7052302f7adf295230d9cb314e9024078f48
|
|
276
276
|
rdoc (8.0.0) sha256=03bf8c08a9639658855a0cfd77c0abca8325c227693f7f33f82957811348c469
|
|
277
277
|
regexp_parser (2.12.0) sha256=35a916a1d63190ab5c9009457136ae5f3c0c7512d60291d0d1378ba18ce08ebb
|
|
278
278
|
reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835
|
|
@@ -297,7 +297,7 @@ CHECKSUMS
|
|
|
297
297
|
unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
|
|
298
298
|
unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f
|
|
299
299
|
uri (1.1.1) sha256=379fa58d27ffb1387eaada68c749d1426738bd0f654d812fcc07e7568f5c57c6
|
|
300
|
-
zeitwerk (2.8.
|
|
300
|
+
zeitwerk (2.8.3) sha256=2c85125a8467ce069e20123d1e709a08955c9d29c118c25b46b7b7fafdbb92e5
|
|
301
301
|
|
|
302
302
|
BUNDLED WITH
|
|
303
303
|
4.0.17
|
|
@@ -93,8 +93,6 @@ contributor.name.groupedValue:
|
|
|
93
93
|
- value: pseudonym
|
|
94
94
|
description: Name used that differs from legal or primary form of name.
|
|
95
95
|
contributor.note:
|
|
96
|
-
- value: affiliation
|
|
97
|
-
description: Institution with which the contributor is associated.
|
|
98
96
|
- value: citation status
|
|
99
97
|
description: Indicator of whether the contributor should be included in the citation.
|
|
100
98
|
- value: contact email
|
data/docs/description_types.md
CHANGED
|
@@ -100,8 +100,6 @@ _Path: contributor.name.groupedValue.type_
|
|
|
100
100
|
* Name used that differs from legal or primary form of name.
|
|
101
101
|
## Contributor note types
|
|
102
102
|
_Path: contributor.note.type_
|
|
103
|
-
* affiliation
|
|
104
|
-
* Institution with which the contributor is associated.
|
|
105
103
|
* citation status
|
|
106
104
|
* Indicator of whether the contributor should be included in the citation.
|
|
107
105
|
* contact email
|
|
@@ -52,7 +52,7 @@ module Cocina
|
|
|
52
52
|
|
|
53
53
|
desc 'generate_descriptive_docs', 'generate descriptive documentation'
|
|
54
54
|
def generate_descriptive_docs
|
|
55
|
-
markdown = YAML.load_file('description_types.yml').map do |field, types|
|
|
55
|
+
markdown = YAML.load_file('config/description_types.yml').map do |field, types|
|
|
56
56
|
header_markdown = field_markdown_from(field)
|
|
57
57
|
types_markdown = types_markdown_from(types)
|
|
58
58
|
|
|
@@ -42,7 +42,7 @@ module Cocina
|
|
|
42
42
|
}.compact
|
|
43
43
|
{ name: [names] }.tap do |attrs|
|
|
44
44
|
attrs[:role] = name_elements.flat_map { |name_node| build_roles(name_node) }.compact.uniq.presence
|
|
45
|
-
attrs[:
|
|
45
|
+
attrs[:affiliation] = name_elements.flat_map { |name_node| build_affiliations(name_node) }.compact.uniq.presence
|
|
46
46
|
end.compact
|
|
47
47
|
end
|
|
48
48
|
|
|
@@ -87,11 +87,12 @@ module Cocina
|
|
|
87
87
|
|
|
88
88
|
def common_name(name_node, name, is_parallel: false)
|
|
89
89
|
{
|
|
90
|
-
note: build_notes(name_node
|
|
90
|
+
note: build_notes(name_node),
|
|
91
91
|
identifier: build_identifier(name_node)
|
|
92
92
|
}.tap do |attrs|
|
|
93
93
|
roles = build_roles(name_node)
|
|
94
94
|
attrs[:role] = roles unless name.nil?
|
|
95
|
+
attrs[:affiliation] = build_affiliations(name_node).presence unless is_parallel
|
|
95
96
|
end.compact
|
|
96
97
|
end
|
|
97
98
|
|
|
@@ -277,7 +278,7 @@ module Cocina
|
|
|
277
278
|
end.presence
|
|
278
279
|
end
|
|
279
280
|
|
|
280
|
-
def build_notes(name_node
|
|
281
|
+
def build_notes(name_node)
|
|
281
282
|
[].tap do |parts|
|
|
282
283
|
description = name_node.xpath('mods:description', mods: Description::DESC_METADATA_NS).first
|
|
283
284
|
if description
|
|
@@ -287,13 +288,12 @@ module Cocina
|
|
|
287
288
|
{ value: description.text, type: 'description' }
|
|
288
289
|
end
|
|
289
290
|
end
|
|
290
|
-
parts.concat(build_affiliation_notes(name_node)) unless is_parallel
|
|
291
291
|
end.presence
|
|
292
292
|
end
|
|
293
293
|
|
|
294
|
-
def
|
|
294
|
+
def build_affiliations(name_node)
|
|
295
295
|
name_node.xpath('mods:affiliation', mods: Description::DESC_METADATA_NS).map do |affiliation_node|
|
|
296
|
-
{ value: affiliation_node.text
|
|
296
|
+
{ value: affiliation_node.text }
|
|
297
297
|
end
|
|
298
298
|
end
|
|
299
299
|
|
|
@@ -7,7 +7,7 @@ module Cocina
|
|
|
7
7
|
module Validators
|
|
8
8
|
# Validates that dates of known types are type-valid using the visitor pattern.
|
|
9
9
|
class DescriptionDateTimeVisitorValidator < BaseDescriptionVisitorValidator
|
|
10
|
-
VALIDATABLE_TYPES = %w[edtf iso8601 w3cdtf].freeze
|
|
10
|
+
VALIDATABLE_TYPES = %w[edtf iso8601 marc w3cdtf].freeze
|
|
11
11
|
VALID_ENCODING_CODES = %w[edtf iso8601 marc temper w3cdtf].freeze
|
|
12
12
|
|
|
13
13
|
def visit_hash(hash:, path:) # rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
|
|
@@ -135,6 +135,10 @@ module Cocina
|
|
|
135
135
|
def valid_w3cdtf?(value)
|
|
136
136
|
W3cdtfValidator.validate(value)
|
|
137
137
|
end
|
|
138
|
+
|
|
139
|
+
def valid_marc?(value)
|
|
140
|
+
MarcDateValidator.validate(value)
|
|
141
|
+
end
|
|
138
142
|
end
|
|
139
143
|
end
|
|
140
144
|
end
|
|
@@ -37,7 +37,7 @@ module Cocina
|
|
|
37
37
|
|
|
38
38
|
# rubocop:disable Style/ClassVars
|
|
39
39
|
def valid_values_by_source
|
|
40
|
-
@@valid_values_by_source ||= YAML.load_file(::File.expand_path('../../../../resource_type_values.yml', __dir__))
|
|
40
|
+
@@valid_values_by_source ||= YAML.load_file(::File.expand_path('../../../../config/resource_type_values.yml', __dir__))
|
|
41
41
|
end
|
|
42
42
|
# rubocop:enable Style/ClassVars
|
|
43
43
|
end
|
|
@@ -32,7 +32,7 @@ module Cocina
|
|
|
32
32
|
|
|
33
33
|
# rubocop:disable Style/ClassVars
|
|
34
34
|
def valid_codes
|
|
35
|
-
@@valid_codes ||= YAML.load_file(::File.expand_path('../../../../form_source_codes.yml', __dir__)).to_set(&:downcase)
|
|
35
|
+
@@valid_codes ||= YAML.load_file(::File.expand_path('../../../../config/form_source_codes.yml', __dir__)).to_set(&:downcase)
|
|
36
36
|
end
|
|
37
37
|
# rubocop:enable Style/ClassVars
|
|
38
38
|
end
|
|
@@ -32,7 +32,7 @@ module Cocina
|
|
|
32
32
|
|
|
33
33
|
# rubocop:disable Style/ClassVars
|
|
34
34
|
def valid_codes
|
|
35
|
-
@@valid_codes ||= YAML.load_file(::File.expand_path('../../../../identifier_source_codes.yml', __dir__)).to_set(&:downcase)
|
|
35
|
+
@@valid_codes ||= YAML.load_file(::File.expand_path('../../../../config/identifier_source_codes.yml', __dir__)).to_set(&:downcase)
|
|
36
36
|
end
|
|
37
37
|
# rubocop:enable Style/ClassVars
|
|
38
38
|
end
|
|
@@ -45,7 +45,7 @@ module Cocina
|
|
|
45
45
|
|
|
46
46
|
# rubocop:disable Style/ClassVars
|
|
47
47
|
def valid_codes
|
|
48
|
-
@@valid_codes ||= YAML.load_file(::File.expand_path('../../../../language_source_codes.yml', __dir__)).to_set(&:downcase)
|
|
48
|
+
@@valid_codes ||= YAML.load_file(::File.expand_path('../../../../config/language_source_codes.yml', __dir__)).to_set(&:downcase)
|
|
49
49
|
end
|
|
50
50
|
# rubocop:enable Style/ClassVars
|
|
51
51
|
end
|
|
@@ -70,13 +70,13 @@ module Cocina
|
|
|
70
70
|
# rubocop:disable Style/ClassVars
|
|
71
71
|
def valid_iso639_2_codes
|
|
72
72
|
@@valid_iso639_2_codes ||= YAML.load_file(
|
|
73
|
-
::File.expand_path('../../../../language_uri_iso639_2_codes.yml', __dir__)
|
|
73
|
+
::File.expand_path('../../../../config/language_uri_iso639_2_codes.yml', __dir__)
|
|
74
74
|
).to_set(&:downcase)
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
def valid_languages_codes
|
|
78
78
|
@@valid_languages_codes ||= YAML.load_file(
|
|
79
|
-
::File.expand_path('../../../../language_uri_languages_codes.yml', __dir__)
|
|
79
|
+
::File.expand_path('../../../../config/language_uri_languages_codes.yml', __dir__)
|
|
80
80
|
).to_set(&:downcase)
|
|
81
81
|
end
|
|
82
82
|
# rubocop:enable Style/ClassVars
|
|
@@ -46,7 +46,7 @@ module Cocina
|
|
|
46
46
|
|
|
47
47
|
# rubocop:disable Style/ClassVars
|
|
48
48
|
def valid_codes
|
|
49
|
-
@@valid_codes ||= YAML.load_file(::File.expand_path('../../../../location_source_codes.yml', __dir__)).to_set(&:downcase)
|
|
49
|
+
@@valid_codes ||= YAML.load_file(::File.expand_path('../../../../config/location_source_codes.yml', __dir__)).to_set(&:downcase)
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
def valid_marc_country_codes
|
|
@@ -36,7 +36,7 @@ module Cocina
|
|
|
36
36
|
|
|
37
37
|
# rubocop:disable Style/ClassVars
|
|
38
38
|
def valid_codes
|
|
39
|
-
@@valid_codes ||= YAML.load_file(::File.expand_path('../../../../name_source_codes.yml', __dir__)).to_set(&:downcase)
|
|
39
|
+
@@valid_codes ||= YAML.load_file(::File.expand_path('../../../../config/name_source_codes.yml', __dir__)).to_set(&:downcase)
|
|
40
40
|
end
|
|
41
41
|
# rubocop:enable Style/ClassVars
|
|
42
42
|
end
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
module Cocina
|
|
4
4
|
module Models
|
|
5
5
|
module Validators
|
|
6
|
-
# Validates contributor.role.source.code values
|
|
6
|
+
# Validates contributor.role.source.code values.
|
|
7
7
|
class DescriptionRoleSourceCodeVisitorValidator < BaseDescriptionVisitorValidator
|
|
8
|
+
VALID_CODES = %w[aat lcmpt marcrelator rbmsrel].freeze
|
|
9
|
+
|
|
8
10
|
def validate!
|
|
9
11
|
return if error_paths.empty?
|
|
10
12
|
|
|
@@ -16,7 +18,7 @@ module Cocina
|
|
|
16
18
|
|
|
17
19
|
source_code = hash.dig(:source, :code)
|
|
18
20
|
return unless source_code
|
|
19
|
-
return if
|
|
21
|
+
return if VALID_CODES.include?(source_code.downcase)
|
|
20
22
|
|
|
21
23
|
error_paths << "#{path_to_s(path)}.source.code (#{source_code})"
|
|
22
24
|
end
|
|
@@ -33,11 +35,6 @@ module Cocina
|
|
|
33
35
|
path[-2].to_s == 'role' && # we have a nested role in the path
|
|
34
36
|
path.any? { |part| part.to_s == 'contributor' } # there is a contributor in the path (any? allows for nested roles)
|
|
35
37
|
end
|
|
36
|
-
|
|
37
|
-
# Source codes allowed for contributor.role.source.code
|
|
38
|
-
def valid_codes
|
|
39
|
-
%w[aat lcmpt marcrelator rbmsrel]
|
|
40
|
-
end
|
|
41
38
|
end
|
|
42
39
|
end
|
|
43
40
|
end
|
|
@@ -65,7 +65,7 @@ module Cocina
|
|
|
65
65
|
|
|
66
66
|
# rubocop:disable Style/ClassVars
|
|
67
67
|
def valid_script_codes
|
|
68
|
-
@@valid_script_codes ||= YAML.load_file(::File.expand_path('../../../../iso15924_codes.yml', __dir__)).to_set
|
|
68
|
+
@@valid_script_codes ||= YAML.load_file(::File.expand_path('../../../../config/iso15924_codes.yml', __dir__)).to_set
|
|
69
69
|
end
|
|
70
70
|
# rubocop:enable Style/ClassVars
|
|
71
71
|
end
|
|
@@ -32,7 +32,7 @@ module Cocina
|
|
|
32
32
|
|
|
33
33
|
# rubocop:disable Style/ClassVars
|
|
34
34
|
def valid_codes
|
|
35
|
-
@@valid_codes ||= YAML.load_file(::File.expand_path('../../../../subject_source_codes.yml', __dir__)).to_set(&:downcase)
|
|
35
|
+
@@valid_codes ||= YAML.load_file(::File.expand_path('../../../../config/subject_source_codes.yml', __dir__)).to_set(&:downcase)
|
|
36
36
|
end
|
|
37
37
|
# rubocop:enable Style/ClassVars
|
|
38
38
|
end
|
data/lib/cocina/models/validators/description_subject_temporal_encoding_visitor_validator.rb
CHANGED
|
@@ -34,7 +34,7 @@ module Cocina
|
|
|
34
34
|
|
|
35
35
|
# rubocop:disable Style/ClassVars
|
|
36
36
|
def valid_codes
|
|
37
|
-
@@valid_codes ||= YAML.load_file(::File.expand_path('../../../../temporal_subject_encoding_codes.yml', __dir__)).to_set(&:downcase)
|
|
37
|
+
@@valid_codes ||= YAML.load_file(::File.expand_path('../../../../config/temporal_subject_encoding_codes.yml', __dir__)).to_set(&:downcase)
|
|
38
38
|
end
|
|
39
39
|
# rubocop:enable Style/ClassVars
|
|
40
40
|
end
|
|
@@ -34,7 +34,7 @@ module Cocina
|
|
|
34
34
|
|
|
35
35
|
# rubocop:disable Style/ClassVars
|
|
36
36
|
def valid_codes
|
|
37
|
-
@@valid_codes ||= YAML.load_file(::File.expand_path('../../../../name_title_source_codes.yml', __dir__)).to_set(&:downcase)
|
|
37
|
+
@@valid_codes ||= YAML.load_file(::File.expand_path('../../../../config/name_title_source_codes.yml', __dir__)).to_set(&:downcase)
|
|
38
38
|
end
|
|
39
39
|
# rubocop:enable Style/ClassVars
|
|
40
40
|
end
|
|
@@ -66,7 +66,7 @@ module Cocina
|
|
|
66
66
|
# rubocop:enable Style/ClassVars
|
|
67
67
|
|
|
68
68
|
def types_yaml
|
|
69
|
-
YAML.load_file(::File.expand_path('../../../../description_types.yml', __dir__))
|
|
69
|
+
YAML.load_file(::File.expand_path('../../../../config/description_types.yml', __dir__))
|
|
70
70
|
end
|
|
71
71
|
end
|
|
72
72
|
end
|
|
@@ -36,7 +36,8 @@ module Cocina
|
|
|
36
36
|
# @return [JSONSchema validator] a cached per-definition validator
|
|
37
37
|
def self.validator_for(def_name)
|
|
38
38
|
@validators ||= {}
|
|
39
|
-
|
|
39
|
+
schema = { '$ref' => "#/$defs/#{def_name}", '$defs' => document['$defs'] }
|
|
40
|
+
@validators[def_name] ||= JSONSchema.validator_for(schema, validate_formats: true)
|
|
40
41
|
end
|
|
41
42
|
|
|
42
43
|
# @return [Hash] a hash representation of the schema.json document
|
data/schema.json
CHANGED
|
@@ -1113,7 +1113,8 @@
|
|
|
1113
1113
|
},
|
|
1114
1114
|
"uri": {
|
|
1115
1115
|
"description": "URI value of the descriptive element.",
|
|
1116
|
-
"type": "string"
|
|
1116
|
+
"type": "string",
|
|
1117
|
+
"format": "uri"
|
|
1117
1118
|
},
|
|
1118
1119
|
"standard": {
|
|
1119
1120
|
"$ref": "#/$defs/Standard"
|
|
@@ -1339,7 +1340,8 @@
|
|
|
1339
1340
|
},
|
|
1340
1341
|
"uri": {
|
|
1341
1342
|
"description": "URI for the standard or encoding.",
|
|
1342
|
-
"type": "string"
|
|
1343
|
+
"type": "string",
|
|
1344
|
+
"format": "uri"
|
|
1343
1345
|
},
|
|
1344
1346
|
"value": {
|
|
1345
1347
|
"description": "String describing the standard or encoding.",
|
|
@@ -1864,7 +1866,8 @@
|
|
|
1864
1866
|
},
|
|
1865
1867
|
"uri": {
|
|
1866
1868
|
"description": "URI value of the descriptive element.",
|
|
1867
|
-
"type": "string"
|
|
1869
|
+
"type": "string",
|
|
1870
|
+
"format": "uri"
|
|
1868
1871
|
},
|
|
1869
1872
|
"value": {
|
|
1870
1873
|
"description": "Value of the descriptive element.",
|
|
@@ -2971,7 +2974,8 @@
|
|
|
2971
2974
|
},
|
|
2972
2975
|
"uri": {
|
|
2973
2976
|
"description": "URI for the value source.",
|
|
2974
|
-
"type": "string"
|
|
2977
|
+
"type": "string",
|
|
2978
|
+
"format": "uri"
|
|
2975
2979
|
},
|
|
2976
2980
|
"value": {
|
|
2977
2981
|
"description": "String describing the value source.",
|
|
@@ -3018,7 +3022,8 @@
|
|
|
3018
3022
|
},
|
|
3019
3023
|
"uri": {
|
|
3020
3024
|
"description": "URI for the standard or encoding.",
|
|
3021
|
-
"type": "string"
|
|
3025
|
+
"type": "string",
|
|
3026
|
+
"format": "uri"
|
|
3022
3027
|
},
|
|
3023
3028
|
"value": {
|
|
3024
3029
|
"description": "String describing the standard or encoding.",
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cocina-models
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.133.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Justin Coyne
|
|
@@ -322,16 +322,22 @@ files:
|
|
|
322
322
|
- bin/validate-data
|
|
323
323
|
- bin/validate-schema
|
|
324
324
|
- cocina-models.gemspec
|
|
325
|
-
- description_types.yml
|
|
325
|
+
- config/description_types.yml
|
|
326
|
+
- config/form_source_codes.yml
|
|
327
|
+
- config/identifier_source_codes.yml
|
|
328
|
+
- config/iso15924_codes.yml
|
|
329
|
+
- config/language_source_codes.yml
|
|
330
|
+
- config/language_uri_iso639_2_codes.yml
|
|
331
|
+
- config/language_uri_languages_codes.yml
|
|
332
|
+
- config/location_source_codes.yml
|
|
333
|
+
- config/name_source_codes.yml
|
|
334
|
+
- config/name_title_source_codes.yml
|
|
335
|
+
- config/resource_type_values.yml
|
|
336
|
+
- config/subject_source_codes.yml
|
|
337
|
+
- config/temporal_subject_encoding_codes.yml
|
|
326
338
|
- docs/cocina-base.jsonld
|
|
327
339
|
- docs/description_types.md
|
|
328
340
|
- exe/generator
|
|
329
|
-
- form_source_codes.yml
|
|
330
|
-
- identifier_source_codes.yml
|
|
331
|
-
- iso15924_codes.yml
|
|
332
|
-
- language_source_codes.yml
|
|
333
|
-
- language_uri_iso639_2_codes.yml
|
|
334
|
-
- language_uri_languages_codes.yml
|
|
335
341
|
- lib/cocina/generator.rb
|
|
336
342
|
- lib/cocina/generator/datatype.rb
|
|
337
343
|
- lib/cocina/generator/generator.rb
|
|
@@ -514,13 +520,7 @@ files:
|
|
|
514
520
|
- lib/cocina/rspec.rb
|
|
515
521
|
- lib/cocina/rspec/factories.rb
|
|
516
522
|
- lib/cocina/rspec/matchers.rb
|
|
517
|
-
- location_source_codes.yml
|
|
518
|
-
- name_source_codes.yml
|
|
519
|
-
- name_title_source_codes.yml
|
|
520
|
-
- resource_type_values.yml
|
|
521
523
|
- schema.json
|
|
522
|
-
- subject_source_codes.yml
|
|
523
|
-
- temporal_subject_encoding_codes.yml
|
|
524
524
|
homepage: https://github.com/sul-dlss/cocina-models
|
|
525
525
|
licenses: []
|
|
526
526
|
metadata:
|
|
@@ -539,7 +539,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
539
539
|
- !ruby/object:Gem::Version
|
|
540
540
|
version: '0'
|
|
541
541
|
requirements: []
|
|
542
|
-
rubygems_version:
|
|
542
|
+
rubygems_version: 4.0.14
|
|
543
543
|
specification_version: 4
|
|
544
544
|
summary: Data models for the SDR
|
|
545
545
|
test_files: []
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|