cocina-models 0.65.0 → 0.67.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/pull_request_template.md +4 -3
- data/.rubocop.yml +1 -0
- data/cocina-models.gemspec +1 -1
- data/lib/cocina/generator/generator.rb +3 -0
- data/lib/cocina/generator/schema.rb +2 -6
- data/lib/cocina/models/admin_policy.rb +2 -5
- data/lib/cocina/models/admin_policy_administrative.rb +1 -3
- data/lib/cocina/models/administrative.rb +1 -1
- data/lib/cocina/models/collection.rb +3 -6
- data/lib/cocina/models/collection_access.rb +2 -2
- data/lib/cocina/models/description.rb +2 -5
- data/lib/cocina/models/dro.rb +3 -6
- data/lib/cocina/models/dro_access.rb +1 -1
- data/lib/cocina/models/embargo.rb +1 -1
- data/lib/cocina/models/identification.rb +1 -1
- data/lib/cocina/models/request_admin_policy.rb +3 -6
- data/lib/cocina/models/request_collection.rb +3 -6
- data/lib/cocina/models/request_description.rb +2 -5
- data/lib/cocina/models/request_dro.rb +3 -6
- data/lib/cocina/models/request_identification.rb +1 -1
- data/lib/cocina/models/validatable.rb +24 -0
- data/lib/cocina/models/validator.rb +1 -1
- data/lib/cocina/models/version.rb +1 -1
- data/openapi.yml +18 -6
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14a49c375a660bd05882ee93aeaf458dddb883e88ea55ed4e80bb48b2458446b
|
4
|
+
data.tar.gz: ef9426b29aedcfc6cbc1cb55118de413f7bd64f9df9234f5203d2f67eee19583
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25aed0abff20bc69292031adf1eee12b4b6ca528525ad9898e0baf464ec1e99c6c0e518a7585fdab4dc63651175da88e5f179dfdb1ef35e79ba1d1087cf1efbc
|
7
|
+
data.tar.gz: babf7508c4aab20689bfd7d7618711b51a254405bd111117dd9a758b6dc556f571af9f90fb50929f515698a22a35c36275a26641ee5c93a3d51faa658a92481a
|
@@ -1,11 +1,12 @@
|
|
1
1
|
**NOTE: Changes to openapi.yml require updating openapi.yml for sdr-api and dor-services-app and generating models - see README.**
|
2
2
|
|
3
|
-
## Why was this change made?
|
3
|
+
## Why was this change made? 🤔
|
4
4
|
|
5
5
|
|
6
6
|
|
7
|
-
## How was this change tested?
|
7
|
+
## How was this change tested? 🤨
|
8
|
+
|
9
|
+
⚡ ⚠ If this change has cross service impact, ***run [integration tests](https://github.com/sul-dlss/infrastructure-integration-test)*** and/or test in [stage|qa] environment, in addition to specs. ⚡
|
8
10
|
|
9
11
|
|
10
12
|
|
11
|
-
## Which documentation and/or configurations were updated?
|
data/.rubocop.yml
CHANGED
data/cocina-models.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_dependency 'dry-struct', '~> 1.0'
|
29
29
|
spec.add_dependency 'dry-types', '~> 1.1'
|
30
30
|
spec.add_dependency 'openapi3_parser' # Parsing openapi doc
|
31
|
-
spec.add_dependency 'openapi_parser' # Validating openapi requests
|
31
|
+
spec.add_dependency 'openapi_parser', '~> 1.0' # Validating openapi requests
|
32
32
|
spec.add_dependency 'thor'
|
33
33
|
spec.add_dependency 'zeitwerk', '~> 2.1'
|
34
34
|
|
@@ -76,6 +76,7 @@ module Cocina
|
|
76
76
|
run("rubocop -a #{filepath} > /dev/null")
|
77
77
|
end
|
78
78
|
|
79
|
+
# rubocop:disable Metrics/AbcSize
|
79
80
|
def clean_output
|
80
81
|
FileUtils.mkdir_p(options[:output])
|
81
82
|
files = Dir.glob("#{options[:output]}/*.rb")
|
@@ -83,8 +84,10 @@ module Cocina
|
|
83
84
|
files.delete("#{options[:output]}/version.rb")
|
84
85
|
files.delete("#{options[:output]}/checkable.rb")
|
85
86
|
files.delete("#{options[:output]}/validator.rb")
|
87
|
+
files.delete("#{options[:output]}/validatable.rb")
|
86
88
|
FileUtils.rm_f(files)
|
87
89
|
end
|
90
|
+
# rubocop:enable Metrics/AbcSize
|
88
91
|
end
|
89
92
|
end
|
90
93
|
end
|
@@ -16,11 +16,10 @@ module Cocina
|
|
16
16
|
module Models
|
17
17
|
class #{name} < Struct
|
18
18
|
|
19
|
+
#{validate}
|
19
20
|
#{types}
|
20
21
|
|
21
22
|
#{model_attributes}
|
22
|
-
|
23
|
-
#{validate}
|
24
23
|
end
|
25
24
|
end
|
26
25
|
end
|
@@ -64,10 +63,7 @@ module Cocina
|
|
64
63
|
return '' unless validatable?
|
65
64
|
|
66
65
|
<<~RUBY
|
67
|
-
|
68
|
-
Validator.validate(self, attributes.with_indifferent_access) if validate && name
|
69
|
-
super(attributes, safe, &block)
|
70
|
-
end
|
66
|
+
include Validatable
|
71
67
|
RUBY
|
72
68
|
end
|
73
69
|
|
@@ -3,6 +3,8 @@
|
|
3
3
|
module Cocina
|
4
4
|
module Models
|
5
5
|
class AdminPolicy < Struct
|
6
|
+
include Validatable
|
7
|
+
|
6
8
|
include Checkable
|
7
9
|
|
8
10
|
TYPES = ['http://cocina.sul.stanford.edu/models/admin_policy.jsonld'].freeze
|
@@ -17,11 +19,6 @@ module Cocina
|
|
17
19
|
attribute :version, Types::Strict::Integer
|
18
20
|
attribute(:administrative, AdminPolicyAdministrative.default { AdminPolicyAdministrative.new })
|
19
21
|
attribute :description, Description.optional.meta(omittable: true)
|
20
|
-
|
21
|
-
def self.new(attributes = default_attributes, safe = false, validate = true, &block)
|
22
|
-
Validator.validate(self, attributes.with_indifferent_access) if validate && name
|
23
|
-
super(attributes, safe, &block)
|
24
|
-
end
|
25
22
|
end
|
26
23
|
end
|
27
24
|
end
|
@@ -3,9 +3,7 @@
|
|
3
3
|
module Cocina
|
4
4
|
module Models
|
5
5
|
class AdminPolicyAdministrative < Struct
|
6
|
-
|
7
|
-
attribute :defaultObjectRights, Types::Strict::String.default('<?xml version="1.0" encoding="UTF-8"?><rightsMetadata><access type="discover"><machine><world/></machine></access><access type="read"><machine><world/></machine></access><use><human type="useAndReproduction"/><human type="creativeCommons"/><machine type="creativeCommons" uri=""/><human type="openDataCommons"/><machine type="openDataCommons" uri=""/></use><copyright><human/></copyright></rightsMetadata>').meta(omittable: true)
|
8
|
-
attribute :defaultAccess, AdminPolicyDefaultAccess.optional.meta(omittable: true)
|
6
|
+
attribute(:defaultAccess, AdminPolicyDefaultAccess.default { AdminPolicyDefaultAccess.new })
|
9
7
|
attribute :registrationWorkflow, Types::Strict::Array.of(Types::Strict::String).default([].freeze)
|
10
8
|
# An additional workflow to start for objects managed by this admin policy once the end-accession workflow step is complete
|
11
9
|
# example: wasCrawlPreassemblyWF
|
@@ -8,7 +8,7 @@ module Cocina
|
|
8
8
|
attribute :releaseTags, Types::Strict::Array.of(ReleaseTag).default([].freeze)
|
9
9
|
# Administrative or Internal project this resource is a part of
|
10
10
|
# example: Google Books
|
11
|
-
attribute :partOfProject, Types::Strict::String.meta(omittable: true)
|
11
|
+
attribute :partOfProject, Types::Strict::String.optional.meta(omittable: true)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -3,6 +3,8 @@
|
|
3
3
|
module Cocina
|
4
4
|
module Models
|
5
5
|
class Collection < Struct
|
6
|
+
include Validatable
|
7
|
+
|
6
8
|
include Checkable
|
7
9
|
|
8
10
|
TYPES = ['http://cocina.sul.stanford.edu/models/collection.jsonld',
|
@@ -24,13 +26,8 @@ module Cocina
|
|
24
26
|
attribute :version, Types::Strict::Integer
|
25
27
|
attribute(:access, CollectionAccess.default { CollectionAccess.new })
|
26
28
|
attribute :administrative, Administrative.optional.meta(omittable: true)
|
27
|
-
attribute
|
29
|
+
attribute(:description, Description.default { Description.new })
|
28
30
|
attribute :identification, CollectionIdentification.optional.meta(omittable: true)
|
29
|
-
|
30
|
-
def self.new(attributes = default_attributes, safe = false, validate = true, &block)
|
31
|
-
Validator.validate(self, attributes.with_indifferent_access) if validate && name
|
32
|
-
super(attributes, safe, &block)
|
33
|
-
end
|
34
31
|
end
|
35
32
|
end
|
36
33
|
end
|
@@ -10,9 +10,9 @@ module Cocina
|
|
10
10
|
attribute :copyright, Types::Strict::String.optional.meta(omittable: true)
|
11
11
|
# The human readable use and reproduction statement that applies
|
12
12
|
# example: Property rights reside with the repository. Literary rights reside with the creators of the documents or their heirs. To obtain permission to publish or reproduce, please contact the Public Services Librarian of the Dept. of Special Collections (http://library.stanford.edu/spc).
|
13
|
-
attribute :useAndReproductionStatement, Types::Strict::String.meta(omittable: true)
|
13
|
+
attribute :useAndReproductionStatement, Types::Strict::String.optional.meta(omittable: true)
|
14
14
|
# The license governing reuse of the Collection. Should be an IRI for known licenses (i.e. CC, RightsStatement.org URI, etc.).
|
15
|
-
attribute :license, Types::Strict::String.meta(omittable: true)
|
15
|
+
attribute :license, Types::Strict::String.optional.meta(omittable: true)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -3,6 +3,8 @@
|
|
3
3
|
module Cocina
|
4
4
|
module Models
|
5
5
|
class Description < Struct
|
6
|
+
include Validatable
|
7
|
+
|
6
8
|
attribute :title, Types::Strict::Array.of(Title).default([].freeze)
|
7
9
|
attribute :contributor, Types::Strict::Array.of(Contributor).default([].freeze)
|
8
10
|
attribute :event, Types::Strict::Array.of(Event).default([].freeze)
|
@@ -20,11 +22,6 @@ module Cocina
|
|
20
22
|
attribute :valueAt, Types::Strict::String.meta(omittable: true)
|
21
23
|
# Stanford persistent URL associated with the related resource. Note this is http, not https.
|
22
24
|
attribute :purl, Types::Strict::String
|
23
|
-
|
24
|
-
def self.new(attributes = default_attributes, safe = false, validate = true, &block)
|
25
|
-
Validator.validate(self, attributes.with_indifferent_access) if validate && name
|
26
|
-
super(attributes, safe, &block)
|
27
|
-
end
|
28
25
|
end
|
29
26
|
end
|
30
27
|
end
|
data/lib/cocina/models/dro.rb
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
module Cocina
|
4
4
|
module Models
|
5
5
|
class DRO < Struct
|
6
|
+
include Validatable
|
7
|
+
|
6
8
|
include Checkable
|
7
9
|
|
8
10
|
TYPES = ['http://cocina.sul.stanford.edu/models/object.jsonld',
|
@@ -34,15 +36,10 @@ module Cocina
|
|
34
36
|
attribute :version, Types::Strict::Integer
|
35
37
|
attribute(:access, DROAccess.default { DROAccess.new })
|
36
38
|
attribute(:administrative, Administrative.default { Administrative.new })
|
37
|
-
attribute
|
39
|
+
attribute(:description, Description.default { Description.new })
|
38
40
|
attribute :identification, Identification.optional.meta(omittable: true)
|
39
41
|
attribute :structural, DROStructural.optional.meta(omittable: true)
|
40
42
|
attribute :geographic, Geographic.optional.meta(omittable: true)
|
41
|
-
|
42
|
-
def self.new(attributes = default_attributes, safe = false, validate = true, &block)
|
43
|
-
Validator.validate(self, attributes.with_indifferent_access) if validate && name
|
44
|
-
super(attributes, safe, &block)
|
45
|
-
end
|
46
43
|
end
|
47
44
|
end
|
48
45
|
end
|
@@ -20,7 +20,7 @@ module Cocina
|
|
20
20
|
attribute :embargo, Embargo.optional.meta(omittable: true)
|
21
21
|
# The human readable use and reproduction statement that applies
|
22
22
|
# example: Property rights reside with the repository. Literary rights reside with the creators of the documents or their heirs. To obtain permission to publish or reproduce, please contact the Public Services Librarian of the Dept. of Special Collections (http://library.stanford.edu/spc).
|
23
|
-
attribute :useAndReproductionStatement, Types::Strict::String.meta(omittable: true)
|
23
|
+
attribute :useAndReproductionStatement, Types::Strict::String.optional.meta(omittable: true)
|
24
24
|
# The license governing reuse of the DRO. Should be an IRI for known licenses (i.e. CC, RightsStatement.org URI, etc.).
|
25
25
|
attribute :license, Types::Strict::String.optional.enum('https://www.gnu.org/licenses/agpl.txt', 'https://www.apache.org/licenses/LICENSE-2.0', 'https://opensource.org/licenses/BSD-2-Clause', 'https://opensource.org/licenses/BSD-3-Clause', 'https://creativecommons.org/licenses/by/4.0/legalcode', 'https://creativecommons.org/licenses/by-nc/4.0/legalcode', 'https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode', 'https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode', 'https://creativecommons.org/licenses/by-nd/4.0/legalcode', 'https://creativecommons.org/licenses/by-sa/4.0/legalcode', 'https://creativecommons.org/publicdomain/zero/1.0/legalcode', 'https://opensource.org/licenses/cddl1', 'https://www.eclipse.org/legal/epl-2.0', 'https://www.gnu.org/licenses/gpl-3.0-standalone.html', 'https://www.isc.org/downloads/software-support-policy/isc-license/', 'https://www.gnu.org/licenses/lgpl-3.0-standalone.html', 'https://opensource.org/licenses/MIT', 'https://www.mozilla.org/MPL/2.0/', 'https://opendatacommons.org/licenses/by/1-0/', 'http://opendatacommons.org/licenses/odbl/1.0/', 'https://opendatacommons.org/licenses/odbl/1-0/', 'https://creativecommons.org/publicdomain/mark/1.0/', 'https://opendatacommons.org/licenses/pddl/1-0/', 'https://creativecommons.org/licenses/by/3.0/legalcode', 'https://creativecommons.org/licenses/by-sa/3.0/legalcode', 'https://creativecommons.org/licenses/by-nd/3.0/legalcode', 'https://creativecommons.org/licenses/by-nc/3.0/legalcode', 'https://creativecommons.org/licenses/by-nc-sa/3.0/legalcode', 'https://creativecommons.org/licenses/by-nc-nd/3.0/legalcode', 'http://cocina.sul.stanford.edu/licenses/none').meta(omittable: true)
|
26
26
|
end
|
@@ -19,7 +19,7 @@ module Cocina
|
|
19
19
|
attribute :releaseDate, Types::Params::DateTime
|
20
20
|
# The human readable use and reproduction statement that applies when the embargo expires.
|
21
21
|
# example: These materials are in the public domain.
|
22
|
-
attribute :useAndReproductionStatement, Types::Strict::String.meta(omittable: true)
|
22
|
+
attribute :useAndReproductionStatement, Types::Strict::String.optional.meta(omittable: true)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -4,7 +4,7 @@ module Cocina
|
|
4
4
|
module Models
|
5
5
|
class Identification < Struct
|
6
6
|
# A barcode
|
7
|
-
attribute :barcode, Types::Nominal::Any.
|
7
|
+
attribute :barcode, Types::Nominal::Any.meta(omittable: true)
|
8
8
|
attribute :catalogLinks, Types::Strict::Array.of(CatalogLink).default([].freeze)
|
9
9
|
# Digital Object Identifier (https://www.doi.org)
|
10
10
|
# example: 10.25740/bc123df4567
|
@@ -3,6 +3,8 @@
|
|
3
3
|
module Cocina
|
4
4
|
module Models
|
5
5
|
class RequestAdminPolicy < Struct
|
6
|
+
include Validatable
|
7
|
+
|
6
8
|
include Checkable
|
7
9
|
|
8
10
|
TYPES = ['http://cocina.sul.stanford.edu/models/admin_policy.jsonld'].freeze
|
@@ -12,14 +14,9 @@ module Cocina
|
|
12
14
|
attribute :cocinaVersion, Types::Strict::String.default(Cocina::Models::VERSION)
|
13
15
|
attribute :type, Types::Strict::String.enum(*RequestAdminPolicy::TYPES)
|
14
16
|
attribute :label, Types::Strict::String
|
15
|
-
attribute :version, Types::Strict::Integer
|
17
|
+
attribute :version, Types::Strict::Integer.default(1).enum(1)
|
16
18
|
attribute(:administrative, AdminPolicyAdministrative.default { AdminPolicyAdministrative.new })
|
17
19
|
attribute :description, RequestDescription.optional.meta(omittable: true)
|
18
|
-
|
19
|
-
def self.new(attributes = default_attributes, safe = false, validate = true, &block)
|
20
|
-
Validator.validate(self, attributes.with_indifferent_access) if validate && name
|
21
|
-
super(attributes, safe, &block)
|
22
|
-
end
|
23
20
|
end
|
24
21
|
end
|
25
22
|
end
|
@@ -3,6 +3,8 @@
|
|
3
3
|
module Cocina
|
4
4
|
module Models
|
5
5
|
class RequestCollection < Struct
|
6
|
+
include Validatable
|
7
|
+
|
6
8
|
include Checkable
|
7
9
|
|
8
10
|
TYPES = ['http://cocina.sul.stanford.edu/models/collection.jsonld',
|
@@ -16,16 +18,11 @@ module Cocina
|
|
16
18
|
attribute :cocinaVersion, Types::Strict::String.default(Cocina::Models::VERSION)
|
17
19
|
attribute :type, Types::Strict::String.enum(*RequestCollection::TYPES)
|
18
20
|
attribute :label, Types::Strict::String
|
19
|
-
attribute :version, Types::Strict::Integer
|
21
|
+
attribute :version, Types::Strict::Integer.default(1).enum(1)
|
20
22
|
attribute(:access, CollectionAccess.default { CollectionAccess.new })
|
21
23
|
attribute(:administrative, Administrative.default { Administrative.new })
|
22
24
|
attribute :description, RequestDescription.optional.meta(omittable: true)
|
23
25
|
attribute :identification, CollectionIdentification.optional.meta(omittable: true)
|
24
|
-
|
25
|
-
def self.new(attributes = default_attributes, safe = false, validate = true, &block)
|
26
|
-
Validator.validate(self, attributes.with_indifferent_access) if validate && name
|
27
|
-
super(attributes, safe, &block)
|
28
|
-
end
|
29
26
|
end
|
30
27
|
end
|
31
28
|
end
|
@@ -3,6 +3,8 @@
|
|
3
3
|
module Cocina
|
4
4
|
module Models
|
5
5
|
class RequestDescription < Struct
|
6
|
+
include Validatable
|
7
|
+
|
6
8
|
attribute :title, Types::Strict::Array.of(Title).default([].freeze)
|
7
9
|
attribute :contributor, Types::Strict::Array.of(Contributor).default([].freeze)
|
8
10
|
attribute :event, Types::Strict::Array.of(Event).default([].freeze)
|
@@ -18,11 +20,6 @@ module Cocina
|
|
18
20
|
attribute :adminMetadata, DescriptiveAdminMetadata.optional.meta(omittable: true)
|
19
21
|
# URL or other pointer to the location of the resource description.
|
20
22
|
attribute :valueAt, Types::Strict::String.meta(omittable: true)
|
21
|
-
|
22
|
-
def self.new(attributes = default_attributes, safe = false, validate = true, &block)
|
23
|
-
Validator.validate(self, attributes.with_indifferent_access) if validate && name
|
24
|
-
super(attributes, safe, &block)
|
25
|
-
end
|
26
23
|
end
|
27
24
|
end
|
28
25
|
end
|
@@ -3,6 +3,8 @@
|
|
3
3
|
module Cocina
|
4
4
|
module Models
|
5
5
|
class RequestDRO < Struct
|
6
|
+
include Validatable
|
7
|
+
|
6
8
|
include Checkable
|
7
9
|
|
8
10
|
TYPES = ['http://cocina.sul.stanford.edu/models/object.jsonld',
|
@@ -26,18 +28,13 @@ module Cocina
|
|
26
28
|
attribute :cocinaVersion, Types::Strict::String.default(Cocina::Models::VERSION)
|
27
29
|
attribute :type, Types::Strict::String.enum(*RequestDRO::TYPES)
|
28
30
|
attribute :label, Types::Strict::String
|
29
|
-
attribute :version, Types::Strict::Integer
|
31
|
+
attribute :version, Types::Strict::Integer.default(1).enum(1)
|
30
32
|
attribute :access, DROAccess.optional.meta(omittable: true)
|
31
33
|
attribute(:administrative, Administrative.default { Administrative.new })
|
32
34
|
attribute :description, RequestDescription.optional.meta(omittable: true)
|
33
35
|
attribute(:identification, RequestIdentification.default { RequestIdentification.new })
|
34
36
|
attribute :structural, RequestDROStructural.optional.meta(omittable: true)
|
35
37
|
attribute :geographic, Geographic.optional.meta(omittable: true)
|
36
|
-
|
37
|
-
def self.new(attributes = default_attributes, safe = false, validate = true, &block)
|
38
|
-
Validator.validate(self, attributes.with_indifferent_access) if validate && name
|
39
|
-
super(attributes, safe, &block)
|
40
|
-
end
|
41
38
|
end
|
42
39
|
end
|
43
40
|
end
|
@@ -4,7 +4,7 @@ module Cocina
|
|
4
4
|
module Models
|
5
5
|
class RequestIdentification < Struct
|
6
6
|
# A barcode
|
7
|
-
attribute :barcode, Types::Nominal::Any.
|
7
|
+
attribute :barcode, Types::Nominal::Any.meta(omittable: true)
|
8
8
|
attribute :catalogLinks, Types::Strict::Array.of(CatalogLink).default([].freeze)
|
9
9
|
# Unique identifier in some other system. This is because a large proportion of what is deposited in SDR, historically and currently, are representations of objects that are also represented in other systems. For example, digitized paper and A/V collections have physical manifestations, and those physical objects are managed in systems that have their own identifiers. Similarly, books have barcodes, archival materials have collection numbers and physical locations, etc. The sourceId allows determining if an item has been deposited before and where to look for the original item if you're looking at its SDR representation. The format is: "namespace:identifier"
|
10
10
|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cocina
|
4
|
+
module Models
|
5
|
+
# Validate upon construction
|
6
|
+
module Validatable
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
class_methods do
|
10
|
+
def new(attributes = default_attributes, safe = false, validate = true, &block)
|
11
|
+
Validator.validate(self, attributes.with_indifferent_access) if validate && name
|
12
|
+
super(attributes, safe, &block)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def new(*args)
|
17
|
+
validate = args.first.delete(:validate) if args.present?
|
18
|
+
new_model = super(*args)
|
19
|
+
Validator.validate(new_model.class, new_model.to_h) if (validate || validate.nil?) && self.class.name
|
20
|
+
new_model
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -35,7 +35,7 @@ module Cocina
|
|
35
35
|
|
36
36
|
# rubocop:disable Style/ClassVars
|
37
37
|
def self.root
|
38
|
-
@@root ||= OpenAPIParser.parse(YAML.load_file(openapi_path))
|
38
|
+
@@root ||= OpenAPIParser.parse(YAML.load_file(openapi_path), strict_reference_validation: true)
|
39
39
|
end
|
40
40
|
# rubocop:enable Style/ClassVars
|
41
41
|
private_class_method :root
|
data/openapi.yml
CHANGED
@@ -178,6 +178,7 @@ components:
|
|
178
178
|
description: Administrative or Internal project this resource is a part of
|
179
179
|
example: Google Books
|
180
180
|
type: string
|
181
|
+
nullable: true
|
181
182
|
required:
|
182
183
|
- hasAdminPolicy
|
183
184
|
AdminPolicy:
|
@@ -212,11 +213,6 @@ components:
|
|
212
213
|
type: object
|
213
214
|
additionalProperties: false
|
214
215
|
properties:
|
215
|
-
defaultObjectRights:
|
216
|
-
type: string
|
217
|
-
description: This is an XML expression of the default access (see defaultAccess)
|
218
|
-
deprecated: true
|
219
|
-
default: <?xml version="1.0" encoding="UTF-8"?><rightsMetadata><access type="discover"><machine><world/></machine></access><access type="read"><machine><world/></machine></access><use><human type="useAndReproduction"/><human type="creativeCommons"/><machine type="creativeCommons" uri=""/><human type="openDataCommons"/><machine type="openDataCommons" uri=""/></use><copyright><human/></copyright></rightsMetadata>
|
220
216
|
defaultAccess:
|
221
217
|
$ref: '#/components/schemas/AdminPolicyDefaultAccess'
|
222
218
|
registrationWorkflow:
|
@@ -245,6 +241,7 @@ components:
|
|
245
241
|
required:
|
246
242
|
- hasAdminPolicy
|
247
243
|
- hasAgreement
|
244
|
+
- defaultAccess
|
248
245
|
AdminPolicyDefaultAccess:
|
249
246
|
description: 'Provides the default access settings for an AdminPolicy. This is almost the same as DROAccess, but it provides no defaults and has no embargo.'
|
250
247
|
type: object
|
@@ -314,7 +311,6 @@ components:
|
|
314
311
|
$ref: "#/components/schemas/DescriptiveBasicValue"
|
315
312
|
Barcode:
|
316
313
|
description: 'A barcode'
|
317
|
-
nullable: true
|
318
314
|
oneOf:
|
319
315
|
- $ref: '#/components/schemas/BusinessBarcode'
|
320
316
|
- $ref: '#/components/schemas/LaneMedicalBarcode'
|
@@ -416,6 +412,7 @@ components:
|
|
416
412
|
$ref: '#/components/schemas/CollectionIdentification'
|
417
413
|
required:
|
418
414
|
- cocinaVersion
|
415
|
+
- description
|
419
416
|
- externalIdentifier
|
420
417
|
- label
|
421
418
|
- type
|
@@ -442,9 +439,11 @@ components:
|
|
442
439
|
description: The human readable use and reproduction statement that applies
|
443
440
|
example: Property rights reside with the repository. Literary rights reside with the creators of the documents or their heirs. To obtain permission to publish or reproduce, please contact the Public Services Librarian of the Dept. of Special Collections (http://library.stanford.edu/spc).
|
444
441
|
type: string
|
442
|
+
nullable: true
|
445
443
|
license:
|
446
444
|
description: The license governing reuse of the Collection. Should be an IRI for known licenses (i.e. CC, RightsStatement.org URI, etc.).
|
447
445
|
type: string
|
446
|
+
nullable: true
|
448
447
|
CollectionIdentification:
|
449
448
|
type: object
|
450
449
|
additionalProperties: false
|
@@ -894,6 +893,7 @@ components:
|
|
894
893
|
- cocinaVersion
|
895
894
|
- access
|
896
895
|
- administrative
|
896
|
+
- description
|
897
897
|
- externalIdentifier
|
898
898
|
- label
|
899
899
|
- type
|
@@ -916,6 +916,7 @@ components:
|
|
916
916
|
description: The human readable use and reproduction statement that applies
|
917
917
|
example: Property rights reside with the repository. Literary rights reside with the creators of the documents or their heirs. To obtain permission to publish or reproduce, please contact the Public Services Librarian of the Dept. of Special Collections (http://library.stanford.edu/spc).
|
918
918
|
type: string
|
919
|
+
nullable: true
|
919
920
|
license:
|
920
921
|
description: The license governing reuse of the DRO. Should be an IRI for known licenses (i.e. CC, RightsStatement.org URI, etc.).
|
921
922
|
type: string
|
@@ -991,6 +992,7 @@ components:
|
|
991
992
|
description: The human readable use and reproduction statement that applies when the embargo expires.
|
992
993
|
example: These materials are in the public domain.
|
993
994
|
type: string
|
995
|
+
nullable: true
|
994
996
|
required:
|
995
997
|
- releaseDate
|
996
998
|
Event:
|
@@ -1482,6 +1484,9 @@ components:
|
|
1482
1484
|
type: string
|
1483
1485
|
version:
|
1484
1486
|
type: integer
|
1487
|
+
default: 1
|
1488
|
+
enum:
|
1489
|
+
- 1
|
1485
1490
|
administrative:
|
1486
1491
|
$ref: '#/components/schemas/AdminPolicyAdministrative'
|
1487
1492
|
description:
|
@@ -1511,6 +1516,9 @@ components:
|
|
1511
1516
|
type: string
|
1512
1517
|
version:
|
1513
1518
|
type: integer
|
1519
|
+
default: 1
|
1520
|
+
enum:
|
1521
|
+
- 1
|
1514
1522
|
access:
|
1515
1523
|
$ref: '#/components/schemas/CollectionAccess'
|
1516
1524
|
administrative:
|
@@ -1628,6 +1636,9 @@ components:
|
|
1628
1636
|
type: string
|
1629
1637
|
version:
|
1630
1638
|
type: integer
|
1639
|
+
default: 1
|
1640
|
+
enum:
|
1641
|
+
- 1
|
1631
1642
|
access:
|
1632
1643
|
$ref: '#/components/schemas/DROAccess'
|
1633
1644
|
administrative:
|
@@ -1845,6 +1856,7 @@ components:
|
|
1845
1856
|
StandardBarcode:
|
1846
1857
|
description: The standard barcode associated with a DRO object, prefixed with 36105
|
1847
1858
|
type: string
|
1859
|
+
nullable: true
|
1848
1860
|
pattern: '^36105[0-9]{9}$'
|
1849
1861
|
example: '36105010362304'
|
1850
1862
|
Title:
|
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.
|
4
|
+
version: 0.67.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: 2022-
|
11
|
+
date: 2022-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -70,16 +70,16 @@ dependencies:
|
|
70
70
|
name: openapi_parser
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
75
|
+
version: '1.0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
82
|
+
version: '1.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: thor
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -338,6 +338,7 @@ files:
|
|
338
338
|
- lib/cocina/models/standard_barcode.rb
|
339
339
|
- lib/cocina/models/stanford_access.rb
|
340
340
|
- lib/cocina/models/title.rb
|
341
|
+
- lib/cocina/models/validatable.rb
|
341
342
|
- lib/cocina/models/validator.rb
|
342
343
|
- lib/cocina/models/version.rb
|
343
344
|
- lib/cocina/models/vocab.rb
|
@@ -362,7 +363,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
362
363
|
- !ruby/object:Gem::Version
|
363
364
|
version: '0'
|
364
365
|
requirements: []
|
365
|
-
rubygems_version: 3.
|
366
|
+
rubygems_version: 3.3.4
|
366
367
|
signing_key:
|
367
368
|
specification_version: 4
|
368
369
|
summary: Data models for the SDR
|