cocina-models 0.75.0 → 0.78.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +40 -12
  3. data/.rubocop_todo.yml +71 -2
  4. data/README.md +41 -5
  5. data/cocina-models.gemspec +2 -0
  6. data/description_types.yml +167 -38
  7. data/docs/description_types.md +471 -216
  8. data/lib/cocina/generator/generator.rb +7 -12
  9. data/lib/cocina/generator/schema.rb +1 -3
  10. data/lib/cocina/generator/schema_base.rb +0 -8
  11. data/lib/cocina/generator/schema_ref.rb +1 -1
  12. data/lib/cocina/generator/schema_value.rb +14 -4
  13. data/lib/cocina/models/access.rb +4 -4
  14. data/lib/cocina/models/admin_policy.rb +1 -1
  15. data/lib/cocina/models/admin_policy_access_template.rb +7 -7
  16. data/lib/cocina/models/admin_policy_administrative.rb +1 -1
  17. data/lib/cocina/models/admin_policy_with_metadata.rb +3 -3
  18. data/lib/cocina/models/builders/name_title_group_builder.rb +0 -4
  19. data/lib/cocina/models/builders/title_builder.rb +0 -2
  20. data/lib/cocina/models/citation_only_access.rb +2 -2
  21. data/lib/cocina/models/collection_access.rb +4 -4
  22. data/lib/cocina/models/collection_identification.rb +1 -1
  23. data/lib/cocina/models/collection_with_metadata.rb +2 -2
  24. data/lib/cocina/models/contributor.rb +4 -4
  25. data/lib/cocina/models/controlled_digital_lending_access.rb +2 -2
  26. data/lib/cocina/models/dark_access.rb +4 -4
  27. data/lib/cocina/models/description.rb +3 -3
  28. data/lib/cocina/models/descriptive_basic_value.rb +13 -13
  29. data/lib/cocina/models/descriptive_parallel_contributor.rb +5 -5
  30. data/lib/cocina/models/descriptive_parallel_event.rb +3 -3
  31. data/lib/cocina/models/descriptive_value.rb +13 -13
  32. data/lib/cocina/models/descriptive_value_language.rb +6 -6
  33. data/lib/cocina/models/dro.rb +1 -1
  34. data/lib/cocina/models/dro_access.rb +8 -8
  35. data/lib/cocina/models/dro_with_metadata.rb +3 -3
  36. data/lib/cocina/models/embargo.rb +5 -5
  37. data/lib/cocina/models/event.rb +3 -3
  38. data/lib/cocina/models/file.rb +4 -4
  39. data/lib/cocina/models/file_access.rb +4 -4
  40. data/lib/cocina/models/identification.rb +2 -2
  41. data/lib/cocina/models/language.rb +12 -12
  42. data/lib/cocina/models/location_based_access.rb +1 -1
  43. data/lib/cocina/models/location_based_download_access.rb +1 -1
  44. data/lib/cocina/models/mapping/error_notifier.rb +36 -0
  45. data/lib/cocina/models/mapping/from_mods/access.rb +177 -0
  46. data/lib/cocina/models/mapping/from_mods/admin_metadata.rb +217 -0
  47. data/lib/cocina/models/mapping/from_mods/alt_rep_group.rb +26 -0
  48. data/lib/cocina/models/mapping/from_mods/authority.rb +51 -0
  49. data/lib/cocina/models/mapping/from_mods/contributor.rb +161 -0
  50. data/lib/cocina/models/mapping/from_mods/description.rb +98 -0
  51. data/lib/cocina/models/mapping/from_mods/description_builder.rb +61 -0
  52. data/lib/cocina/models/mapping/from_mods/event.rb +543 -0
  53. data/lib/cocina/models/mapping/from_mods/form.rb +381 -0
  54. data/lib/cocina/models/mapping/from_mods/geographic.rb +219 -0
  55. data/lib/cocina/models/mapping/from_mods/hydrus_default_title_builder.rb +28 -0
  56. data/lib/cocina/models/mapping/from_mods/identifier.rb +51 -0
  57. data/lib/cocina/models/mapping/from_mods/identifier_builder.rb +71 -0
  58. data/lib/cocina/models/mapping/from_mods/identifier_type.rb +292 -0
  59. data/lib/cocina/models/mapping/from_mods/language.rb +36 -0
  60. data/lib/cocina/models/mapping/from_mods/language_script.rb +30 -0
  61. data/lib/cocina/models/mapping/from_mods/language_term.rb +106 -0
  62. data/lib/cocina/models/mapping/from_mods/name_builder.rb +307 -0
  63. data/lib/cocina/models/mapping/from_mods/note.rb +162 -0
  64. data/lib/cocina/models/mapping/from_mods/part_builder.rb +147 -0
  65. data/lib/cocina/models/mapping/from_mods/primary.rb +27 -0
  66. data/lib/cocina/models/mapping/from_mods/purl.rb +53 -0
  67. data/lib/cocina/models/mapping/from_mods/related_resource.rb +105 -0
  68. data/lib/cocina/models/mapping/from_mods/subject.rb +413 -0
  69. data/lib/cocina/models/mapping/from_mods/subject_authority_codes.rb +794 -0
  70. data/lib/cocina/models/mapping/from_mods/title.rb +160 -0
  71. data/lib/cocina/models/mapping/from_mods/title_builder.rb +106 -0
  72. data/lib/cocina/models/mapping/from_mods/title_builder_strategy.rb +19 -0
  73. data/lib/cocina/models/mapping/from_mods/value_uri.rb +25 -0
  74. data/lib/cocina/models/mapping/normalizers/base.rb +16 -0
  75. data/lib/cocina/models/mapping/normalizers/mods/geo_extension_normalizer.rb +69 -0
  76. data/lib/cocina/models/mapping/normalizers/mods/name_normalizer.rb +191 -0
  77. data/lib/cocina/models/mapping/normalizers/mods/origin_info_normalizer.rb +157 -0
  78. data/lib/cocina/models/mapping/normalizers/mods/subject_normalizer.rb +296 -0
  79. data/lib/cocina/models/mapping/normalizers/mods/title_normalizer.rb +91 -0
  80. data/lib/cocina/models/mapping/normalizers/mods_normalizer.rb +409 -0
  81. data/lib/cocina/models/mapping/purl.rb +27 -0
  82. data/lib/cocina/models/mapping/to_mods/access.rb +155 -0
  83. data/lib/cocina/models/mapping/to_mods/admin_metadata.rb +129 -0
  84. data/lib/cocina/models/mapping/to_mods/contributor.rb +49 -0
  85. data/lib/cocina/models/mapping/to_mods/description.rb +63 -0
  86. data/lib/cocina/models/mapping/to_mods/event.rb +200 -0
  87. data/lib/cocina/models/mapping/to_mods/form.rb +292 -0
  88. data/lib/cocina/models/mapping/to_mods/geographic.rb +151 -0
  89. data/lib/cocina/models/mapping/to_mods/id_generator.rb +25 -0
  90. data/lib/cocina/models/mapping/to_mods/identifier.rb +57 -0
  91. data/lib/cocina/models/mapping/to_mods/language.rb +82 -0
  92. data/lib/cocina/models/mapping/to_mods/mods_writer.rb +38 -0
  93. data/lib/cocina/models/mapping/to_mods/name_title_group.rb +29 -0
  94. data/lib/cocina/models/mapping/to_mods/name_writer.rb +228 -0
  95. data/lib/cocina/models/mapping/to_mods/note.rb +105 -0
  96. data/lib/cocina/models/mapping/to_mods/part_writer.rb +115 -0
  97. data/lib/cocina/models/mapping/to_mods/related_resource.rb +108 -0
  98. data/lib/cocina/models/mapping/to_mods/role_writer.rb +50 -0
  99. data/lib/cocina/models/mapping/to_mods/subject.rb +486 -0
  100. data/lib/cocina/models/mapping/to_mods/title.rb +260 -0
  101. data/lib/cocina/models/object_metadata.rb +2 -2
  102. data/lib/cocina/models/presentation.rb +2 -2
  103. data/lib/cocina/models/related_resource.rb +9 -9
  104. data/lib/cocina/models/release_tag.rb +4 -4
  105. data/lib/cocina/models/request_admin_policy.rb +1 -1
  106. data/lib/cocina/models/request_administrative.rb +1 -1
  107. data/lib/cocina/models/request_collection.rb +2 -2
  108. data/lib/cocina/models/request_description.rb +3 -3
  109. data/lib/cocina/models/request_dro.rb +4 -4
  110. data/lib/cocina/models/request_file.rb +5 -5
  111. data/lib/cocina/models/request_identification.rb +1 -1
  112. data/lib/cocina/models/sequence.rb +1 -1
  113. data/lib/cocina/models/source.rb +4 -4
  114. data/lib/cocina/models/standard.rb +5 -5
  115. data/lib/cocina/models/stanford_access.rb +2 -2
  116. data/lib/cocina/models/title.rb +13 -13
  117. data/lib/cocina/models/validators/dark_validator.rb +4 -2
  118. data/lib/cocina/models/validators/description_values_validator.rb +77 -0
  119. data/lib/cocina/models/validators/open_api_validator.rb +0 -4
  120. data/lib/cocina/models/validators/validator.rb +2 -1
  121. data/lib/cocina/models/version.rb +1 -1
  122. data/lib/cocina/models/world_access.rb +2 -2
  123. data/lib/cocina/models.rb +4 -0
  124. data/lib/cocina/rspec/factories.rb +205 -0
  125. data/lib/cocina/rspec.rb +2 -0
  126. data/openapi.yml +5 -5
  127. metadata +89 -17
  128. data/docs/_config.yml +0 -1
  129. data/docs/maps/Agent.json +0 -18
  130. data/docs/maps/Collection.json +0 -240
  131. data/docs/maps/DRO.json +0 -316
  132. data/docs/maps/Description.json +0 -17
  133. data/docs/maps/File.json +0 -196
  134. data/docs/maps/Fileset.json +0 -143
  135. data/docs/maps/README.md +0 -7
  136. data/docs/maps/ReleaseTag.json +0 -39
  137. data/docs/maps/Sequence.json +0 -46
  138. data/docs/maps/Title.json +0 -18
  139. data/docs/sampleETD/foxml-export.xml +0 -935
  140. data/docs/sampleETD/foxml.xml +0 -3475
  141. data/docs/sampleETD/xn109qc9773_bibframe.ttl +0 -95
  142. data/docs/sampleETD/xn109qc9773_taco.json +0 -158
@@ -54,29 +54,22 @@ module Cocina
54
54
 
55
55
  <<~MARKDOWN
56
56
  #{'#' * (field.count('.') + 1)} #{header_markdown}
57
- _Path: #{field}_
57
+ _Path: #{field}.type_
58
58
  #{types_markdown}
59
59
  MARKDOWN
60
- end.join("\n")
60
+ end.join
61
61
 
62
62
  remove_file 'docs/description_types.md'
63
- create_file 'docs/description_types.md', h1_markdown + markdown
63
+ create_file 'docs/description_types.md', markdown
64
64
  end
65
65
 
66
66
  private
67
67
 
68
- def h1_markdown
69
- <<~MARKDOWN
70
- # Description types
71
-
72
- MARKDOWN
73
- end
74
-
75
68
  def field_markdown_from(field)
76
69
  header = field.split('.')
77
70
  .grep_v(/groupedValue|structuredValue/)
78
71
  .join(' ')
79
- .capitalize
72
+ .upcase_first
80
73
 
81
74
  header_suffix = if field.ends_with?('structuredValue')
82
75
  'part types for structured value'
@@ -91,7 +84,9 @@ module Cocina
91
84
  def types_markdown_from(types)
92
85
  types.map do |type|
93
86
  " * #{type['value']}".tap do |type_value|
94
- type_value << ": #{type['description']}" if type['description']
87
+ type_value << "\n * #{type['description']}" if type['description']
88
+ type_value << "\n * Deprecated." if type['status'] == 'deprecated'
89
+ type_value << " Preferred usage: #{type['use']}" if type['use']
95
90
  end
96
91
  end.join("\n")
97
92
  end
@@ -101,9 +101,7 @@ module Cocina
101
101
  return [] if doc.one_of.nil?
102
102
 
103
103
  # All properties must be objects.
104
- unless doc.one_of.all? { |schema| schema.type == 'object' }
105
- raise 'All properties for oneOf must be objects'
106
- end
104
+ raise 'All properties for oneOf must be objects' unless doc.one_of.all? { |schema| schema.type == 'object' }
107
105
 
108
106
  doc.one_of.flat_map do |one_of_doc|
109
107
  one_of_doc.properties.map do |key, properties_doc|
@@ -23,14 +23,6 @@ module Cocina
23
23
  key || schema_doc.name
24
24
  end
25
25
 
26
- # Allows non-required values to not be provided. This allows smaller
27
- # requests as not every field needs to be present.
28
- def omittable
29
- return '' if required && !relaxed
30
-
31
- '.meta(omittable: true)'
32
- end
33
-
34
26
  # Allows nillable values to be set to nil. This is useful when doing
35
27
  # an update and you want to clear out a value.
36
28
  def optional
@@ -8,7 +8,7 @@ module Cocina
8
8
  if required && !relaxed
9
9
  "attribute(:#{name.camelize(:lower)}, #{schema_doc.name}.default { #{schema_doc.name}.new })"
10
10
  else
11
- "attribute :#{name.camelize(:lower)}, #{schema_doc.name}.optional.meta(omittable: true)"
11
+ "attribute? :#{name.camelize(:lower)}, #{schema_doc.name}.optional"
12
12
  end
13
13
  end
14
14
  end
@@ -4,15 +4,25 @@ module Cocina
4
4
  module Generator
5
5
  # Class for generating from an openapi value
6
6
  class SchemaValue < SchemaBase
7
- # rubocop:disable Layout/LineLength
8
7
  def generate
9
8
  # optional has to come before default or the default value that gets set will be nil.
10
- "#{description}#{example}#{relaxed_comment}attribute :#{name.camelize(:lower)}, Types::#{dry_datatype(schema_doc)}#{optional}#{default}#{enum}#{omittable}"
9
+ if required && !relaxed
10
+ "#{preamble}attribute :#{name.camelize(:lower)}, #{type}"
11
+ else
12
+ "#{preamble}attribute? :#{name.camelize(:lower)}, #{type}"
13
+ end
11
14
  end
12
- # rubocop:enable Layout/LineLength
13
15
 
14
16
  private
15
17
 
18
+ def type
19
+ "Types::#{dry_datatype(schema_doc)}#{optional}#{default}#{enum}"
20
+ end
21
+
22
+ def preamble
23
+ "#{description}#{example}#{relaxed_comment}"
24
+ end
25
+
16
26
  def enum
17
27
  return '' if !schema_doc.enum || relaxed
18
28
 
@@ -32,7 +42,7 @@ module Cocina
32
42
  # If type is boolean and default is false, erroneously getting a nil.
33
43
  # Assuming that if required, then default is false.
34
44
  default = schema_doc.default
35
- default = false if default.nil? && schema_doc.type == 'boolean' && required
45
+ default = false if default.nil? && schema_doc.type == 'boolean'
36
46
 
37
47
  return '' if default.nil?
38
48
 
@@ -5,15 +5,15 @@ module Cocina
5
5
  class Access < Struct
6
6
  # Access level.
7
7
  # Validation of this property is relaxed. See the openapi for full validation.
8
- attribute :view, Types::Strict::String.optional.default('dark').meta(omittable: true)
8
+ attribute? :view, Types::Strict::String.optional.default('dark')
9
9
  # Download access level.
10
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
+ attribute? :download, Types::Strict::String.optional.default('none')
12
12
  # Not used for this access type, must be null.
13
13
  # Validation of this property is relaxed. See the openapi for full validation.
14
- attribute :location, Types::Strict::String.optional.meta(omittable: true)
14
+ attribute? :location, Types::Strict::String.optional
15
15
  # Validation of this property is relaxed. See the openapi for full validation.
16
- attribute :controlledDigitalLending, Types::Strict::Bool.optional.meta(omittable: true)
16
+ attribute? :controlledDigitalLending, Types::Strict::Bool.optional.default(false)
17
17
  end
18
18
  end
19
19
  end
@@ -18,7 +18,7 @@ module Cocina
18
18
  attribute :label, Types::Strict::String
19
19
  attribute :version, Types::Strict::Integer
20
20
  attribute(:administrative, AdminPolicyAdministrative.default { AdminPolicyAdministrative.new })
21
- attribute :description, Description.optional.meta(omittable: true)
21
+ attribute? :description, Description.optional
22
22
  end
23
23
  end
24
24
  end
@@ -3,23 +3,23 @@
3
3
  module Cocina
4
4
  module Models
5
5
  class AdminPolicyAccessTemplate < Struct
6
- attribute :view, Types::Strict::String.enum('world', 'stanford', 'location-based', 'citation-only', 'dark').meta(omittable: true)
6
+ attribute? :view, Types::Strict::String.enum('world', 'stanford', 'location-based', 'citation-only', 'dark')
7
7
  # Available for controlled digital lending.
8
- attribute :controlledDigitalLending, Types::Strict::Bool.meta(omittable: true)
8
+ attribute? :controlledDigitalLending, Types::Strict::Bool.default(false)
9
9
  # The human readable copyright statement that applies
10
10
  # example: Copyright World Trade Organization
11
- attribute :copyright, Types::Strict::String.optional.meta(omittable: true)
11
+ attribute? :copyright, Types::Strict::String.optional
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.enum('world', 'stanford', 'location-based', 'none').meta(omittable: true)
14
+ attribute? :download, Types::Strict::String.enum('world', 'stanford', 'location-based', 'none')
15
15
  # If access or download is "location-based", this indicates which location should have access. This is used in the transition from Fedora as a way to set a default location at registration that is copied down to all the files.
16
16
 
17
- attribute :location, Types::Strict::String.optional.enum('spec', 'music', 'ars', 'art', 'hoover', 'm&m').meta(omittable: true)
17
+ attribute? :location, Types::Strict::String.optional.enum('spec', 'music', 'ars', 'art', 'hoover', 'm&m')
18
18
  # The human readable use and reproduction statement that applies
19
19
  # 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).
20
- attribute :useAndReproductionStatement, Types::Strict::String.optional.meta(omittable: true)
20
+ attribute? :useAndReproductionStatement, Types::Strict::String.optional
21
21
  # The license governing reuse of the Collection. Should be an IRI for known licenses (i.e. CC, RightsStatement.org URI, etc.).
22
- attribute :license, Types::Strict::String.optional.meta(omittable: true)
22
+ attribute? :license, Types::Strict::String.optional
23
23
  end
24
24
  end
25
25
  end
@@ -7,7 +7,7 @@ module Cocina
7
7
  attribute :registrationWorkflow, Types::Strict::Array.of(Types::Strict::String).default([].freeze)
8
8
  # An additional workflow to start for objects managed by this admin policy once the end-accession workflow step is complete
9
9
  # example: wasCrawlPreassemblyWF
10
- attribute :disseminationWorkflow, Types::Strict::String.meta(omittable: true)
10
+ attribute? :disseminationWorkflow, Types::Strict::String
11
11
  attribute :collectionsForRegistration, Types::Strict::Array.of(Types::Strict::String).default([].freeze)
12
12
  # example: druid:bc123df4567
13
13
  attribute :hasAdminPolicy, Types::Strict::String
@@ -18,11 +18,11 @@ module Cocina
18
18
  attribute :label, Types::Strict::String
19
19
  attribute :version, Types::Strict::Integer
20
20
  attribute(:administrative, AdminPolicyAdministrative.default { AdminPolicyAdministrative.new })
21
- attribute :description, Description.optional.meta(omittable: true)
21
+ attribute? :description, Description.optional
22
22
  # When the object was created.
23
- attribute :created, Types::Params::DateTime.meta(omittable: true)
23
+ attribute? :created, Types::Params::DateTime
24
24
  # When the object was modified.
25
- attribute :modified, Types::Params::DateTime.meta(omittable: true)
25
+ attribute? :modified, Types::Params::DateTime
26
26
  # Key for optimistic locking. The contents of the key is not specified.
27
27
  attribute :lock, Types::Strict::String
28
28
  end
@@ -81,7 +81,6 @@ module Cocina
81
81
  # @params [Cocina::Models::DescriptiveValue] desc_value
82
82
  # @return [Array<Cocina::Models::DescriptiveValue>] where we are only interested in
83
83
  # hashes containing (either :value or :structuredValue)
84
- # rubocop:disable Metrics/AbcSize
85
84
  def self.value_slices(desc_value)
86
85
  slices = []
87
86
  desc_value_slice = desc_value.to_h.slice(:value, :structuredValue, :parallelValue)
@@ -93,7 +92,6 @@ module Cocina
93
92
  # ignoring groupedValue
94
93
  slices.flatten
95
94
  end
96
- # rubocop:enable Metrics/AbcSize
97
95
  # private_class_method :value_slices
98
96
 
99
97
  # for a given Hash (from a Cocina DescriptiveValue or Title or Name or ...)
@@ -113,7 +111,6 @@ module Cocina
113
111
  # @params [Cocina::Models::Title] title
114
112
  # @return [Array<Cocina::Models::DescriptiveValue>] where we are only interested in
115
113
  # hashes containing (either :value or :structureValue) and :note if present
116
- # rubocop:disable Metrics/AbcSize
117
114
  def self.title_value_note_slices(title)
118
115
  slices = []
119
116
  title_slice = title.to_h.slice(:value, :structuredValue, :parallelValue, :note)
@@ -127,7 +124,6 @@ module Cocina
127
124
  # ignoring groupedValue
128
125
  slices.flatten
129
126
  end
130
- # rubocop:enable Metrics/AbcSize
131
127
  end
132
128
  end
133
129
  end
@@ -106,7 +106,6 @@ module Cocina
106
106
  # rubocop:disable Metrics/CyclomaticComplexity
107
107
  # rubocop:disable Metrics/PerceivedComplexity
108
108
  # rubocop:disable Metrics/MethodLength
109
- # rubocop:disable Metrics/AbcSize
110
109
  # @param [Cocina::Models::Title] title with structured values
111
110
  # @return [String] the title value from combining the pieces of the structured_values by type and order
112
111
  # with desired punctuation per specs
@@ -157,7 +156,6 @@ module Cocina
157
156
  end
158
157
  structured_title
159
158
  end
160
- # rubocop:enable Metrics/AbcSize
161
159
  # rubocop:enable Metrics/MethodLength
162
160
  # rubocop:enable Metrics/BlockLength
163
161
  # rubocop:enable Metrics/CyclomaticComplexity
@@ -8,8 +8,8 @@ module Cocina
8
8
  # Download access level.
9
9
  attribute :download, Types::Strict::String.enum('none')
10
10
  # Not used for this access type, must be null.
11
- attribute :location, Types::Strict::String.optional.enum('').meta(omittable: true)
12
- attribute :controlledDigitalLending, Types::Strict::Bool.enum(false).meta(omittable: true)
11
+ attribute? :location, Types::Strict::String.optional.enum('')
12
+ attribute? :controlledDigitalLending, Types::Strict::Bool.default(false).enum(false)
13
13
  end
14
14
  end
15
15
  end
@@ -4,15 +4,15 @@ module Cocina
4
4
  module Models
5
5
  class CollectionAccess < Struct
6
6
  # Access level
7
- attribute :view, Types::Strict::String.default('dark').enum('world', 'dark').meta(omittable: true)
7
+ attribute? :view, Types::Strict::String.default('dark').enum('world', 'dark')
8
8
  # The human readable copyright statement that applies
9
9
  # example: Copyright World Trade Organization
10
- attribute :copyright, Types::Strict::String.optional.meta(omittable: true)
10
+ attribute? :copyright, Types::Strict::String.optional
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.optional.meta(omittable: true)
13
+ attribute? :useAndReproductionStatement, Types::Strict::String.optional
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.optional.meta(omittable: true)
15
+ attribute? :license, Types::Strict::String.optional
16
16
  end
17
17
  end
18
18
  end
@@ -7,7 +7,7 @@ module Cocina
7
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"
8
8
 
9
9
  # example: sul:PC0170_s3_Fiesta_Bowl_2012-01-02_210609_2026
10
- attribute :sourceId, Types::Strict::String.meta(omittable: true)
10
+ attribute? :sourceId, Types::Strict::String
11
11
  end
12
12
  end
13
13
  end
@@ -29,9 +29,9 @@ module Cocina
29
29
  attribute(:description, Description.default { Description.new })
30
30
  attribute(:identification, CollectionIdentification.default { CollectionIdentification.new })
31
31
  # When the object was created.
32
- attribute :created, Types::Params::DateTime.meta(omittable: true)
32
+ attribute? :created, Types::Params::DateTime
33
33
  # When the object was modified.
34
- attribute :modified, Types::Params::DateTime.meta(omittable: true)
34
+ attribute? :modified, Types::Params::DateTime
35
35
  # Key for optimistic locking. The contents of the key is not specified.
36
36
  attribute :lock, Types::Strict::String
37
37
  end
@@ -4,15 +4,15 @@ module Cocina
4
4
  module Models
5
5
  class Contributor < Struct
6
6
  attribute :name, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
7
- # Entity type of the contributor (person, organization, etc.).
8
- attribute :type, Types::Strict::String.meta(omittable: true)
7
+ # Entity type of the contributor (person, organization, etc.). See https://github.com/sul-dlss/cocina-models/blob/main/docs/description_types.md for valid types.
8
+ attribute? :type, Types::Strict::String
9
9
  # Status of the contributor relative to other parallel contributors (e.g. the primary author among a group of contributors).
10
- attribute :status, Types::Strict::String.meta(omittable: true)
10
+ attribute? :status, Types::Strict::String
11
11
  attribute :role, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
12
12
  attribute :identifier, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
13
13
  attribute :note, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
14
14
  # URL or other pointer to the location of the contributor information.
15
- attribute :valueAt, Types::Strict::String.meta(omittable: true)
15
+ attribute? :valueAt, Types::Strict::String
16
16
  attribute :parallelContributor, Types::Strict::Array.of(DescriptiveParallelContributor).default([].freeze)
17
17
  end
18
18
  end
@@ -8,9 +8,9 @@ module Cocina
8
8
  # Download access level.
9
9
  attribute :download, Types::Strict::String.enum('none')
10
10
  # Not used for this access type, must be null.
11
- attribute :location, Types::Strict::String.optional.enum('').meta(omittable: true)
11
+ attribute? :location, Types::Strict::String.optional.enum('')
12
12
  # Available for controlled digital lending.
13
- attribute :controlledDigitalLending, Types::Strict::Bool.default(false)
13
+ attribute? :controlledDigitalLending, Types::Strict::Bool.default(false)
14
14
  end
15
15
  end
16
16
  end
@@ -4,12 +4,12 @@ module Cocina
4
4
  module Models
5
5
  class DarkAccess < Struct
6
6
  # Access level.
7
- attribute :view, Types::Strict::String.default('dark').enum('dark').meta(omittable: true)
7
+ attribute? :view, Types::Strict::String.default('dark').enum('dark')
8
8
  # Download access level.
9
- attribute :download, Types::Strict::String.default('none').enum('none').meta(omittable: true)
9
+ attribute? :download, Types::Strict::String.default('none').enum('none')
10
10
  # Not used for this access type, must be null.
11
- attribute :location, Types::Strict::String.optional.enum('').meta(omittable: true)
12
- attribute :controlledDigitalLending, Types::Strict::Bool.enum(false).meta(omittable: true)
11
+ attribute? :location, Types::Strict::String.optional.enum('')
12
+ attribute? :controlledDigitalLending, Types::Strict::Bool.default(false).enum(false)
13
13
  end
14
14
  end
15
15
  end
@@ -14,12 +14,12 @@ module Cocina
14
14
  attribute :note, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
15
15
  attribute :identifier, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
16
16
  attribute :subject, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
17
- attribute :access, DescriptiveAccessMetadata.optional.meta(omittable: true)
17
+ attribute? :access, DescriptiveAccessMetadata.optional
18
18
  attribute :relatedResource, Types::Strict::Array.of(RelatedResource).default([].freeze)
19
19
  attribute :marcEncodedData, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
20
- attribute :adminMetadata, DescriptiveAdminMetadata.optional.meta(omittable: true)
20
+ attribute? :adminMetadata, DescriptiveAdminMetadata.optional
21
21
  # URL or other pointer to the location of the resource description.
22
- attribute :valueAt, Types::Strict::String.meta(omittable: true)
22
+ attribute? :valueAt, Types::Strict::String
23
23
  # Stanford persistent URL associated with the related resource. Note this is http, not https.
24
24
  attribute :purl, Types::Strict::String
25
25
  end
@@ -7,27 +7,27 @@ module Cocina
7
7
  attribute :parallelValue, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
8
8
  attribute :groupedValue, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
9
9
  # String or integer value of the descriptive element.
10
- attribute :value, Types::Nominal::Any.meta(omittable: true)
11
- # Type of value provided by the descriptive element.
12
- attribute :type, Types::Strict::String.meta(omittable: true)
10
+ attribute? :value, Types::Nominal::Any
11
+ # Type of value provided by the descriptive element. See https://github.com/sul-dlss/cocina-models/blob/main/docs/description_types.md for valid types.
12
+ attribute? :type, Types::Strict::String
13
13
  # Status of the descriptive element value relative to other instances of the element.
14
- attribute :status, Types::Strict::String.meta(omittable: true)
14
+ attribute? :status, Types::Strict::String
15
15
  # Code value of the descriptive element.
16
- attribute :code, Types::Strict::String.meta(omittable: true)
16
+ attribute? :code, Types::Strict::String
17
17
  # URI value of the descriptive element.
18
- attribute :uri, Types::Strict::String.meta(omittable: true)
19
- attribute :standard, Standard.optional.meta(omittable: true)
20
- attribute :encoding, Standard.optional.meta(omittable: true)
18
+ attribute? :uri, Types::Strict::String
19
+ attribute? :standard, Standard.optional
20
+ attribute? :encoding, Standard.optional
21
21
  attribute :identifier, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
22
- attribute :source, Source.optional.meta(omittable: true)
22
+ attribute? :source, Source.optional
23
23
  # The preferred display label to use for the descriptive element in access systems.
24
- attribute :displayLabel, Types::Strict::String.meta(omittable: true)
24
+ attribute? :displayLabel, Types::Strict::String
25
25
  # A term providing information about the circumstances of the statement (e.g., approximate dates).
26
- attribute :qualifier, Types::Strict::String.meta(omittable: true)
26
+ attribute? :qualifier, Types::Strict::String
27
27
  attribute :note, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
28
- attribute :valueLanguage, DescriptiveValueLanguage.optional.meta(omittable: true)
28
+ attribute? :valueLanguage, DescriptiveValueLanguage.optional
29
29
  # URL or other pointer to the location of the value of the descriptive element.
30
- attribute :valueAt, Types::Strict::String.meta(omittable: true)
30
+ attribute? :valueAt, Types::Strict::String
31
31
  end
32
32
  end
33
33
  end
@@ -4,16 +4,16 @@ module Cocina
4
4
  module Models
5
5
  class DescriptiveParallelContributor < Struct
6
6
  attribute :name, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
7
- # Entity type of the contributor (person, organization, etc.).
8
- attribute :type, Types::Strict::String.meta(omittable: true)
7
+ # Entity type of the contributor (person, organization, etc.). See https://github.com/sul-dlss/cocina-models/blob/main/docs/description_types.md for valid types.
8
+ attribute? :type, Types::Strict::String
9
9
  # Status of the contributor relative to other parallel contributors (e.g. the primary author among a group of contributors).
10
- attribute :status, Types::Strict::String.meta(omittable: true)
10
+ attribute? :status, Types::Strict::String
11
11
  attribute :role, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
12
12
  attribute :identifier, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
13
13
  attribute :note, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
14
14
  # URL or other pointer to the location of the contributor information.
15
- attribute :valueAt, Types::Strict::String.meta(omittable: true)
16
- attribute :valueLanguage, DescriptiveValueLanguage.optional.meta(omittable: true)
15
+ attribute? :valueAt, Types::Strict::String
16
+ attribute? :valueLanguage, DescriptiveValueLanguage.optional
17
17
  end
18
18
  end
19
19
  end
@@ -5,15 +5,15 @@ module Cocina
5
5
  class DescriptiveParallelEvent < Struct
6
6
  attribute :structuredValue, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
7
7
  # Description of the event (creation, publication, etc.).
8
- attribute :type, Types::Strict::String.meta(omittable: true)
8
+ attribute? :type, Types::Strict::String
9
9
  # The preferred display label to use for the event in access systems.
10
- attribute :displayLabel, Types::Strict::String.meta(omittable: true)
10
+ attribute? :displayLabel, Types::Strict::String
11
11
  attribute :date, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
12
12
  attribute :contributor, Types::Strict::Array.of(Contributor).default([].freeze)
13
13
  attribute :location, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
14
14
  attribute :identifier, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
15
15
  attribute :note, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
16
- attribute :valueLanguage, DescriptiveValueLanguage.optional.meta(omittable: true)
16
+ attribute? :valueLanguage, DescriptiveValueLanguage.optional
17
17
  end
18
18
  end
19
19
  end
@@ -7,27 +7,27 @@ module Cocina
7
7
  attribute :parallelValue, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
8
8
  attribute :groupedValue, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
9
9
  # String or integer value of the descriptive element.
10
- attribute :value, Types::Nominal::Any.meta(omittable: true)
11
- # Type of value provided by the descriptive element.
12
- attribute :type, Types::Strict::String.meta(omittable: true)
10
+ attribute? :value, Types::Nominal::Any
11
+ # Type of value provided by the descriptive element. See https://github.com/sul-dlss/cocina-models/blob/main/docs/description_types.md for valid types.
12
+ attribute? :type, Types::Strict::String
13
13
  # Status of the descriptive element value relative to other instances of the element.
14
- attribute :status, Types::Strict::String.meta(omittable: true)
14
+ attribute? :status, Types::Strict::String
15
15
  # Code value of the descriptive element.
16
- attribute :code, Types::Strict::String.meta(omittable: true)
16
+ attribute? :code, Types::Strict::String
17
17
  # URI value of the descriptive element.
18
- attribute :uri, Types::Strict::String.meta(omittable: true)
19
- attribute :standard, Standard.optional.meta(omittable: true)
20
- attribute :encoding, Standard.optional.meta(omittable: true)
18
+ attribute? :uri, Types::Strict::String
19
+ attribute? :standard, Standard.optional
20
+ attribute? :encoding, Standard.optional
21
21
  attribute :identifier, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
22
- attribute :source, Source.optional.meta(omittable: true)
22
+ attribute? :source, Source.optional
23
23
  # The preferred display label to use for the descriptive element in access systems.
24
- attribute :displayLabel, Types::Strict::String.meta(omittable: true)
24
+ attribute? :displayLabel, Types::Strict::String
25
25
  # A term providing information about the circumstances of the statement (e.g., approximate dates).
26
- attribute :qualifier, Types::Strict::String.meta(omittable: true)
26
+ attribute? :qualifier, Types::Strict::String
27
27
  attribute :note, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
28
- attribute :valueLanguage, DescriptiveValueLanguage.optional.meta(omittable: true)
28
+ attribute? :valueLanguage, DescriptiveValueLanguage.optional
29
29
  # URL or other pointer to the location of the value of the descriptive element.
30
- attribute :valueAt, Types::Strict::String.meta(omittable: true)
30
+ attribute? :valueAt, Types::Strict::String
31
31
  attribute :appliesTo, Types::Strict::Array.of(DescriptiveBasicValue).default([].freeze)
32
32
  end
33
33
  end
@@ -4,16 +4,16 @@ module Cocina
4
4
  module Models
5
5
  class DescriptiveValueLanguage < Struct
6
6
  # Code representing the standard or encoding.
7
- attribute :code, Types::Strict::String.meta(omittable: true)
7
+ attribute? :code, Types::Strict::String
8
8
  # URI for the standard or encoding.
9
- attribute :uri, Types::Strict::String.meta(omittable: true)
9
+ attribute? :uri, Types::Strict::String
10
10
  # String describing the standard or encoding.
11
- attribute :value, Types::Strict::String.meta(omittable: true)
11
+ attribute? :value, Types::Strict::String
12
12
  attribute :note, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
13
13
  # The version of the standard or encoding.
14
- attribute :version, Types::Strict::String.meta(omittable: true)
15
- attribute :source, Source.optional.meta(omittable: true)
16
- attribute :valueScript, Standard.optional.meta(omittable: true)
14
+ attribute? :version, Types::Strict::String
15
+ attribute? :source, Source.optional
16
+ attribute? :valueScript, Standard.optional
17
17
  end
18
18
  end
19
19
  end
@@ -39,7 +39,7 @@ module Cocina
39
39
  attribute(:description, Description.default { Description.new })
40
40
  attribute(:identification, Identification.default { Identification.new })
41
41
  attribute(:structural, DROStructural.default { DROStructural.new })
42
- attribute :geographic, Geographic.optional.meta(omittable: true)
42
+ attribute? :geographic, Geographic.optional
43
43
  end
44
44
  end
45
45
  end
@@ -5,24 +5,24 @@ module Cocina
5
5
  class DROAccess < Struct
6
6
  # Access level.
7
7
  # Validation of this property is relaxed. See the openapi for full validation.
8
- attribute :view, Types::Strict::String.optional.default('dark').meta(omittable: true)
8
+ attribute? :view, Types::Strict::String.optional.default('dark')
9
9
  # Download access level.
10
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
+ attribute? :download, Types::Strict::String.optional.default('none')
12
12
  # Not used for this access type, must be null.
13
13
  # Validation of this property is relaxed. See the openapi for full validation.
14
- attribute :location, Types::Strict::String.optional.meta(omittable: true)
14
+ attribute? :location, Types::Strict::String.optional
15
15
  # Validation of this property is relaxed. See the openapi for full validation.
16
- attribute :controlledDigitalLending, Types::Strict::Bool.optional.meta(omittable: true)
16
+ attribute? :controlledDigitalLending, Types::Strict::Bool.optional.default(false)
17
17
  # The human readable copyright statement that applies
18
18
  # example: Copyright World Trade Organization
19
- attribute :copyright, Types::Strict::String.optional.meta(omittable: true)
20
- attribute :embargo, Embargo.optional.meta(omittable: true)
19
+ attribute? :copyright, Types::Strict::String.optional
20
+ attribute? :embargo, Embargo.optional
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.optional.meta(omittable: true)
23
+ attribute? :useAndReproductionStatement, Types::Strict::String.optional
24
24
  # The license governing reuse of the DRO. Should be an IRI for known licenses (i.e. CC, RightsStatement.org URI, etc.).
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', 'https://cocina.sul.stanford.edu/licenses/none').meta(omittable: true)
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', 'https://cocina.sul.stanford.edu/licenses/none')
26
26
  end
27
27
  end
28
28
  end
@@ -39,11 +39,11 @@ module Cocina
39
39
  attribute(:description, Description.default { Description.new })
40
40
  attribute(:identification, Identification.default { Identification.new })
41
41
  attribute(:structural, DROStructural.default { DROStructural.new })
42
- attribute :geographic, Geographic.optional.meta(omittable: true)
42
+ attribute? :geographic, Geographic.optional
43
43
  # When the object was created.
44
- attribute :created, Types::Params::DateTime.meta(omittable: true)
44
+ attribute? :created, Types::Params::DateTime
45
45
  # When the object was modified.
46
- attribute :modified, Types::Params::DateTime.meta(omittable: true)
46
+ attribute? :modified, Types::Params::DateTime
47
47
  # Key for optimistic locking. The contents of the key is not specified.
48
48
  attribute :lock, Types::Strict::String
49
49
  end