cocina-models 0.58.1 → 0.61.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/.rubocop_todo.yml +5 -5
- data/README.md +34 -24
- data/lib/cocina/generator/schema.rb +30 -2
- data/lib/cocina/generator/schema_array.rb +1 -1
- data/lib/cocina/generator/schema_base.rb +18 -8
- data/lib/cocina/generator/schema_ref.rb +1 -1
- data/lib/cocina/generator/schema_value.rb +2 -2
- data/lib/cocina/models/access.rb +10 -11
- data/lib/cocina/models/admin_policy.rb +0 -1
- data/lib/cocina/models/admin_policy_administrative.rb +3 -3
- data/lib/cocina/models/admin_policy_default_access.rb +3 -3
- data/lib/cocina/models/administrative.rb +1 -1
- data/lib/cocina/models/citation_only_access.rb +15 -0
- data/lib/cocina/models/collection.rb +1 -2
- data/lib/cocina/models/collection_access.rb +18 -0
- data/lib/cocina/models/collection_identification.rb +2 -2
- data/lib/cocina/models/contributor.rb +3 -3
- data/lib/cocina/models/controlled_digital_lending_access.rb +16 -0
- data/lib/cocina/models/dark_access.rb +15 -0
- data/lib/cocina/models/description.rb +3 -3
- data/lib/cocina/models/descriptive_basic_value.rb +8 -8
- data/lib/cocina/models/descriptive_parallel_contributor.rb +3 -3
- data/lib/cocina/models/descriptive_parallel_event.rb +2 -2
- data/lib/cocina/models/descriptive_value.rb +8 -8
- data/lib/cocina/models/descriptive_value_language.rb +4 -4
- data/lib/cocina/models/doi.rb +9 -0
- data/lib/cocina/models/dro.rb +0 -1
- data/lib/cocina/models/dro_access.rb +12 -10
- data/lib/cocina/models/dro_structural.rb +1 -1
- data/lib/cocina/models/embargo.rb +12 -3
- data/lib/cocina/models/event.rb +2 -2
- data/lib/cocina/models/file.rb +3 -3
- data/lib/cocina/models/file_access.rb +10 -7
- data/lib/cocina/models/identification.rb +7 -4
- data/lib/cocina/models/lane_medical_barcode.rb +9 -0
- data/lib/cocina/models/language.rb +7 -7
- data/lib/cocina/models/location_based_access.rb +15 -0
- data/lib/cocina/models/location_based_download_access.rb +15 -0
- data/lib/cocina/models/presentation.rb +2 -2
- data/lib/cocina/models/purl.rb +9 -0
- data/lib/cocina/models/related_resource.rb +7 -7
- data/lib/cocina/models/release_tag.rb +4 -4
- data/lib/cocina/models/request_admin_policy.rb +0 -1
- data/lib/cocina/models/request_collection.rb +1 -2
- data/lib/cocina/models/request_dro.rb +0 -1
- data/lib/cocina/models/request_dro_structural.rb +1 -1
- data/lib/cocina/models/request_file.rb +4 -4
- data/lib/cocina/models/request_identification.rb +6 -3
- data/lib/cocina/models/sequence.rb +1 -1
- data/lib/cocina/models/source.rb +4 -4
- data/lib/cocina/models/standard.rb +4 -4
- data/lib/cocina/models/stanford_access.rb +15 -0
- data/lib/cocina/models/title.rb +8 -8
- data/lib/cocina/models/version.rb +1 -1
- data/lib/cocina/models/world_access.rb +15 -0
- data/openapi.yml +351 -172
- metadata +13 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83f1515b4aa8389d471458c9c58f499fddbfe0f2cbf01b4be56c70f50ec77cd3
|
4
|
+
data.tar.gz: 0a6de21eadb30b5efb2512cb2786ec290815314181c054d9012a29518d2f4021
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab9f26de5fb14d9e036034acec1c056cf5a067d426d0547e93cd05d5573b53617c97afa77c00417adbd270278edcf1edbcc40bb3db56512cf702a568fca6a808
|
7
|
+
data.tar.gz: 8c368c49dd7581348a98898229c7bae57eab65fc31f0bdcced427d31e65294594b57ce76b36a2489cc263720d992bee4c1b0201e503e0ba8680e9848de4d9dcc
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2021-04-16 17:25:55 UTC using RuboCop version 0.93.1.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -8,15 +8,15 @@
|
|
8
8
|
|
9
9
|
# Offense count: 1
|
10
10
|
# Configuration parameters: AllowedMethods.
|
11
|
-
# AllowedMethods: present?, blank?, presence, try, try
|
11
|
+
# AllowedMethods: present?, blank?, presence, try, try!, in?
|
12
12
|
Lint/SafeNavigationChain:
|
13
13
|
Exclude:
|
14
14
|
- 'lib/cocina/generator/schema_base.rb'
|
15
15
|
|
16
16
|
# Offense count: 1
|
17
|
-
# Configuration parameters:
|
18
|
-
Metrics/
|
19
|
-
Max:
|
17
|
+
# Configuration parameters: CountKeywordArgs.
|
18
|
+
Metrics/ParameterLists:
|
19
|
+
Max: 6
|
20
20
|
|
21
21
|
# Offense count: 1
|
22
22
|
# Configuration parameters: MinBodyLength.
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
This is a Ruby implementation of the SDR data model (named "COCINA"). The data being modeled includes digital repository objects.
|
10
10
|
|
11
|
-
Validation is performed by openapi (using OpenAPIParser). Modeling is provided by dry-struct and dry-types. Together, these provide a way for consumers to validate objects against models and to manipulate
|
11
|
+
Validation is performed by openapi (using OpenAPIParser). Modeling is provided by dry-struct and dry-types. Together, these provide a way for consumers to validate objects against models and to manipulate those objects.
|
12
12
|
|
13
13
|
This is a work in progress that will ultimately implement the full [COCINA data model](http://sul-dlss.github.io/cocina-models/). See also [architecture documentation](https://sul-dlss.github.io/taco-truck/COCINA.html#cocina-data-models--shapes).
|
14
14
|
|
@@ -34,44 +34,54 @@ Beyond what is necessary to test the generator, the Cocina model classes are not
|
|
34
34
|
|
35
35
|
## Releasing
|
36
36
|
|
37
|
+
### Step 0: Share intent to change the models
|
38
|
+
|
39
|
+
Send a note to `#dlss-infra-chg-mgmt` on Slack to let people know what is changing and when.
|
40
|
+
|
41
|
+
### Step 1: Cut the release
|
42
|
+
|
37
43
|
The release process is much like any other gem. First bump the version in `lib/cocina/models/version.rb`, and commit the result. Then run:
|
38
44
|
```
|
39
45
|
bundle exec rake release
|
40
46
|
```
|
41
47
|
which pushes the gem to rubygems.org. Next write up the release notes: https://github.com/sul-dlss/cocina-models/releases .
|
42
48
|
|
43
|
-
|
49
|
+
### Step 2: Update client gems coupled to the models
|
44
50
|
|
45
|
-
|
51
|
+
Next, you should release 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 this version because applications such as [Argo](https://github.com/sul-dlss/argo) depend on both of these gems using the same models.
|
46
52
|
|
47
|
-
|
53
|
+
### Step 3: Update service API specifications and gems
|
54
|
+
|
55
|
+
The cocina-models gem is used in applications that have an API specification that accepts Cocina models. Next, make sure that the `openapi.yml` for these applications include the `openapi.yml` schema changes made in cocina-models. This list of services is known to include:
|
56
|
+
|
57
|
+
* [sul-dlss/sdr-api](https://github.com/sul-dlss/sdr-api)
|
58
|
+
* [sul-dlss/dor-services-app](https://github.com/sul-dlss/dor-services-app/)
|
48
59
|
|
49
|
-
|
60
|
+
This can be accomplished by copying and pasting these schemas. By convention, these schemas are listed first in the `openapi.yml` of the associated projects, followed by the application-specific schemas.
|
50
61
|
|
51
|
-
|
62
|
+
#### Step 3b: Bump gems
|
52
63
|
|
53
|
-
|
54
|
-
* sul-dlss/dor-services-app
|
55
|
-
* sul-dlss/google-books
|
56
|
-
* sul-dlss/common-accessioning
|
57
|
-
* sul-dlss/argo
|
58
|
-
* sul-dlss/pre-assembly
|
59
|
-
* sul-dlss/hydrus
|
60
|
-
* sul-dlss/happy-heron
|
61
|
-
* sul-dlss/infrastructure-integration-test
|
62
|
-
* sul-dlss/dor_indexing_app
|
64
|
+
At the same, we have found it convenient to use these 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.
|
63
65
|
|
64
|
-
|
66
|
+
### Step 4: Update other dependent applications
|
65
67
|
|
66
|
-
|
68
|
+
Once the above listed steps have been completed, all the following applications that use cocina-models should be updated and released at the same time:
|
67
69
|
|
68
|
-
|
70
|
+
* [sul-dlss/dor_indexing_app](https://github.com/sul-dlss/dor_indexing_app/)
|
71
|
+
* [sul-dlss/common-accessioning](https://github.com/sul-dlss/common-accessioning/)
|
72
|
+
* [sul-dlss/google-books](https://github.com/sul-dlss/google-books/)
|
73
|
+
* [sul-dlss/argo](https://github.com/sul-dlss/argo/)
|
74
|
+
* [sul-dlss/pre-assembly](https://github.com/sul-dlss/pre-assembly/)
|
75
|
+
* [sul-dlss/hydrus](https://github.com/sul-dlss/hydra_etd/)
|
76
|
+
* [sul-dlss/hydrus](https://github.com/sul-dlss/hydrus/)
|
77
|
+
* [sul-dlss/happy-heron](https://github.com/sul-dlss/happy-heron/)
|
78
|
+
* [sul-dlss/infrastructure-integration-test](https://github.com/sul-dlss/infrastructure-integration-test/)
|
69
79
|
|
70
|
-
|
80
|
+
## Usage conventions
|
71
81
|
|
72
82
|
The following are the recommended naming conventions for code using Cocina models:
|
73
83
|
|
74
|
-
* cocina_item
|
75
|
-
* cocina_admin_policy
|
76
|
-
* cocina_collection
|
77
|
-
* cocina_object
|
84
|
+
* `cocina_item`: `Cocina::Models::DRO` instance
|
85
|
+
* `cocina_admin_policy`: `Cocina::Models::AdminPolicy` instance
|
86
|
+
* `cocina_collection`: `Cocina::Models::Collection` instance
|
87
|
+
* `cocina_object`: `Cocina::Models::DRO` or `Cocina::Models::AdminPolicy` or `Cocina::Models::Collection` instance
|
@@ -5,7 +5,7 @@ module Cocina
|
|
5
5
|
# Class for generating from an openapi schema
|
6
6
|
class Schema < SchemaBase
|
7
7
|
def schema_properties
|
8
|
-
@schema_properties ||= (properties + all_of_properties).uniq(&:key)
|
8
|
+
@schema_properties ||= (properties + all_of_properties + one_of_properties).uniq(&:key)
|
9
9
|
end
|
10
10
|
|
11
11
|
def generate
|
@@ -83,20 +83,48 @@ module Cocina
|
|
83
83
|
all_of_properties_for(schema_doc)
|
84
84
|
end
|
85
85
|
|
86
|
+
def one_of_properties
|
87
|
+
one_of_properties_for(schema_doc)
|
88
|
+
end
|
89
|
+
|
86
90
|
def all_of_properties_for(doc)
|
87
91
|
return [] if doc.all_of.nil?
|
88
92
|
|
89
93
|
doc.all_of.map do |all_of_schema|
|
90
94
|
# All of for this + recurse
|
91
|
-
schema_properties_for(all_of_schema) +
|
95
|
+
schema_properties_for(all_of_schema) +
|
96
|
+
all_of_properties_for(all_of_schema) +
|
97
|
+
one_of_properties_for(all_of_schema)
|
92
98
|
end.flatten
|
93
99
|
end
|
94
100
|
|
101
|
+
def one_of_properties_for(doc)
|
102
|
+
return [] if doc.one_of.nil?
|
103
|
+
|
104
|
+
# All properties must be objects.
|
105
|
+
unless doc.one_of.all? { |schema| schema.type == 'object' }
|
106
|
+
raise 'All properties for oneOf must be objects'
|
107
|
+
end
|
108
|
+
|
109
|
+
doc.one_of.flat_map do |one_of_doc|
|
110
|
+
one_of_doc.properties.map do |key, properties_doc|
|
111
|
+
property_class_for(properties_doc).new(properties_doc,
|
112
|
+
key: key,
|
113
|
+
# The property does less validation because may vary between
|
114
|
+
# different oneOf schemas. Validation is still performed
|
115
|
+
# by openAPI.
|
116
|
+
relaxed: true,
|
117
|
+
parent: self)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
95
122
|
def schema_properties_for(doc)
|
96
123
|
doc.properties.map do |key, properties_doc|
|
97
124
|
property_class_for(properties_doc).new(properties_doc,
|
98
125
|
key: key,
|
99
126
|
required: doc.requires?(key),
|
127
|
+
nullable: properties_doc.nullable?,
|
100
128
|
parent: self)
|
101
129
|
end
|
102
130
|
end
|
@@ -4,13 +4,15 @@ module Cocina
|
|
4
4
|
module Generator
|
5
5
|
# Base class for generating from openapi
|
6
6
|
class SchemaBase
|
7
|
-
attr_reader :schema_doc, :key, :required, :parent
|
7
|
+
attr_reader :schema_doc, :key, :required, :nullable, :parent, :relaxed
|
8
8
|
|
9
|
-
def initialize(schema_doc, key: nil, required: false, parent: nil)
|
9
|
+
def initialize(schema_doc, key: nil, required: false, nullable: false, parent: nil, relaxed: false)
|
10
10
|
@schema_doc = schema_doc
|
11
11
|
@key = key
|
12
12
|
@required = required
|
13
|
+
@nullable = nullable
|
13
14
|
@parent = parent
|
15
|
+
@relaxed = relaxed
|
14
16
|
end
|
15
17
|
|
16
18
|
def filename
|
@@ -24,17 +26,15 @@ module Cocina
|
|
24
26
|
# Allows non-required values to not be provided. This allows smaller
|
25
27
|
# requests as not every field needs to be present.
|
26
28
|
def omittable
|
27
|
-
return '' if required
|
29
|
+
return '' if required && !relaxed
|
28
30
|
|
29
31
|
'.meta(omittable: true)'
|
30
32
|
end
|
31
33
|
|
32
|
-
# Allows
|
34
|
+
# Allows nillable values to be set to nil. This is useful when doing
|
33
35
|
# an update and you want to clear out a value.
|
34
36
|
def optional
|
35
|
-
|
36
|
-
|
37
|
-
'.optional'
|
37
|
+
nullable || relaxed ? '.optional' : ''
|
38
38
|
end
|
39
39
|
|
40
40
|
def quote(item)
|
@@ -55,6 +55,12 @@ module Cocina
|
|
55
55
|
"# example: #{schema_doc.example}\n"
|
56
56
|
end
|
57
57
|
|
58
|
+
def relaxed_comment
|
59
|
+
return '' unless relaxed
|
60
|
+
|
61
|
+
"# Validation of this property is relaxed. See the openapi for full validation.\n"
|
62
|
+
end
|
63
|
+
|
58
64
|
def dry_datatype(doc)
|
59
65
|
case doc.type
|
60
66
|
when 'integer'
|
@@ -64,7 +70,7 @@ module Cocina
|
|
64
70
|
when 'boolean'
|
65
71
|
'Strict::Bool'
|
66
72
|
else
|
67
|
-
if
|
73
|
+
if any_datatype?(doc)
|
68
74
|
'Nominal::Any'
|
69
75
|
else
|
70
76
|
raise "#{schema_doc.type} not supported"
|
@@ -72,6 +78,10 @@ module Cocina
|
|
72
78
|
end
|
73
79
|
end
|
74
80
|
|
81
|
+
def any_datatype?(doc)
|
82
|
+
relaxed || doc.one_of&.map(&:type).all? { |o| %w[integer string].include?(o) }
|
83
|
+
end
|
84
|
+
|
75
85
|
def string_dry_datatype(doc)
|
76
86
|
case doc.format
|
77
87
|
when 'date-time'
|
@@ -5,7 +5,7 @@ module Cocina
|
|
5
5
|
# Class for generating from an openapi reference
|
6
6
|
class SchemaRef < SchemaBase
|
7
7
|
def generate
|
8
|
-
if required
|
8
|
+
if required && !relaxed
|
9
9
|
"attribute(:#{name.camelize(:lower)}, #{schema_doc.name}.default { #{schema_doc.name}.new })"
|
10
10
|
else
|
11
11
|
"attribute :#{name.camelize(:lower)}, #{schema_doc.name}.optional.meta(omittable: true)"
|
@@ -7,14 +7,14 @@ module Cocina
|
|
7
7
|
# rubocop:disable Layout/LineLength
|
8
8
|
def generate
|
9
9
|
# optional has to come before default or the default value that gets set will be nil.
|
10
|
-
"#{description}#{example}attribute :#{name.camelize(:lower)}, Types::#{dry_datatype(schema_doc)}#{optional}#{default}#{enum}#{omittable}"
|
10
|
+
"#{description}#{example}#{relaxed_comment}attribute :#{name.camelize(:lower)}, Types::#{dry_datatype(schema_doc)}#{optional}#{default}#{enum}#{omittable}"
|
11
11
|
end
|
12
12
|
# rubocop:enable Layout/LineLength
|
13
13
|
|
14
14
|
private
|
15
15
|
|
16
16
|
def enum
|
17
|
-
return ''
|
17
|
+
return '' if !schema_doc.enum || relaxed
|
18
18
|
|
19
19
|
items = use_types? ? "*#{parent.name}::TYPES" : schema_doc.enum.map { |item| quote(item) }.join(', ')
|
20
20
|
|
data/lib/cocina/models/access.rb
CHANGED
@@ -3,18 +3,17 @@
|
|
3
3
|
module Cocina
|
4
4
|
module Models
|
5
5
|
class Access < Struct
|
6
|
-
# Access level
|
7
|
-
|
8
|
-
|
9
|
-
#
|
10
|
-
|
6
|
+
# Access level.
|
7
|
+
# Validation of this property is relaxed. See the openapi for full validation.
|
8
|
+
attribute :access, Types::Strict::String.optional.default('dark').meta(omittable: true)
|
9
|
+
# Download access level.
|
10
|
+
# Validation of this property is relaxed. See the openapi for full validation.
|
11
|
+
attribute :download, Types::Strict::String.optional.default('none').meta(omittable: true)
|
11
12
|
# If access is "location-based", which location should have access.
|
12
|
-
|
13
|
-
|
14
|
-
#
|
15
|
-
attribute :
|
16
|
-
# The license governing reuse of the Collection. Should be an IRI for known licenses (i.e. CC, RightsStatement.org URI, etc.).
|
17
|
-
attribute :license, Types::Strict::String.optional.meta(omittable: true)
|
13
|
+
# Validation of this property is relaxed. See the openapi for full validation.
|
14
|
+
attribute :readLocation, Types::Strict::String.optional.meta(omittable: true)
|
15
|
+
# Validation of this property is relaxed. See the openapi for full validation.
|
16
|
+
attribute :controlledDigitalLending, Types::Strict::Bool.optional.meta(omittable: true)
|
18
17
|
end
|
19
18
|
end
|
20
19
|
end
|
@@ -7,7 +7,6 @@ module Cocina
|
|
7
7
|
|
8
8
|
TYPES = ['http://cocina.sul.stanford.edu/models/admin_policy.jsonld'].freeze
|
9
9
|
|
10
|
-
# example: item
|
11
10
|
attribute :type, Types::Strict::String.enum(*AdminPolicy::TYPES)
|
12
11
|
# example: druid:bc123df4567
|
13
12
|
attribute :externalIdentifier, Types::Strict::String
|
@@ -4,17 +4,17 @@ module Cocina
|
|
4
4
|
module Models
|
5
5
|
class AdminPolicyAdministrative < Struct
|
6
6
|
# This is an XML expression of the default access (see defaultAccess)
|
7
|
-
attribute :defaultObjectRights, Types::Strict::String.
|
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
8
|
attribute :defaultAccess, AdminPolicyDefaultAccess.optional.meta(omittable: true)
|
9
9
|
attribute :registrationWorkflow, Types::Strict::Array.of(Types::Strict::String).meta(omittable: true)
|
10
10
|
# An additional workflow to start for objects managed by this admin policy once the end-accession workflow step is complete
|
11
11
|
# example: wasCrawlPreassemblyWF
|
12
|
-
attribute :disseminationWorkflow, Types::Strict::String.
|
12
|
+
attribute :disseminationWorkflow, Types::Strict::String.meta(omittable: true)
|
13
13
|
attribute :collectionsForRegistration, Types::Strict::Array.of(Types::Strict::String).meta(omittable: true)
|
14
14
|
# example: druid:bc123df4567
|
15
15
|
attribute :hasAdminPolicy, Types::Strict::String
|
16
16
|
# example: druid:bc123df4567
|
17
|
-
attribute :referencesAgreement, Types::Strict::String.
|
17
|
+
attribute :referencesAgreement, Types::Strict::String.meta(omittable: true)
|
18
18
|
attribute :roles, Types::Strict::Array.of(AccessRole).meta(omittable: true)
|
19
19
|
end
|
20
20
|
end
|
@@ -3,15 +3,15 @@
|
|
3
3
|
module Cocina
|
4
4
|
module Models
|
5
5
|
class AdminPolicyDefaultAccess < Struct
|
6
|
-
attribute :access, Types::Strict::String.
|
6
|
+
attribute :access, Types::Strict::String.enum('world', 'stanford', 'location-based', 'citation-only', 'dark').meta(omittable: true)
|
7
7
|
# Available for controlled digital lending.
|
8
|
-
attribute :controlledDigitalLending, Types::Strict::Bool.
|
8
|
+
attribute :controlledDigitalLending, Types::Strict::Bool.meta(omittable: true)
|
9
9
|
# The human readable copyright statement that applies
|
10
10
|
# example: Copyright World Trade Organization
|
11
11
|
attribute :copyright, Types::Strict::String.optional.meta(omittable: true)
|
12
12
|
# Download access level. This is used in the transition from Fedora as a way to set a default download level at registration that is copied down to all the files.
|
13
13
|
|
14
|
-
attribute :download, Types::Strict::String.
|
14
|
+
attribute :download, Types::Strict::String.enum('world', 'stanford', 'location-based', 'none').meta(omittable: true)
|
15
15
|
# If access is "location-based", which location should have access. This is used in the transition from Fedora as a way to set a default readLocation at registration that is copied down to all the files.
|
16
16
|
|
17
17
|
attribute :readLocation, Types::Strict::String.optional.enum('spec', 'music', 'ars', 'art', 'hoover', 'm&m').meta(omittable: true)
|
@@ -8,7 +8,7 @@ module Cocina
|
|
8
8
|
attribute :releaseTags, Types::Strict::Array.of(ReleaseTag).meta(omittable: true)
|
9
9
|
# Administrative or Internal project this resource is a part of
|
10
10
|
# example: Google Books
|
11
|
-
attribute :partOfProject, Types::Strict::String.
|
11
|
+
attribute :partOfProject, Types::Strict::String.meta(omittable: true)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cocina
|
4
|
+
module Models
|
5
|
+
class CitationOnlyAccess < Struct
|
6
|
+
# Access level.
|
7
|
+
attribute :access, Types::Strict::String.enum('citation-only')
|
8
|
+
# Download access level.
|
9
|
+
attribute :download, Types::Strict::String.enum('none')
|
10
|
+
# If access is "location-based", which location should have access.
|
11
|
+
attribute :readLocation, Types::Strict::String.optional.enum('').meta(omittable: true)
|
12
|
+
attribute :controlledDigitalLending, Types::Strict::Bool.enum(false).meta(omittable: true)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -12,7 +12,6 @@ module Cocina
|
|
12
12
|
'http://cocina.sul.stanford.edu/models/series.jsonld'].freeze
|
13
13
|
|
14
14
|
# The content type of the Collection. Selected from an established set of values.
|
15
|
-
# example: item
|
16
15
|
attribute :type, Types::Strict::String.enum(*Collection::TYPES)
|
17
16
|
# example: druid:bc123df4567
|
18
17
|
attribute :externalIdentifier, Types::Strict::String
|
@@ -20,7 +19,7 @@ module Cocina
|
|
20
19
|
attribute :label, Types::Strict::String
|
21
20
|
# Version for the Collection within SDR.
|
22
21
|
attribute :version, Types::Strict::Integer
|
23
|
-
attribute(:access,
|
22
|
+
attribute(:access, CollectionAccess.default { CollectionAccess.new })
|
24
23
|
attribute :administrative, Administrative.optional.meta(omittable: true)
|
25
24
|
attribute :description, Description.optional.meta(omittable: true)
|
26
25
|
attribute :identification, CollectionIdentification.optional.meta(omittable: true)
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cocina
|
4
|
+
module Models
|
5
|
+
class CollectionAccess < Struct
|
6
|
+
# Access level
|
7
|
+
attribute :access, Types::Strict::String.default('dark').enum('world', 'dark').meta(omittable: true)
|
8
|
+
# The human readable copyright statement that applies
|
9
|
+
# example: Copyright World Trade Organization
|
10
|
+
attribute :copyright, Types::Strict::String.optional.meta(omittable: true)
|
11
|
+
# The human readable use and reproduction statement that applies
|
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)
|
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)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|