cocina-models 0.49.0 → 0.53.1

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: 422ee3a70d8d672a70b4a2125ada5a107941a963c6023e2905dd3f8c893b6ec4
4
- data.tar.gz: d1dbe1479ea5ee1366e621eb8fb44663d4540cfbd84cf02e97ced3017c36bb93
3
+ metadata.gz: 22b0ca5c4990804a27c1325b95d329f8e2bd807004f9478735aa22003024ec70
4
+ data.tar.gz: 3dce580621ecbf4ee7d5d04977373ef67e4c91d39aafaf3ac8a4ca0f6a8148fc
5
5
  SHA512:
6
- metadata.gz: ce12a8eebecba8a9b4fbfb8275feced7bffd9439c28c171769995495afb4ecfbcdc5aded9ec86a188825684151dc248958c04c5116df3923a015ad4f29e1e283
7
- data.tar.gz: b2cc97124a3c86da0134bcac5987664411cd62473886d8fcc8d1aa6ae11d91b0e6e0ea4f153e15ceb8ad2b4068c29403f45c86df97ed433cbce6e05a8eb0aeeb
6
+ metadata.gz: 752315b42f3ec4f316a53a8660f5fdff8b439771efada674d96cde94a6b853e5ef2468c50395a1afa255a22c685f54c08cad14655ea8d7b477b162af8f3d1405
7
+ data.tar.gz: ac22bccd06f161a69306dfc31bafe6602b638a57837019566570b4f16403098c7a25cdc1de8baa095ff0d8fa1b5cbd75d095d30b2973c36269d2733e02eabc2c
data/README.md CHANGED
@@ -66,3 +66,12 @@ Once the above listed gems are updated all the following services that use cocin
66
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`.
67
67
 
68
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.
69
+
70
+ ### Usage conventions
71
+
72
+ The following are the recommended naming conventions for code using Cocina models:
73
+
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
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cocina
4
+ module Models
5
+ class AccessRole < Struct
6
+ # Name of role
7
+ attribute :name, Types::Strict::String.enum('dor-apo-creator', 'dor-apo-depositor', 'dor-apo-manager', 'dor-apo-metadata', 'dor-apo-reviewer', 'dor-apo-viewer', 'sdr-administrator', 'sdr-viewer', 'hydrus-collection-creator', 'hydrus-collection-manager', 'hydrus-collection-depositor', 'hydrus-collection-item-depositor', 'hydrus-collection-reviewer', 'hydrus-collection-viewer')
8
+ attribute :members, Types::Strict::Array.of(AccessRoleMember).default([].freeze)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cocina
4
+ module Models
5
+ class AccessRoleMember < Struct
6
+ include Checkable
7
+
8
+ TYPES = %w[sunetid
9
+ workgroup].freeze
10
+
11
+ # Name of role
12
+ attribute :type, Types::Strict::String.enum(*AccessRoleMember::TYPES)
13
+ attribute :identifier, Types::Strict::String
14
+ end
15
+ end
16
+ end
@@ -4,8 +4,12 @@ module Cocina
4
4
  module Models
5
5
  class AdminPolicyAdministrative < Struct
6
6
  attribute :defaultObjectRights, Types::Strict::String.default('<?xml version="1.0" encoding="UTF-8"?><rightsMetadata><access type="discover"><machine><world/></machine></access><access type="read"><machine><world/></machine></access><use><human type="useAndReproduction"/><human type="creativeCommons"/><machine type="creativeCommons" uri=""/><human type="openDataCommons"/><machine type="openDataCommons" uri=""/></use><copyright><human/></copyright></rightsMetadata>').meta(omittable: true)
7
- attribute :registrationWorkflow, Types::Strict::String.meta(omittable: true)
7
+ attribute :registrationWorkflow, Types::Strict::Array.of(Types::Strict::String).meta(omittable: true)
8
+ # An additional workflow to start for objects managed by this admin policy once the end-accession workflow step is complete
9
+ # example: wasCrawlPreassemblyWF
10
+ attribute :disseminationWorkflow, Types::Strict::String.meta(omittable: true)
8
11
  attribute :collectionsForRegistration, Types::Strict::Array.of(Types::Strict::String).meta(omittable: true)
12
+ attribute :roles, Types::Strict::Array.of(AccessRole).meta(omittable: true)
9
13
  attribute :hasAdminPolicy, Types::Strict::String
10
14
  end
11
15
  end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cocina
4
+ module Models
5
+ class DescriptiveParallelEvent < Struct
6
+ attribute :structuredValue, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
7
+ # Description of the event (creation, publication, etc.).
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)
11
+ attribute :date, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
12
+ attribute :contributor, Types::Strict::Array.of(Contributor).meta(omittable: true)
13
+ attribute :location, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
14
+ attribute :identifier, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
15
+ attribute :note, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
16
+ attribute :valueLanguage, DescriptiveValueLanguage.optional.meta(omittable: true)
17
+ end
18
+ end
19
+ end
@@ -4,7 +4,6 @@ module Cocina
4
4
  module Models
5
5
  class Event < Struct
6
6
  attribute :structuredValue, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
7
- attribute :parallelValue, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
8
7
  # Description of the event (creation, publication, etc.).
9
8
  attribute :type, Types::Strict::String.meta(omittable: true)
10
9
  # The preferred display label to use for the event in access systems.
@@ -14,6 +13,8 @@ module Cocina
14
13
  attribute :location, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
15
14
  attribute :identifier, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
16
15
  attribute :note, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
16
+ attribute :valueLanguage, DescriptiveValueLanguage.optional.meta(omittable: true)
17
+ attribute :parallelEvent, Types::Strict::Array.of(DescriptiveParallelEvent).meta(omittable: true)
17
18
  end
18
19
  end
19
20
  end
@@ -7,7 +7,8 @@ module Cocina
7
7
  def self.validate(clazz, attributes)
8
8
  method_name = clazz.name.split('::').last
9
9
  request_operation = root.request_operation(:post, "/validate/#{method_name}")
10
- request_operation.validate_request_body('application/json', attributes)
10
+ # JSON.parse forces serialization of objects like DateTime.
11
+ request_operation.validate_request_body('application/json', JSON.parse(attributes.to_json))
11
12
  rescue OpenAPIParser::OpenAPIError => e
12
13
  raise ValidationError, e.message
13
14
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Cocina
4
4
  module Models
5
- VERSION = '0.49.0'
5
+ VERSION = '0.53.1'
6
6
  end
7
7
  end
data/openapi.yml CHANGED
@@ -118,6 +118,53 @@ components:
118
118
  - 'art'
119
119
  - 'hoover'
120
120
  - 'm&m'
121
+ AccessRole:
122
+ description: Access role conferred by an AdminPolicy to objects within it. (used by Argo)
123
+ type: object
124
+ additionalProperties: false
125
+ properties:
126
+ name:
127
+ description: Name of role
128
+ type: string
129
+ enum:
130
+ - 'dor-apo-creator'
131
+ - 'dor-apo-depositor'
132
+ - 'dor-apo-manager'
133
+ - 'dor-apo-metadata'
134
+ - 'dor-apo-reviewer'
135
+ - 'dor-apo-viewer'
136
+ - 'sdr-administrator'
137
+ - 'sdr-viewer'
138
+ - 'hydrus-collection-creator'
139
+ - 'hydrus-collection-manager'
140
+ - 'hydrus-collection-depositor'
141
+ - 'hydrus-collection-item-depositor'
142
+ - 'hydrus-collection-reviewer'
143
+ - 'hydrus-collection-viewer'
144
+ members:
145
+ description: The users and groups that are members of the role
146
+ type: array
147
+ items:
148
+ $ref: '#/components/schemas/AccessRoleMember'
149
+ required:
150
+ - members
151
+ - name
152
+ AccessRoleMember:
153
+ description: Represents a user or group that is a member of an AccessRole
154
+ type: object
155
+ additionalProperties: false
156
+ properties:
157
+ type:
158
+ description: Name of role
159
+ type: string
160
+ enum:
161
+ - 'sunetid'
162
+ - 'workgroup'
163
+ identifier:
164
+ type: string
165
+ required:
166
+ - identifier
167
+ - type
121
168
  Administrative:
122
169
  type: object
123
170
  additionalProperties: false
@@ -161,6 +208,7 @@ components:
161
208
  - type
162
209
  - version
163
210
  AdminPolicyAdministrative:
211
+ description: Administrative properties for an AdminPolicy
164
212
  type: object
165
213
  additionalProperties: false
166
214
  properties:
@@ -168,12 +216,24 @@ components:
168
216
  type: string
169
217
  default: <?xml version="1.0" encoding="UTF-8"?><rightsMetadata><access type="discover"><machine><world/></machine></access><access type="read"><machine><world/></machine></access><use><human type="useAndReproduction"/><human type="creativeCommons"/><machine type="creativeCommons" uri=""/><human type="openDataCommons"/><machine type="openDataCommons" uri=""/></use><copyright><human/></copyright></rightsMetadata>
170
218
  registrationWorkflow:
219
+ description: When you register an item with this admin policy, these are the workflows that are available.
220
+ type: array
221
+ items:
222
+ type: string
223
+ disseminationWorkflow:
224
+ description: An additional workflow to start for objects managed by this admin policy once the end-accession workflow step is complete
225
+ example: wasCrawlPreassemblyWF
171
226
  type: string
172
227
  collectionsForRegistration:
173
228
  description: When you register an item with this admin policy, these are the collections that are available.
174
229
  type: array
175
230
  items:
176
231
  type: string
232
+ roles:
233
+ description: The access roles conferred by this AdminPolicy (used by Argo)
234
+ type: array
235
+ items:
236
+ $ref: '#/components/schemas/AccessRole'
177
237
  hasAdminPolicy:
178
238
  type: string
179
239
  required:
@@ -521,6 +581,49 @@ components:
521
581
  type: array
522
582
  items:
523
583
  $ref: "#/components/schemas/DescriptiveValue"
584
+ DescriptiveParallelEvent:
585
+ description: Value model for multiple representations of information about the same event (e.g. in different languages).
586
+ type: object
587
+ additionalProperties: false
588
+ allOf:
589
+ - $ref: "#/components/schemas/DescriptiveStructuredValue"
590
+ - type: object
591
+ additionalProperties: false
592
+ properties:
593
+ type:
594
+ description: Description of the event (creation, publication, etc.).
595
+ type: string
596
+ displayLabel:
597
+ description: The preferred display label to use for the event in access systems.
598
+ type: string
599
+ date:
600
+ description: Dates associated with the event.
601
+ type: array
602
+ items:
603
+ $ref: "#/components/schemas/DescriptiveValue"
604
+ contributor:
605
+ description: Contributors associated with the event.
606
+ type: array
607
+ items:
608
+ $ref: "#/components/schemas/Contributor"
609
+ location:
610
+ description: Locations associated with the event.
611
+ type: array
612
+ items:
613
+ $ref: "#/components/schemas/DescriptiveValue"
614
+ identifier:
615
+ description: Identifiers and URIs associated with the event.
616
+ type: array
617
+ items:
618
+ $ref: "#/components/schemas/DescriptiveValue"
619
+ note:
620
+ description: Other information about the event.
621
+ type: array
622
+ items:
623
+ $ref: "#/components/schemas/DescriptiveValue"
624
+ valueLanguage:
625
+ # description: Language of the descriptive element value
626
+ $ref: "#/components/schemas/DescriptiveValueLanguage"
524
627
  DescriptiveParallelValue:
525
628
  description: Value model for multiple representations of the same information (e.g. in different languages).
526
629
  type: object
@@ -558,27 +661,6 @@ components:
558
661
  $ref: '#/components/schemas/Standard'
559
662
  # description: An alphabet or other notation used to represent a
560
663
  # language or other symbolic system of the descriptive element value.
561
- Title:
562
- type: object
563
- additionalProperties: false
564
- allOf:
565
- - $ref: "#/components/schemas/DescriptiveValue"
566
- - anyOf:
567
- - type: object
568
- required:
569
- - value
570
- - type: object
571
- required:
572
- - structuredValue
573
- - type: object
574
- required:
575
- - parallelValue
576
- - type: object
577
- required:
578
- - groupedValue
579
- - type: object
580
- required:
581
- - valueAt
582
664
  DRO:
583
665
  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.
584
666
  type: object
@@ -743,7 +825,6 @@ components:
743
825
  additionalProperties: false
744
826
  allOf:
745
827
  - $ref: "#/components/schemas/DescriptiveStructuredValue"
746
- - $ref: "#/components/schemas/DescriptiveParallelValue"
747
828
  - type: object
748
829
  additionalProperties: false
749
830
  properties:
@@ -778,6 +859,14 @@ components:
778
859
  type: array
779
860
  items:
780
861
  $ref: "#/components/schemas/DescriptiveValue"
862
+ valueLanguage:
863
+ # description: Language of the descriptive element value
864
+ $ref: "#/components/schemas/DescriptiveValueLanguage"
865
+ parallelEvent:
866
+ description: For multiple representations of information about the same event (e.g. in different languages)
867
+ type: array
868
+ items:
869
+ $ref: "#/components/schemas/DescriptiveParallelEvent"
781
870
  File:
782
871
  description: Binaries that are the basis of what our domain manages. Binaries here do not include metadata files generated for the domain's own management purposes.
783
872
  type: object
@@ -1416,3 +1505,24 @@ components:
1416
1505
  type: string
1417
1506
  source:
1418
1507
  $ref: "#/components/schemas/Source"
1508
+ Title:
1509
+ type: object
1510
+ additionalProperties: false
1511
+ allOf:
1512
+ - $ref: "#/components/schemas/DescriptiveValue"
1513
+ - anyOf:
1514
+ - type: object
1515
+ required:
1516
+ - value
1517
+ - type: object
1518
+ required:
1519
+ - structuredValue
1520
+ - type: object
1521
+ required:
1522
+ - parallelValue
1523
+ - type: object
1524
+ required:
1525
+ - groupedValue
1526
+ - type: object
1527
+ required:
1528
+ - valueAt
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.49.0
4
+ version: 0.53.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-26 00:00:00.000000000 Z
11
+ date: 2021-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -254,6 +254,8 @@ files:
254
254
  - lib/cocina/generator/vocab.rb
255
255
  - lib/cocina/models.rb
256
256
  - lib/cocina/models/access.rb
257
+ - lib/cocina/models/access_role.rb
258
+ - lib/cocina/models/access_role_member.rb
257
259
  - lib/cocina/models/admin_policy.rb
258
260
  - lib/cocina/models/admin_policy_administrative.rb
259
261
  - lib/cocina/models/administrative.rb
@@ -269,6 +271,7 @@ files:
269
271
  - lib/cocina/models/descriptive_basic_value.rb
270
272
  - lib/cocina/models/descriptive_geographic_metadata.rb
271
273
  - lib/cocina/models/descriptive_grouped_value.rb
274
+ - lib/cocina/models/descriptive_parallel_event.rb
272
275
  - lib/cocina/models/descriptive_parallel_value.rb
273
276
  - lib/cocina/models/descriptive_structured_value.rb
274
277
  - lib/cocina/models/descriptive_value.rb
@@ -326,7 +329,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
326
329
  - !ruby/object:Gem::Version
327
330
  version: '0'
328
331
  requirements: []
329
- rubygems_version: 3.0.3
332
+ rubygems_version: 3.1.4
330
333
  signing_key:
331
334
  specification_version: 4
332
335
  summary: Data models for the SDR