cocina-models 0.123.0 → 0.124.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/AGENTS.md +2 -2
- data/Gemfile.lock +2 -2
- data/lib/cocina/models/validators/marc_date_validator.rb +28 -0
- data/lib/cocina/models/version.rb +1 -1
- data/schema.json +38 -2
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 48831f637b303e384ae0f578fa328b5c8b9ab4bf98b70892e6c3cca7dd4467ed
|
|
4
|
+
data.tar.gz: f08c1a2cdc5ea32035e937780912b4a19f2adbe077d984e5f1186520fed5d73a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b71056b9a1e77c73178dcab3eb8abc772259ea78b6d6d0d74d99354d3ea6661ba668dd65b497105ed40b583718d56647a1910c61fa0beecbb8c36b803144308a
|
|
7
|
+
data.tar.gz: d032e35b891ef77d7a95a155f0e5ccbc57fb2a185ca94be67998004d3fa0db63f2a641d57d6b216b069c4954d1a4d5f768cf5c8a899087528aa9ae36bc7c8c94
|
data/AGENTS.md
CHANGED
|
@@ -105,7 +105,7 @@ Substitute:
|
|
|
105
105
|
h2 { color: #9cdcfe; }
|
|
106
106
|
textarea, input { width: 100%; box-sizing: border-box; background: #252526; color: #d4d4d4; border: 1px solid #444; padding: 8px; font-family: monospace; font-size: 13px; border-radius: 3px; }
|
|
107
107
|
textarea { height: 260px; resize: vertical; }
|
|
108
|
-
|
|
108
|
+
#query { height: 120px; }
|
|
109
109
|
button { margin-top: 8px; background: #0e639c; color: white; border: none; padding: 8px 20px; cursor: pointer; font-size: 14px; border-radius: 3px; }
|
|
110
110
|
button:hover { background: #1177bb; }
|
|
111
111
|
label { display: block; margin-top: 16px; margin-bottom: 4px; font-size: 12px; color: #9cdcfe; text-transform: uppercase; letter-spacing: 0.05em; }
|
|
@@ -118,7 +118,7 @@ Substitute:
|
|
|
118
118
|
<label>JSON Input</label>
|
|
119
119
|
<textarea id="json"></textarea>
|
|
120
120
|
<label>jq Filter</label>
|
|
121
|
-
<
|
|
121
|
+
<textarea id="query"></textarea>
|
|
122
122
|
<button onclick="run()">▶ Run</button>
|
|
123
123
|
<label>Output</label>
|
|
124
124
|
<pre id="output">(click Run)</pre>
|
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.124.0)
|
|
5
5
|
activesupport
|
|
6
6
|
cocina_display
|
|
7
7
|
deprecation
|
|
@@ -232,7 +232,7 @@ CHECKSUMS
|
|
|
232
232
|
bigdecimal (4.1.2) sha256=53d217666027eab4280346fba98e7d5b66baaae1b9c3c1c0ffe89d48188a3fbd
|
|
233
233
|
builder (3.3.0) sha256=497918d2f9dca528fdca4b88d84e4ef4387256d984b8154e9d5d3fe5a9c8835f
|
|
234
234
|
bundler (4.0.14) sha256=d09a0a965cf772266a7e49e83610be7c2f4e49e61134c42a56804bb383cc24b8
|
|
235
|
-
cocina-models (0.
|
|
235
|
+
cocina-models (0.124.0)
|
|
236
236
|
cocina_display (2.6.0) sha256=a30e4bd638023371985ab641164e4dbbb12fe9a669a168c1b8e2eac2e37739f4
|
|
237
237
|
concurrent-ruby (1.3.6) sha256=6b56837e1e7e5292f9864f34b69c5a2cbc75c0cf5338f1ce9903d10fa762d5ab
|
|
238
238
|
connection_pool (3.0.2) sha256=33fff5ba71a12d2aa26cb72b1db8bba2a1a01823559fb01d29eb74c286e62e0a
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Cocina
|
|
4
|
+
module Models
|
|
5
|
+
module Validators
|
|
6
|
+
# Validates MARC date values.
|
|
7
|
+
class MarcDateValidator
|
|
8
|
+
def self.validate(date)
|
|
9
|
+
new(date).validate
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def initialize(date)
|
|
13
|
+
@date = date
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# MARC date formats:
|
|
17
|
+
# YYYY — 4 chars; digits may be replaced by 'u' (uncertain) or '|' (no attempt to code)
|
|
18
|
+
# YYMMDD — 6 chars; digits or 'u'
|
|
19
|
+
# YYYYMMDD — 8 chars; digits or 'u'
|
|
20
|
+
def validate # rubocop:disable Naming/PredicateMethod
|
|
21
|
+
/\A[0-9u|]{4}\z/.match?(@date) ||
|
|
22
|
+
/\A[0-9u]{6}\z/.match?(@date) ||
|
|
23
|
+
/\A[0-9u]{8}\z/.match?(@date)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
data/schema.json
CHANGED
|
@@ -1473,7 +1473,25 @@
|
|
|
1473
1473
|
"$ref": "#/$defs/Source"
|
|
1474
1474
|
},
|
|
1475
1475
|
"valueScript": {
|
|
1476
|
-
"
|
|
1476
|
+
"allOf": [
|
|
1477
|
+
{
|
|
1478
|
+
"$ref": "#/$defs/Standard"
|
|
1479
|
+
},
|
|
1480
|
+
{
|
|
1481
|
+
"type": "object",
|
|
1482
|
+
"properties": {
|
|
1483
|
+
"source": {
|
|
1484
|
+
"type": "object",
|
|
1485
|
+
"properties": {
|
|
1486
|
+
"code": {
|
|
1487
|
+
"type": "string",
|
|
1488
|
+
"pattern": "^[iI][sS][oO]15924$"
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
]
|
|
1477
1495
|
}
|
|
1478
1496
|
},
|
|
1479
1497
|
"description": "Language of the descriptive element value",
|
|
@@ -1968,7 +1986,25 @@
|
|
|
1968
1986
|
"description": "present for mapping to additional schemas in the future and for consistency but not otherwise used"
|
|
1969
1987
|
},
|
|
1970
1988
|
"script": {
|
|
1971
|
-
"
|
|
1989
|
+
"allOf": [
|
|
1990
|
+
{
|
|
1991
|
+
"$ref": "#/$defs/DescriptiveValue"
|
|
1992
|
+
},
|
|
1993
|
+
{
|
|
1994
|
+
"type": "object",
|
|
1995
|
+
"properties": {
|
|
1996
|
+
"source": {
|
|
1997
|
+
"type": "object",
|
|
1998
|
+
"properties": {
|
|
1999
|
+
"code": {
|
|
2000
|
+
"type": "string",
|
|
2001
|
+
"pattern": "^[iI][sS][oO]15924$"
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
]
|
|
1972
2008
|
},
|
|
1973
2009
|
"source": {
|
|
1974
2010
|
"$ref": "#/$defs/Source"
|
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.124.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Justin Coyne
|
|
@@ -489,6 +489,7 @@ files:
|
|
|
489
489
|
- lib/cocina/models/validators/description_values_visitor_validator.rb
|
|
490
490
|
- lib/cocina/models/validators/json_schema_validator.rb
|
|
491
491
|
- lib/cocina/models/validators/language_tag_visitor_validator.rb
|
|
492
|
+
- lib/cocina/models/validators/marc_date_validator.rb
|
|
492
493
|
- lib/cocina/models/validators/marc_relator_role_validator.rb
|
|
493
494
|
- lib/cocina/models/validators/purl_validator.rb
|
|
494
495
|
- lib/cocina/models/validators/reserved_filename_visitor_validator.rb
|