cocina-models 0.58.2 → 0.61.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -0
  3. data/.rubocop_todo.yml +5 -5
  4. data/README.md +34 -24
  5. data/lib/cocina/generator/schema.rb +29 -2
  6. data/lib/cocina/generator/schema_array.rb +1 -1
  7. data/lib/cocina/generator/schema_base.rb +16 -5
  8. data/lib/cocina/generator/schema_ref.rb +1 -1
  9. data/lib/cocina/generator/schema_value.rb +2 -2
  10. data/lib/cocina/models.rb +11 -19
  11. data/lib/cocina/models/access.rb +10 -11
  12. data/lib/cocina/models/admin_policy.rb +0 -1
  13. data/lib/cocina/models/citation_only_access.rb +15 -0
  14. data/lib/cocina/models/collection.rb +1 -2
  15. data/lib/cocina/models/collection_access.rb +18 -0
  16. data/lib/cocina/models/collection_identification.rb +1 -1
  17. data/lib/cocina/models/controlled_digital_lending_access.rb +16 -0
  18. data/lib/cocina/models/dark_access.rb +15 -0
  19. data/lib/cocina/models/description.rb +1 -1
  20. data/lib/cocina/models/doi.rb +9 -0
  21. data/lib/cocina/models/dro.rb +0 -1
  22. data/lib/cocina/models/dro_access.rb +13 -11
  23. data/lib/cocina/models/embargo.rb +11 -2
  24. data/lib/cocina/models/file_access.rb +10 -7
  25. data/lib/cocina/models/identification.rb +6 -3
  26. data/lib/cocina/models/lane_medical_barcode.rb +9 -0
  27. data/lib/cocina/models/location_based_access.rb +15 -0
  28. data/lib/cocina/models/location_based_download_access.rb +15 -0
  29. data/lib/cocina/models/purl.rb +9 -0
  30. data/lib/cocina/models/related_resource.rb +1 -1
  31. data/lib/cocina/models/request_admin_policy.rb +0 -1
  32. data/lib/cocina/models/request_collection.rb +1 -2
  33. data/lib/cocina/models/request_dro.rb +0 -1
  34. data/lib/cocina/models/request_identification.rb +6 -3
  35. data/lib/cocina/models/stanford_access.rb +15 -0
  36. data/lib/cocina/models/version.rb +1 -1
  37. data/lib/cocina/models/world_access.rb +15 -0
  38. data/openapi.yml +347 -172
  39. metadata +13 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 373c87def65c96c5e54fca772ded4c486a26ed1ed2ec5679e4d1f4483241d950
4
- data.tar.gz: 58fd159bc6341d831d42ffd59cb7c42ff8fb0643c87c724753e69c100ec271f4
3
+ metadata.gz: 04d6817bcbdb69d319cc3506afef0f7d8374bb8668e6fbdf05a47b6eab40cb3a
4
+ data.tar.gz: d36dc1283dc12c3f9bdd881f3c9268e2b6088f0c11d35dcbc9d5adf2bf749513
5
5
  SHA512:
6
- metadata.gz: 1ef5aec119f9230e8a274d2c97130c1c1fa421acf227f856613e7c2fb93542ef6f2af64b22e87b44448b6f428b37ba9e091bc1ed01acd16058f30329156e0d31
7
- data.tar.gz: 759e9eee67dc7fc016727e0a4954c07c9d5d1a7a36b5f0eda210b26a12550112210bd7b0b8e59f0ab45e5a57b8e685fb377abb8a78ff74777ebbdc64c474c38a
6
+ metadata.gz: e75b2cd3134d4b75a30f3511cc5f861001e70f274b53c92988575640460b9869993e18378bf05484d21ab18a7f0ce0a56db714b46718aab288b26202db1ed384
7
+ data.tar.gz: 152173ef29e9b971ee2c58ddbd77f6b284576c6be8cbe02fdd043535615d773a50f1df890b9bd7b2c8e10c8a36b3e4b9cb851390132103121cf52534453dce07
data/.rubocop.yml CHANGED
@@ -79,6 +79,8 @@ Metrics/BlockLength:
79
79
 
80
80
  Metrics/MethodLength:
81
81
  Max: 14
82
+ Exclude:
83
+ - 'spec/cocina/models/file_access_spec.rb'
82
84
 
83
85
  # ----- RSpec ------
84
86
 
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2020-09-08 19:05:09 UTC using RuboCop version 0.89.1.
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: IgnoredMethods.
18
- Metrics/CyclomaticComplexity:
19
- Max: 8
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 thos objects.
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
- Finally, you must 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 [Argo](https://github.com/sul-dlss/argo) depends on both of those. When [dor-services-app](https://github.com/sul-dlss/dor-services-app) is updated to use the new models (via the auto-update script), the clients must be updated at the same time or there is risk of models produced by dor-services-app not being acceptable to the clients.
49
+ ### Step 2: Update client gems coupled to the models
44
50
 
45
- ### Communicate
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
- Send a note to `#dlss-infra-chg-mgmt` on Slack to let people know what is changing and when.
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
- ### Dependent Services
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
- Once the above listed gems are updated all the following services that use cocina-models should be updated and released at the same time:
62
+ #### Step 3b: Bump gems
52
63
 
53
- * sul-dlss/sdr-api
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
- ## Using this gem
66
+ ### Step 4: Update other dependent applications
65
67
 
66
- If you are using this gem in an application that has an API that accepts Cocina models (e.g., SDR API, Dor-Services-App), make sure that the `openapi.yml` for the application includes the schemas that match the schemas in this `openapi.yml`.
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
- This can be accomplished by cutting 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.
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/hydra_etd](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
- ### Usage conventions
80
+ ## Usage conventions
71
81
 
72
82
  The following are the recommended naming conventions for code using Cocina models:
73
83
 
74
- * cocina_item: Cocina::Models::DRO instance
75
- * cocina_admin_policy: Cocina::Models::AdminPolicy instance
76
- * cocina_collection: Cocina::Models::Collection instance
77
- * cocina_object: Cocina::Models::DRO or Cocina::Models::AdminPolicy or Cocina::Models::Collection instance
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,15 +83,42 @@ 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) + all_of_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,
@@ -9,7 +9,7 @@ module Cocina
9
9
  end
10
10
 
11
11
  def omittable
12
- if required
12
+ if required && !relaxed
13
13
  '.default([].freeze)'
14
14
  else
15
15
  '.meta(omittable: true)'
@@ -4,14 +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, :nullable, :parent
7
+ attr_reader :schema_doc, :key, :required, :nullable, :parent, :relaxed
8
8
 
9
- def initialize(schema_doc, key: nil, required: false, nullable: 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
13
  @nullable = nullable
14
14
  @parent = parent
15
+ @relaxed = relaxed
15
16
  end
16
17
 
17
18
  def filename
@@ -25,7 +26,7 @@ module Cocina
25
26
  # Allows non-required values to not be provided. This allows smaller
26
27
  # requests as not every field needs to be present.
27
28
  def omittable
28
- return '' if required
29
+ return '' if required && !relaxed
29
30
 
30
31
  '.meta(omittable: true)'
31
32
  end
@@ -33,7 +34,7 @@ module Cocina
33
34
  # Allows nillable values to be set to nil. This is useful when doing
34
35
  # an update and you want to clear out a value.
35
36
  def optional
36
- nullable ? '.optional' : ''
37
+ nullable || relaxed ? '.optional' : ''
37
38
  end
38
39
 
39
40
  def quote(item)
@@ -54,6 +55,12 @@ module Cocina
54
55
  "# example: #{schema_doc.example}\n"
55
56
  end
56
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
+
57
64
  def dry_datatype(doc)
58
65
  case doc.type
59
66
  when 'integer'
@@ -63,7 +70,7 @@ module Cocina
63
70
  when 'boolean'
64
71
  'Strict::Bool'
65
72
  else
66
- if doc.one_of&.map(&:type).all? { |o| %w[integer string].include?(o) }
73
+ if any_datatype?(doc)
67
74
  'Nominal::Any'
68
75
  else
69
76
  raise "#{schema_doc.type} not supported"
@@ -71,6 +78,10 @@ module Cocina
71
78
  end
72
79
  end
73
80
 
81
+ def any_datatype?(doc)
82
+ relaxed || doc.one_of&.map(&:type).all? { |o| %w[integer string].include?(o) }
83
+ end
84
+
74
85
  def string_dry_datatype(doc)
75
86
  case doc.format
76
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 '' unless schema_doc.enum
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.rb CHANGED
@@ -14,27 +14,19 @@ require 'thor'
14
14
 
15
15
  # Help Zeitwerk find some of our classes
16
16
  class CocinaModelsInflector < Zeitwerk::Inflector
17
- # rubocop:disable Metrics/MethodLength
17
+ INFLECTIONS = {
18
+ 'doi' => 'DOI',
19
+ 'dro' => 'DRO',
20
+ 'request_dro' => 'RequestDRO',
21
+ 'dro_access' => 'DROAccess',
22
+ 'dro_structural' => 'DROStructural',
23
+ 'request_dro_structural' => 'RequestDROStructural',
24
+ 'version' => 'VERSION'
25
+ }.freeze
26
+
18
27
  def camelize(basename, _abspath)
19
- case basename
20
- when 'dro'
21
- 'DRO'
22
- when 'request_dro'
23
- 'RequestDRO'
24
- when 'dro_access'
25
- 'DROAccess'
26
- when 'dro_structural'
27
- 'DROStructural'
28
- when 'request_dro_structural'
29
- 'RequestDROStructural'
30
- when 'version'
31
- 'VERSION'
32
- else
33
- super
34
- end
28
+ INFLECTIONS.fetch(basename) { super }
35
29
  end
36
-
37
- # rubocop:enable Metrics/MethodLength
38
30
  end
39
31
 
40
32
  loader = Zeitwerk::Loader.new
@@ -3,18 +3,17 @@
3
3
  module Cocina
4
4
  module Models
5
5
  class Access < Struct
6
- # Access level
7
- attribute :access, Types::Strict::String.default('dark').enum('world', 'stanford', 'location-based', 'citation-only', 'dark').meta(omittable: true)
8
- # The human readable copyright statement that applies
9
- # example: Copyright World Trade Organization
10
- attribute :copyright, Types::Strict::String.meta(omittable: true)
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
- attribute :readLocation, Types::Strict::String.enum('spec', 'music', 'ars', 'art', 'hoover', 'm&m').meta(omittable: true)
13
- # The human readable use and reproduction statement that applies
14
- # 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).
15
- attribute :useAndReproductionStatement, Types::Strict::String.meta(omittable: true)
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.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
@@ -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, Access.default { Access.new })
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
@@ -3,11 +3,11 @@
3
3
  module Cocina
4
4
  module Models
5
5
  class CollectionIdentification < Struct
6
+ attribute :catalogLinks, Types::Strict::Array.of(CatalogLink).meta(omittable: true)
6
7
  # 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"
7
8
 
8
9
  # example: sul:PC0170_s3_Fiesta_Bowl_2012-01-02_210609_2026
9
10
  attribute :sourceId, Types::Strict::String.meta(omittable: true)
10
- attribute :catalogLinks, Types::Strict::Array.of(CatalogLink).meta(omittable: true)
11
11
  end
12
12
  end
13
13
  end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cocina
4
+ module Models
5
+ class ControlledDigitalLendingAccess < Struct
6
+ # Access level.
7
+ attribute :access, Types::Strict::String.enum('stanford')
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
+ # Available for controlled digital lending.
13
+ attribute :controlledDigitalLending, Types::Strict::Bool.default(false)
14
+ end
15
+ end
16
+ end