cocina-models 0.37.0 → 0.41.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5bfcf544ee3b4b2a024388b61fae8a9244d7db2e8b2272897b55679d81edbcb4
4
- data.tar.gz: 8fb5f5a7a05a1fd070c1b4a8e0b1849d74bb6dc88d8c9e956aef984ae8970bc1
3
+ metadata.gz: 29038502bea77b7be8adc58a0af9e73573a3da0d614c1d8c413a63ca80ffed72
4
+ data.tar.gz: b4e750e2124c23cbf11203a672a20f59f838cd8eb9a57fd592a00a26ef9b169e
5
5
  SHA512:
6
- metadata.gz: 9117e97169200229cd278e261ce211ab3927513705f0be47918d0ea1e9ec2407dc5f4ed0e6eddfd3213129493ca3b9b0b1fff783a431fb6805bc037d42918ead
7
- data.tar.gz: 576242ad13d3e63263dc893cfc3e6fa6341391aa21c98735878ce9ca83969710b606987d891fa4d22cafe5899b2ee74ee3c37662afaf2e2661323546a78554cf
6
+ metadata.gz: fc11509d28f0f9a6b174ec4943fbf51c6eb98a42dd2fe578082aa5fcf3b30a9291f293791ac3a69f2835bb7982a9c578190a4650be1af8585cf52f28c9236a65
7
+ data.tar.gz: 1dbd66908e5aaa6ac7cc38a9ea9b72062e537daa1c5d54844f8a86c75884b83a51e3cc9ad307dcebc2199276b092eede8dbc96a87578b28fcf328456617bd4d6
@@ -143,3 +143,34 @@ Style/SingleArgumentDig:
143
143
 
144
144
  Style/StringConcatenation:
145
145
  Enabled: true
146
+
147
+ Layout/BeginEndAlignment: # (new in 0.91)
148
+ Enabled: true
149
+ Lint/ConstantDefinitionInBlock: # (new in 0.91)
150
+ Enabled: true
151
+ Lint/DuplicateRequire: # (new in 0.90)
152
+ Enabled: true
153
+ Lint/EmptyFile: # (new in 0.90)
154
+ Enabled: true
155
+ Lint/HashCompareByIdentity: # (new in 0.93)
156
+ Enabled: true
157
+ Lint/IdentityComparison: # (new in 0.91)
158
+ Enabled: true
159
+ Lint/RedundantSafeNavigation: # (new in 0.93)
160
+ Enabled: true
161
+ Lint/TrailingCommaInAttributeDeclaration: # (new in 0.90)
162
+ Enabled: true
163
+ Lint/UselessMethodDefinition: # (new in 0.90)
164
+ Enabled: true
165
+ Lint/UselessTimes: # (new in 0.91)
166
+ Enabled: true
167
+ Style/ClassEqualityComparison: # (new in 0.93)
168
+ Enabled: true
169
+ Style/CombinableLoops: # (new in 0.90)
170
+ Enabled: true
171
+ Style/KeywordParametersOrder: # (new in 0.90)
172
+ Enabled: true
173
+ Style/RedundantSelfAssignment: # (new in 0.90)
174
+ Enabled: true
175
+ Style/SoleNestedConditional: # (new in 0.89)
176
+ Enabled: true
@@ -1,18 +1,25 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2020-03-06 16:50:50 -0800 using RuboCop version 0.74.0.
3
+ # on 2020-09-08 19:05:09 UTC using RuboCop version 0.89.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
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 4
10
- Metrics/AbcSize:
11
- Max: 37
9
+ # Offense count: 1
10
+ # Configuration parameters: AllowedMethods.
11
+ # AllowedMethods: present?, blank?, presence, try, try!
12
+ Lint/SafeNavigationChain:
13
+ Exclude:
14
+ - 'lib/cocina/generator/schema_base.rb'
15
+
16
+ # Offense count: 1
17
+ # Configuration parameters: IgnoredMethods.
18
+ Metrics/CyclomaticComplexity:
19
+ Max: 8
12
20
 
13
- # Offense count: 3
14
- # Configuration parameters: Max.
15
- RSpec/ExampleLength:
21
+ # Offense count: 1
22
+ # Configuration parameters: MinBodyLength.
23
+ Style/GuardClause:
16
24
  Exclude:
17
- - 'spec/cocina/models/dro_shared_examples.rb'
18
- - 'spec/cocina/models/file_set_shared_examples.rb'
25
+ - 'lib/cocina/generator/schema_base.rb'
data/README.md CHANGED
@@ -32,6 +32,27 @@ The generator is tested via its output when run against `openapi.yml`, viz., the
32
32
 
33
33
  Beyond what is necessary to test the generator, the Cocina model classes are not tested, i.e., they are assumed to be as specified in `openapi.yml`.
34
34
 
35
+ ## Releasing
36
+
37
+ 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
+ ```
39
+ bundle exec rake release
40
+ ```
41
+ which pushes the gem to rubygems.org. Next write up the release notes: https://github.com/sul-dlss/cocina-models/releases .
42
+
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.
44
+
45
+ ### Dependent Services
46
+
47
+ Once the above listed gems are updated all the following services that use cocina-models should be updated and released at the same time:
48
+
49
+ * sul-dlss/sdr-api
50
+ * sul-dlss/dor-services-app
51
+ * sul-dlss/google-books
52
+ * sul-dlss/common-accessioning
53
+ * sul-dlss/argo
54
+ * sul-dlss/pre-assembly
55
+
35
56
  ## Using this gem
36
57
 
37
58
  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`.
@@ -298,8 +298,11 @@
298
298
  }
299
299
  },
300
300
  "isMemberOf": {
301
- "description": "Collection that this DRO is a member of",
302
- "type": "string"
301
+ "description": "Collections that this DRO is a member of",
302
+ "type": "array",
303
+ "items": {
304
+ "type": "string"
305
+ }
303
306
  },
304
307
  "isTargetOf": {
305
308
  "description": "An Annotation instance that applies to the DRO.",
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cocina
4
+ module Generator
5
+ # Class for generating from an openapi schema
6
+ class Datatype < SchemaBase
7
+ def generate
8
+ <<~RUBY
9
+ # frozen_string_literal: true
10
+
11
+ module Cocina
12
+ module Models
13
+ #{name} = Types::String.constrained(
14
+ format: /#{schema_doc.pattern}/i
15
+ )
16
+ end
17
+ end
18
+ RUBY
19
+ end
20
+ end
21
+ end
22
+ end
@@ -45,7 +45,7 @@ module Cocina
45
45
  FileUtils.rm_f(filepath)
46
46
 
47
47
  create_file filepath, vocab.generate
48
- run("rubocop -a #{filepath}")
48
+ run("rubocop -a #{filepath} > /dev/null")
49
49
  end
50
50
 
51
51
  private
@@ -56,9 +56,14 @@ module Cocina
56
56
 
57
57
  def schema_for(schema_name)
58
58
  schema_doc = schemas[schema_name]
59
- return nil if schema_doc.nil? || schema_doc.type != 'object'
59
+ return nil if schema_doc.nil?
60
60
 
61
- Schema.new(schema_doc)
61
+ case schema_doc.type
62
+ when 'object'
63
+ Schema.new(schema_doc)
64
+ when 'string'
65
+ Datatype.new(schema_doc)
66
+ end
62
67
  end
63
68
 
64
69
  def generate_for(schema)
@@ -66,7 +71,7 @@ module Cocina
66
71
  FileUtils.rm_f(filepath)
67
72
 
68
73
  create_file filepath, schema.generate
69
- run("rubocop -a #{filepath}")
74
+ run("rubocop -a #{filepath} > /dev/null")
70
75
  end
71
76
 
72
77
  def clean_output
@@ -54,7 +54,11 @@ module Cocina
54
54
  when 'boolean'
55
55
  'Strict::Bool'
56
56
  else
57
- raise "#{schema_doc.type} not supported"
57
+ if doc.one_of&.map(&:type).all? { |o| %w[integer string].include?(o) }
58
+ 'Nominal::Any'
59
+ else
60
+ raise "#{schema_doc.type} not supported"
61
+ end
58
62
  end
59
63
  end
60
64
 
@@ -5,8 +5,6 @@ module Cocina
5
5
  class Access < Struct
6
6
  # Access level
7
7
  attribute :access, Types::Strict::String.default('dark').enum('world', 'stanford', 'location-based', 'citation-only', 'dark').meta(omittable: true)
8
- # Download access level for a file
9
- attribute :download, Types::Strict::String.default('none').enum('world', 'stanford', 'location-based', 'none').meta(omittable: true)
10
8
  # If access is "location-based", which location should have access.
11
9
  attribute :readLocation, Types::Strict::String.enum('spec', 'music', 'ars', 'art', 'hoover', 'm&m').meta(omittable: true)
12
10
  end
@@ -3,7 +3,7 @@
3
3
  module Cocina
4
4
  module Models
5
5
  class Description < Struct
6
- attribute :title, Types::Strict::Array.of(DescriptiveValueRequired).default([].freeze)
6
+ attribute :title, Types::Strict::Array.of(Title).default([].freeze)
7
7
  attribute :contributor, Types::Strict::Array.of(Contributor).meta(omittable: true)
8
8
  attribute :event, Types::Strict::Array.of(Event).meta(omittable: true)
9
9
  attribute :form, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
@@ -5,8 +5,8 @@ module Cocina
5
5
  class DescriptiveBasicValue < Struct
6
6
  attribute :structuredValue, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
7
7
  attribute :parallelValue, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
8
- # String value of the descriptive element.
9
- attribute :value, Types::Strict::String.meta(omittable: true)
8
+ # String or integer value of the descriptive element.
9
+ attribute :value, Types::Nominal::Any.meta(omittable: true)
10
10
  # Type of value provided by the descriptive element.
11
11
  attribute :type, Types::Strict::String.meta(omittable: true)
12
12
  # Status of the descriptive element value relative to other instances of the element.
@@ -17,12 +17,14 @@ module Cocina
17
17
  attribute :uri, Types::Strict::String.meta(omittable: true)
18
18
  attribute :standard, Standard.optional.meta(omittable: true)
19
19
  attribute :encoding, Standard.optional.meta(omittable: true)
20
+ attribute :identifier, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
20
21
  attribute :source, Source.optional.meta(omittable: true)
21
22
  # The preferred display label to use for the descriptive element in access systems.
22
23
  attribute :displayLabel, Types::Strict::String.meta(omittable: true)
23
24
  # A term providing information about the circumstances of the statement (e.g., approximate dates).
24
25
  attribute :qualifier, Types::Strict::String.meta(omittable: true)
25
26
  attribute :note, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
27
+ attribute :valueLanguage, DescriptiveValueLanguage.optional.meta(omittable: true)
26
28
  end
27
29
  end
28
30
  end
@@ -5,8 +5,8 @@ module Cocina
5
5
  class DescriptiveValue < Struct
6
6
  attribute :structuredValue, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
7
7
  attribute :parallelValue, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
8
- # String value of the descriptive element.
9
- attribute :value, Types::Strict::String.meta(omittable: true)
8
+ # String or integer value of the descriptive element.
9
+ attribute :value, Types::Nominal::Any.meta(omittable: true)
10
10
  # Type of value provided by the descriptive element.
11
11
  attribute :type, Types::Strict::String.meta(omittable: true)
12
12
  # Status of the descriptive element value relative to other instances of the element.
@@ -17,12 +17,14 @@ module Cocina
17
17
  attribute :uri, Types::Strict::String.meta(omittable: true)
18
18
  attribute :standard, Standard.optional.meta(omittable: true)
19
19
  attribute :encoding, Standard.optional.meta(omittable: true)
20
+ attribute :identifier, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
20
21
  attribute :source, Source.optional.meta(omittable: true)
21
22
  # The preferred display label to use for the descriptive element in access systems.
22
23
  attribute :displayLabel, Types::Strict::String.meta(omittable: true)
23
24
  # A term providing information about the circumstances of the statement (e.g., approximate dates).
24
25
  attribute :qualifier, Types::Strict::String.meta(omittable: true)
25
26
  attribute :note, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
27
+ attribute :valueLanguage, DescriptiveValueLanguage.optional.meta(omittable: true)
26
28
  attribute :appliesTo, Types::Strict::Array.of(DescriptiveBasicValue).meta(omittable: true)
27
29
  end
28
30
  end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cocina
4
+ module Models
5
+ class DescriptiveValueLanguage < Struct
6
+ # Code representing the standard or encoding.
7
+ attribute :code, Types::Strict::String.meta(omittable: true)
8
+ # URI for the standard or encoding.
9
+ attribute :uri, Types::Strict::String.meta(omittable: true)
10
+ # String describing the standard or encoding.
11
+ attribute :value, Types::Strict::String.meta(omittable: true)
12
+ attribute :note, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
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)
17
+ end
18
+ end
19
+ end
@@ -5,8 +5,7 @@ module Cocina
5
5
  class DROStructural < Struct
6
6
  attribute :contains, Types::Strict::Array.of(FileSet).meta(omittable: true)
7
7
  attribute :hasMemberOrders, Types::Strict::Array.of(Sequence).meta(omittable: true)
8
- # example: druid:bc123df4567
9
- attribute :isMemberOf, Types::Strict::String.meta(omittable: true)
8
+ attribute :isMemberOf, Types::Strict::Array.of(Druid).meta(omittable: true)
10
9
  # Agreement that covers the deposit of the DRO into SDR.
11
10
  attribute :hasAgreement, Types::Strict::String.meta(omittable: true)
12
11
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cocina
4
+ module Models
5
+ Druid = Types::String.constrained(
6
+ format: /^druid:[b-df-hjkmnp-tv-z]{2}[0-9]{3}[b-df-hjkmnp-tv-z]{2}[0-9]{4}$/i
7
+ )
8
+ end
9
+ end
@@ -6,9 +6,12 @@ module Cocina
6
6
  attribute :structuredValue, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
7
7
  # Description of the event (creation, publication, etc.).
8
8
  attribute :type, Types::Strict::String.meta(omittable: true)
9
+ # The preferred display label to use for the event in access systems.
10
+ attribute :displayLabel, Types::Strict::String.meta(omittable: true)
9
11
  attribute :date, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
10
12
  attribute :contributor, Types::Strict::Array.of(Contributor).meta(omittable: true)
11
13
  attribute :location, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
14
+ attribute :identifier, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
12
15
  attribute :note, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
13
16
  end
14
17
  end
@@ -3,7 +3,7 @@
3
3
  module Cocina
4
4
  module Models
5
5
  class Identification < Struct
6
- # 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.
6
+ # 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
7
 
8
8
  # example: sul:PC0170_s3_Fiesta_Bowl_2012-01-02_210609_2026
9
9
  attribute :sourceId, Types::Strict::String.meta(omittable: true)
@@ -3,28 +3,27 @@
3
3
  module Cocina
4
4
  module Models
5
5
  class Language < Struct
6
- attribute :structuredValue, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
7
- attribute :parallelValue, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
8
- # String value of the descriptive element.
9
- attribute :value, Types::Strict::String.meta(omittable: true)
10
- # Type of value provided by the descriptive element.
11
- attribute :type, Types::Strict::String.meta(omittable: true)
12
- # Status of the descriptive element value relative to other instances of the element.
13
- attribute :status, Types::Strict::String.meta(omittable: true)
6
+ attribute :appliesTo, Types::Strict::Array.of(DescriptiveBasicValue).meta(omittable: true)
14
7
  # Code value of the descriptive element.
15
8
  attribute :code, Types::Strict::String.meta(omittable: true)
16
- # URI value of the descriptive element.
17
- attribute :uri, Types::Strict::String.meta(omittable: true)
18
- attribute :standard, Standard.optional.meta(omittable: true)
19
- attribute :encoding, Standard.optional.meta(omittable: true)
20
- attribute :source, Source.optional.meta(omittable: true)
21
9
  # The preferred display label to use for the descriptive element in access systems.
22
10
  attribute :displayLabel, Types::Strict::String.meta(omittable: true)
23
- # A term providing information about the circumstances of the statement (e.g., approximate dates).
24
- attribute :qualifier, Types::Strict::String.meta(omittable: true)
11
+ attribute :encoding, Standard.optional.meta(omittable: true)
25
12
  attribute :note, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
26
- attribute :appliesTo, Types::Strict::Array.of(DescriptiveBasicValue).meta(omittable: true)
13
+ attribute :parallelValue, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
14
+ # present for mapping to additional schemas in the future and for consistency but not otherwise used
15
+ attribute :qualifier, Types::Strict::String.meta(omittable: true)
27
16
  attribute :script, DescriptiveValue.optional.meta(omittable: true)
17
+ attribute :source, Source.optional.meta(omittable: true)
18
+ # Status of the contributor relative to other parallel contributors (e.g. the primary author among a group of contributors).
19
+ attribute :status, Types::Strict::String.enum('primary').meta(omittable: true)
20
+ attribute :standard, Standard.optional.meta(omittable: true)
21
+ attribute :structuredValue, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
22
+ # URI value of the descriptive element.
23
+ attribute :uri, Types::Strict::String.meta(omittable: true)
24
+ # Value of the descriptive element.
25
+ attribute :value, Types::Strict::String.meta(omittable: true)
26
+ attribute :valueLanguage, DescriptiveValueLanguage.optional.meta(omittable: true)
28
27
  end
29
28
  end
30
29
  end
@@ -5,6 +5,10 @@ module Cocina
5
5
  class RelatedResource < Struct
6
6
  # The relationship of the related resource to the described resource.
7
7
  attribute :type, Types::Strict::String.meta(omittable: true)
8
+ # Status of the related resource relative to other related resources.
9
+ attribute :status, Types::Strict::String.meta(omittable: true)
10
+ # The preferred display label to use for the related resource in access systems.
11
+ attribute :displayLabel, Types::Strict::String.meta(omittable: true)
8
12
  attribute :title, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
9
13
  attribute :contributor, Types::Strict::Array.of(Contributor).meta(omittable: true)
10
14
  attribute :event, Types::Strict::Array.of(Event).meta(omittable: true)
@@ -12,10 +16,13 @@ module Cocina
12
16
  attribute :language, Types::Strict::Array.of(Language).meta(omittable: true)
13
17
  attribute :note, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
14
18
  attribute :identifier, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
19
+ attribute :standard, Standard.optional.meta(omittable: true)
15
20
  attribute :subject, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
16
21
  # Stanford persistent URL associated with the related resource.
17
22
  attribute :purl, Types::Strict::String.meta(omittable: true)
18
23
  attribute :access, DescriptiveAccessMetadata.optional.meta(omittable: true)
24
+ # The version of the related resource.
25
+ attribute :version, Types::Strict::String.meta(omittable: true)
19
26
  end
20
27
  end
21
28
  end
@@ -5,8 +5,7 @@ module Cocina
5
5
  class RequestDROStructural < Struct
6
6
  attribute :contains, Types::Strict::Array.of(RequestFileSet).meta(omittable: true)
7
7
  attribute :hasMemberOrders, Types::Strict::Array.of(Sequence).meta(omittable: true)
8
- # example: druid:bc123df4567
9
- attribute :isMemberOf, Types::Strict::String.meta(omittable: true)
8
+ attribute :isMemberOf, Types::Strict::Array.of(Druid).meta(omittable: true)
10
9
  attribute :hasAgreement, Types::Strict::String.meta(omittable: true)
11
10
  end
12
11
  end
@@ -3,7 +3,7 @@
3
3
  module Cocina
4
4
  module Models
5
5
  class RequestIdentification < Struct
6
- # 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.
6
+ # 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
7
 
8
8
  # example: sul:PC0170_s3_Fiesta_Bowl_2012-01-02_210609_2026
9
9
  attribute :sourceId, Types::Strict::String
@@ -10,6 +10,8 @@ module Cocina
10
10
  # String describing the value source.
11
11
  attribute :value, Types::Strict::String.meta(omittable: true)
12
12
  attribute :note, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
13
+ # The version of the value source.
14
+ attribute :version, Types::Strict::String.meta(omittable: true)
13
15
  end
14
16
  end
15
17
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cocina
4
+ module Models
5
+ SourceId = Types::String.constrained(
6
+ format: /^.+:.+$/i
7
+ )
8
+ end
9
+ end
@@ -10,6 +10,8 @@ module Cocina
10
10
  # String describing the standard or encoding.
11
11
  attribute :value, Types::Strict::String.meta(omittable: true)
12
12
  attribute :note, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
13
+ # The version of the standard or encoding.
14
+ attribute :version, Types::Strict::String.meta(omittable: true)
13
15
  attribute :source, Source.optional.meta(omittable: true)
14
16
  end
15
17
  end
@@ -2,11 +2,11 @@
2
2
 
3
3
  module Cocina
4
4
  module Models
5
- class DescriptiveValueRequired < Struct
5
+ class Title < Struct
6
6
  attribute :structuredValue, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
7
7
  attribute :parallelValue, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
8
- # String value of the descriptive element.
9
- attribute :value, Types::Strict::String.meta(omittable: true)
8
+ # String or integer value of the descriptive element.
9
+ attribute :value, Types::Nominal::Any.meta(omittable: true)
10
10
  # Type of value provided by the descriptive element.
11
11
  attribute :type, Types::Strict::String.meta(omittable: true)
12
12
  # Status of the descriptive element value relative to other instances of the element.
@@ -17,12 +17,14 @@ module Cocina
17
17
  attribute :uri, Types::Strict::String.meta(omittable: true)
18
18
  attribute :standard, Standard.optional.meta(omittable: true)
19
19
  attribute :encoding, Standard.optional.meta(omittable: true)
20
+ attribute :identifier, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
20
21
  attribute :source, Source.optional.meta(omittable: true)
21
22
  # The preferred display label to use for the descriptive element in access systems.
22
23
  attribute :displayLabel, Types::Strict::String.meta(omittable: true)
23
24
  # A term providing information about the circumstances of the statement (e.g., approximate dates).
24
25
  attribute :qualifier, Types::Strict::String.meta(omittable: true)
25
26
  attribute :note, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
27
+ attribute :valueLanguage, DescriptiveValueLanguage.optional.meta(omittable: true)
26
28
  attribute :appliesTo, Types::Strict::Array.of(DescriptiveBasicValue).meta(omittable: true)
27
29
  end
28
30
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Cocina
4
4
  module Models
5
- VERSION = '0.37.0'
5
+ VERSION = '0.41.0'
6
6
  end
7
7
  end
@@ -108,15 +108,6 @@ components:
108
108
  - 'citation-only'
109
109
  - 'dark'
110
110
  default: 'dark'
111
- download:
112
- description: Download access level for a file
113
- type: string
114
- enum:
115
- - 'world'
116
- - 'stanford'
117
- - 'location-based'
118
- - 'none'
119
- default: 'none'
120
111
  readLocation:
121
112
  description: If access is "location-based", which location should have access.
122
113
  type: string
@@ -270,6 +261,7 @@ components:
270
261
  description: Status of the contributor relative to other parallel contributors
271
262
  (e.g. the primary author among a group of contributors).
272
263
  type: string
264
+ # type: integer
273
265
  role:
274
266
  description: Relationships of the contributor to the resource or to an event
275
267
  in its history.
@@ -295,7 +287,7 @@ components:
295
287
  type: array
296
288
  minItems: 1
297
289
  items:
298
- $ref: "#/components/schemas/DescriptiveValueRequired"
290
+ $ref: "#/components/schemas/Title"
299
291
  contributor:
300
292
  description: Agents contributing in some way to the creation and history of the
301
293
  resource.
@@ -309,7 +301,7 @@ components:
309
301
  $ref: "#/components/schemas/Event"
310
302
  form:
311
303
  description: Characteristics of the resource's physical, digital, and intellectual
312
- form and genre.
304
+ form and genre, and of its process of creation.
313
305
  type: array
314
306
  items:
315
307
  $ref: "#/components/schemas/DescriptiveValue"
@@ -430,8 +422,13 @@ components:
430
422
  additionalProperties: false
431
423
  properties:
432
424
  value:
433
- description: String value of the descriptive element.
434
- type: string
425
+ description: String or integer value of the descriptive element.
426
+ oneOf:
427
+ - type: string
428
+ # Title note (nonsorting character count) was supposed to be able to accept an integer value,
429
+ # but this triggered a bug in committee:
430
+ # https://github.com/interagent/committee/issues/286
431
+ # - type: integer
435
432
  type:
436
433
  description: Type of value provided by the descriptive element.
437
434
  type: string
@@ -439,6 +436,7 @@ components:
439
436
  description: Status of the descriptive element value relative to other instances
440
437
  of the element.
441
438
  type: string
439
+ # type: integer (uncomment when issue #154 is resolved)
442
440
  code:
443
441
  description: Code value of the descriptive element.
444
442
  type: string
@@ -452,6 +450,11 @@ components:
452
450
  encoding:
453
451
  # description: Encoding schema, standard, or syntax to which the value conforms.
454
452
  $ref: "#/components/schemas/Standard"
453
+ identifier:
454
+ description: Identifiers and URIs associated with the descriptive element.
455
+ type: array
456
+ items:
457
+ $ref: "#/components/schemas/DescriptiveValue"
455
458
  source:
456
459
  $ref: "#/components/schemas/Source"
457
460
  displayLabel:
@@ -465,6 +468,8 @@ components:
465
468
  type: array
466
469
  items:
467
470
  $ref: "#/components/schemas/DescriptiveValue"
471
+ valueLanguage:
472
+ $ref: "#/components/schemas/DescriptiveValueLanguage"
468
473
  DescriptiveParallelValue:
469
474
  description: Value model for multiple representations of the same information (e.g. in different languages).
470
475
  type: object
@@ -490,7 +495,19 @@ components:
490
495
  allOf:
491
496
  - $ref: "#/components/schemas/DescriptiveBasicValue"
492
497
  - $ref: "#/components/schemas/AppliesTo"
493
- DescriptiveValueRequired:
498
+ DescriptiveValueLanguage:
499
+ description: Language of the descriptive element value
500
+ type: object
501
+ additionalProperties: false
502
+ allOf:
503
+ - $ref: "#/components/schemas/Standard"
504
+ - type: object
505
+ properties:
506
+ valueScript:
507
+ $ref: '#/components/schemas/Standard'
508
+ # description: An alphabet or other notation used to represent a
509
+ # language or other symbolic system of the descriptive element value.
510
+ Title:
494
511
  type: object
495
512
  additionalProperties: false
496
513
  allOf:
@@ -502,6 +519,9 @@ components:
502
519
  - type: object
503
520
  required:
504
521
  - structuredValue
522
+ - type: object
523
+ required:
524
+ - parallelValue
505
525
  DRO:
506
526
  description: Domain-defined abstraction of a 'work'. Digital Repository Objects' abstraction is describable for our domain’s purposes, i.e. for management needs within our system.
507
527
  type: object
@@ -624,7 +644,10 @@ components:
624
644
  items:
625
645
  $ref: '#/components/schemas/Sequence'
626
646
  isMemberOf:
627
- $ref: '#/components/schemas/Druid'
647
+ description: Collections that this DRO is a member of
648
+ type: array
649
+ items:
650
+ $ref: '#/components/schemas/Druid'
628
651
  hasAgreement:
629
652
  description: Agreement that covers the deposit of the DRO into SDR.
630
653
  type: string
@@ -669,6 +692,9 @@ components:
669
692
  type:
670
693
  description: Description of the event (creation, publication, etc.).
671
694
  type: string
695
+ displayLabel:
696
+ description: The preferred display label to use for the event in access systems.
697
+ type: string
672
698
  date:
673
699
  description: Dates associated with the event.
674
700
  type: array
@@ -684,6 +710,11 @@ components:
684
710
  type: array
685
711
  items:
686
712
  $ref: "#/components/schemas/DescriptiveValue"
713
+ identifier:
714
+ description: Identifiers and URIs associated with the event.
715
+ type: array
716
+ items:
717
+ $ref: "#/components/schemas/DescriptiveValue"
687
718
  note:
688
719
  description: Other information about the event.
689
720
  type: array
@@ -839,35 +870,73 @@ components:
839
870
  additionalProperties: false
840
871
  properties:
841
872
  sourceId:
842
- type: string
843
- description: >
844
- Unique identifier in some other system. This is because a large proportion of what is deposited in SDR,
845
- historically and currently, are representations of objects that are also represented in other systems.
846
- For example, digitized paper and A/V collections have physical manifestations, and those physical objects are managed
847
- in systems that have their own identifiers. Similarly, books have barcodes, archival materials have collection numbers
848
- and physical locations, etc. The sourceId allows determining if an item has been deposited before and where to
849
- look for the original item if you're looking at its SDR representation.
850
- example: 'sul:PC0170_s3_Fiesta_Bowl_2012-01-02_210609_2026'
873
+ $ref: '#/components/schemas/SourceId'
851
874
  catalogLinks:
852
875
  type: array
853
876
  items:
854
877
  $ref: '#/components/schemas/CatalogLink'
855
878
  Language:
856
879
  description: Languages, scripts, symbolic systems, and notations used in all
857
- or part of a resource.
880
+ or part of a resource or its descriptive metadata.
858
881
  type: object
859
882
  additionalProperties: false
860
- allOf:
861
- - $ref: '#/components/schemas/DescriptiveValue'
862
- - type: object
863
- # additionalProperties breaks the validator, presumably because it can't
864
- # conform to other schemas (allOf) and not have additionalProperties
865
- # additionalProperties: false
866
- properties:
867
- script:
868
- $ref: '#/components/schemas/DescriptiveValue'
869
- # description: An alphabet or other notation used to represent a
870
- # language or other symbolic system associated with the resource.
883
+ properties:
884
+ appliesTo:
885
+ type: array
886
+ items:
887
+ $ref: "#/components/schemas/DescriptiveBasicValue"
888
+ code:
889
+ description: Code value of the descriptive element.
890
+ type: string
891
+ displayLabel:
892
+ description: The preferred display label to use for the descriptive element in access systems.
893
+ type: string
894
+ encoding:
895
+ # description: present for mapping to additional schemas in the future and for consistency but not otherwise used
896
+ $ref: "#/components/schemas/Standard"
897
+ note:
898
+ description: present for mapping to additional schemas in the future and for consistency but not otherwise used
899
+ type: array
900
+ items:
901
+ $ref: "#/components/schemas/DescriptiveValue"
902
+ parallelValue:
903
+ description: present for mapping to additional schemas in the future and for consistency but not otherwise used
904
+ type: array
905
+ items:
906
+ $ref: "#/components/schemas/DescriptiveValue"
907
+ qualifier:
908
+ type: string
909
+ description: present for mapping to additional schemas in the future and for consistency but not otherwise used
910
+ script:
911
+ $ref: '#/components/schemas/DescriptiveValue'
912
+ # description: An alphabet or other notation used to represent a
913
+ # language or other symbolic system associated with the resource.
914
+ source:
915
+ $ref: "#/components/schemas/Source"
916
+ status:
917
+ description: Status of the contributor relative to other parallel contributors
918
+ (e.g. the primary author among a group of contributors).
919
+ type: string
920
+ enum:
921
+ - primary
922
+ standard:
923
+ # description: present for mapping to additional schemas in the future and for consistency but not otherwise used
924
+ $ref: "#/components/schemas/Standard"
925
+ structuredValue:
926
+ description: present for mapping to additional schemas in the future and for consistency but not otherwise used
927
+ type: array
928
+ items:
929
+ $ref: "#/components/schemas/DescriptiveValue"
930
+ uri:
931
+ description: URI value of the descriptive element.
932
+ type: string
933
+ format: uri
934
+ value:
935
+ description: Value of the descriptive element.
936
+ type: string
937
+ valueLanguage:
938
+ # description: present for mapping to additional schemas in the future and for consistency but not otherwise used
939
+ $ref: "#/components/schemas/DescriptiveValueLanguage"
871
940
  MessageDigest:
872
941
  description: The output of the message digest algorithm.
873
942
  type: object
@@ -904,6 +973,13 @@ components:
904
973
  type:
905
974
  description: The relationship of the related resource to the described resource.
906
975
  type: string
976
+ status:
977
+ description: Status of the related resource relative to other related resources.
978
+ type: string
979
+ # type: integer
980
+ displayLabel:
981
+ description: The preferred display label to use for the related resource in access systems.
982
+ type: string
907
983
  title:
908
984
  description: Titles of the related resource.
909
985
  type: array
@@ -922,7 +998,7 @@ components:
922
998
  $ref: "#/components/schemas/Event"
923
999
  form:
924
1000
  description: Characteristics of the related resource's physical, digital, and intellectual
925
- form and genre.
1001
+ form and genre, and of its process of creation.
926
1002
  type: array
927
1003
  items:
928
1004
  $ref: "#/components/schemas/DescriptiveValue"
@@ -942,6 +1018,9 @@ components:
942
1018
  type: array
943
1019
  items:
944
1020
  $ref: "#/components/schemas/DescriptiveValue"
1021
+ standard:
1022
+ # description: Descriptive or content standards to which the value conforms.
1023
+ $ref: "#/components/schemas/Standard"
945
1024
  subject:
946
1025
  description: Terms associated with the intellectual content of the related resource.
947
1026
  type: array
@@ -953,6 +1032,9 @@ components:
953
1032
  format: uri
954
1033
  access:
955
1034
  $ref: "#/components/schemas/DescriptiveAccessMetadata"
1035
+ version:
1036
+ description: The version of the related resource.
1037
+ type: string
956
1038
  ReleaseTag:
957
1039
  description: A tag that indicates the item or collection should be released.
958
1040
  type: object
@@ -1096,7 +1178,10 @@ components:
1096
1178
  items:
1097
1179
  $ref: '#/components/schemas/Sequence'
1098
1180
  isMemberOf:
1099
- $ref: '#/components/schemas/Druid'
1181
+ description: Collections that this DRO is a member of
1182
+ type: array
1183
+ items:
1184
+ $ref: '#/components/schemas/Druid'
1100
1185
  hasAgreement:
1101
1186
  type: string
1102
1187
  RequestFile:
@@ -1173,15 +1258,7 @@ components:
1173
1258
  additionalProperties: false
1174
1259
  properties:
1175
1260
  sourceId:
1176
- type: string
1177
- description: >
1178
- Unique identifier in some other system. This is because a large proportion of what is deposited in SDR,
1179
- historically and currently, are representations of objects that are also represented in other systems.
1180
- For example, digitized paper and A/V collections have physical manifestations, and those physical objects are managed
1181
- in systems that have their own identifiers. Similarly, books have barcodes, archival materials have collection numbers
1182
- and physical locations, etc. The sourceId allows determining if an item has been deposited before and where to
1183
- look for the original item if you're looking at its SDR representation.
1184
- example: 'sul:PC0170_s3_Fiesta_Bowl_2012-01-02_210609_2026'
1261
+ $ref: '#/components/schemas/SourceId'
1185
1262
  catalogLinks:
1186
1263
  type: array
1187
1264
  items:
@@ -1225,9 +1302,23 @@ components:
1225
1302
  type: array
1226
1303
  items:
1227
1304
  $ref: "#/components/schemas/DescriptiveValue"
1305
+ version:
1306
+ description: The version of the value source.
1307
+ type: string
1308
+ SourceId:
1309
+ type: string
1310
+ pattern: '^.+:.+$'
1311
+ description: >
1312
+ Unique identifier in some other system. This is because a large proportion of what is deposited in SDR,
1313
+ historically and currently, are representations of objects that are also represented in other systems.
1314
+ For example, digitized paper and A/V collections have physical manifestations, and those physical objects are managed
1315
+ in systems that have their own identifiers. Similarly, books have barcodes, archival materials have collection numbers
1316
+ and physical locations, etc. The sourceId allows determining if an item has been deposited before and where to
1317
+ look for the original item if you're looking at its SDR representation. The format is: "namespace:identifier"
1318
+ example: 'sul:PC0170_s3_Fiesta_Bowl_2012-01-02_210609_2026'
1228
1319
  Standard:
1229
1320
  description: Property model for indicating the encoding, standard, or syntax
1230
- to which a value conforms.
1321
+ to which a value conforms (e.g. RDA).
1231
1322
  type: object
1232
1323
  additionalProperties: false
1233
1324
  properties:
@@ -1246,5 +1337,8 @@ components:
1246
1337
  type: array
1247
1338
  items:
1248
1339
  $ref: "#/components/schemas/DescriptiveValue"
1340
+ version:
1341
+ description: The version of the standard or encoding.
1342
+ type: string
1249
1343
  source:
1250
1344
  $ref: "#/components/schemas/Source"
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.37.0
4
+ version: 0.41.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: 2020-08-26 00:00:00.000000000 Z
11
+ date: 2020-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -244,6 +244,7 @@ files:
244
244
  - docs/sampleETD/xn109qc9773_taco.json
245
245
  - exe/generator
246
246
  - lib/cocina/generator.rb
247
+ - lib/cocina/generator/datatype.rb
247
248
  - lib/cocina/generator/generator.rb
248
249
  - lib/cocina/generator/schema.rb
249
250
  - lib/cocina/generator/schema_array.rb
@@ -269,10 +270,11 @@ files:
269
270
  - lib/cocina/models/descriptive_parallel_value.rb
270
271
  - lib/cocina/models/descriptive_structured_value.rb
271
272
  - lib/cocina/models/descriptive_value.rb
272
- - lib/cocina/models/descriptive_value_required.rb
273
+ - lib/cocina/models/descriptive_value_language.rb
273
274
  - lib/cocina/models/dro.rb
274
275
  - lib/cocina/models/dro_access.rb
275
276
  - lib/cocina/models/dro_structural.rb
277
+ - lib/cocina/models/druid.rb
276
278
  - lib/cocina/models/embargo.rb
277
279
  - lib/cocina/models/event.rb
278
280
  - lib/cocina/models/file.rb
@@ -297,7 +299,9 @@ files:
297
299
  - lib/cocina/models/request_identification.rb
298
300
  - lib/cocina/models/sequence.rb
299
301
  - lib/cocina/models/source.rb
302
+ - lib/cocina/models/source_id.rb
300
303
  - lib/cocina/models/standard.rb
304
+ - lib/cocina/models/title.rb
301
305
  - lib/cocina/models/validator.rb
302
306
  - lib/cocina/models/version.rb
303
307
  - lib/cocina/models/vocab.rb
@@ -320,7 +324,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
320
324
  - !ruby/object:Gem::Version
321
325
  version: '0'
322
326
  requirements: []
323
- rubygems_version: 3.1.2
327
+ rubygems_version: 3.0.3
324
328
  signing_key:
325
329
  specification_version: 4
326
330
  summary: Data models for the SDR