cocina-models 0.31.1 → 0.32.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: 56996d980d118dcf4b8d40ceff5ec6fbff8b24abb997c4b9e0197bb528b8d079
4
- data.tar.gz: fbd4dc60749aa56fb60334efb0841a707e676a86117129c0f792bbe7cb8e6efe
3
+ metadata.gz: 1bcad8e4f77e24566d85e9e60107eed4cc45b7e31daedf15106ae86d47c9f58b
4
+ data.tar.gz: 26fc29b912821bf4bd9874e3e758acb2777b90729f5dd69b0fd12aeb240cbf31
5
5
  SHA512:
6
- metadata.gz: 2d329215bcbe26594b87741cd14eeb17d6d3059812ac9049782c8f5c571cb1243abdb46ce16f0c664704b834fbdf3984f37813aa0fc339b98fa58bf79ff35e96
7
- data.tar.gz: 16a11f6ee008decd17ffee1bd3329e3c8b9d67ed6350d536a9f1526ecce6d28ccddba4ceff688b2e24163b93c8859e4798e050106a747b8fef2574c9f62df140
6
+ metadata.gz: b91bd04128801af9435c9ae35a5157a4bb2e504906737f908da3f444bca4150e1132a223fc3709309d0df5a26e869eaea6128ba809e7bfcd261d24b248658b96
7
+ data.tar.gz: b6caf15cd36ee9faaebbb10be8f298c9501e727862510b0de0696e83ac863934e68320122ba35fcb7a82fd18a557aed62d987c9021a7c2447b80b73cbcf6d475
data/README.md CHANGED
@@ -26,20 +26,14 @@ exe/generator generate
26
26
  exe/generator generate_schema DRO
27
27
  ```
28
28
 
29
- ## Generate Documentation
29
+ ## Testing
30
30
 
31
- ```
32
- gem install prmd
33
- cd docs
31
+ The generator is tested via its output when run against `openapi.yml`, viz., the Cocina model classes. Thus, `generate` should be run after any changes to `openapi.yml`.
34
32
 
35
- # Combine into a single schema
36
- prmd combine --meta meta.json maps/ > schema.json
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`.
37
34
 
38
- # Check it’s all good
39
- prmd verify schema.json
35
+ ## Using this gem
40
36
 
41
- # Build docs
42
- prmd doc schema.json > schema.md
43
- ```
37
+ 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`.
44
38
 
45
- Then check in the resulting changes to `docs/schema.json` and `docs/schema.md`
39
+ 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.
@@ -0,0 +1,20 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>API documentation</title>
5
+
6
+ <meta name="viewport" content="width=device-width, initial-scale=1">
7
+
8
+
9
+ <style>
10
+ body {
11
+ margin: 0;
12
+ padding: 0;
13
+ }
14
+ </style>
15
+ </head>
16
+ <body>
17
+ <redoc spec-url='https://raw.githubusercontent.com/sul-dlss/cocina-models/master/openapi.yml'></redoc>
18
+ <script src="https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js"> </script>
19
+ </body>
20
+ </html>
@@ -84,7 +84,7 @@
84
84
  "download": {
85
85
  "description": "Download level for the DRO metadata.",
86
86
  "type": "string",
87
- "enum": ["world", "stanford", "location-based", "citation-only", "dark"]
87
+ "enum": ["world", "stanford", "location-based", "none"]
88
88
  },
89
89
  "embargo": {
90
90
  "description": "Embargo metadata",
@@ -5,6 +5,10 @@ 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
+ # If access is "location-based", which location should have access.
11
+ attribute :readLocation, Types::Strict::String.enum('spec', 'music', 'ars', 'art', 'hoover', 'm&m').meta(omittable: true)
8
12
  end
9
13
  end
10
14
  end
@@ -7,10 +7,16 @@ module Cocina
7
7
  # The human readable copyright statement that applies
8
8
  # example: Copyright World Trade Organization
9
9
  attribute :copyright, Types::Strict::String.meta(omittable: true)
10
+ attribute :embargo, Embargo.optional.meta(omittable: true)
11
+ # 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.
12
+
13
+ attribute :download, Types::Strict::String.default('none').enum('world', 'stanford', 'location-based', 'none').meta(omittable: true)
14
+ # If access is "location-based", which location should have access. This is used in the transition from Fedora as a way to set a default readLocation at registration that is copied down to all the files.
15
+
16
+ attribute :readLocation, Types::Strict::String.enum('spec', 'music', 'ars', 'art', 'hoover', 'm&m').meta(omittable: true)
10
17
  # The human readable use and reproduction statement that applies
11
18
  # 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).
12
19
  attribute :useAndReproductionStatement, Types::Strict::String.meta(omittable: true)
13
- attribute :embargo, Embargo.optional.meta(omittable: true)
14
20
  end
15
21
  end
16
22
  end
@@ -3,13 +3,13 @@
3
3
  module Cocina
4
4
  module Models
5
5
  class Event < Struct
6
+ attribute :structuredValue, Types::Strict::Array.of(DescriptiveBasicValue).meta(omittable: true)
6
7
  # Description of the event (creation, publication, etc.).
7
8
  attribute :type, Types::Strict::String.meta(omittable: true)
8
9
  attribute :date, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
9
10
  attribute :contributor, Types::Strict::Array.of(Contributor).meta(omittable: true)
10
11
  attribute :location, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
11
12
  attribute :note, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
12
- attribute :structuredValue, Types::Strict::Array.of(DescriptiveBasicValue).meta(omittable: true)
13
13
  end
14
14
  end
15
15
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Cocina
4
4
  module Models
5
- VERSION = '0.31.1'
5
+ VERSION = '0.32.0'
6
6
  end
7
7
  end
@@ -96,6 +96,7 @@ components:
96
96
  Access:
97
97
  description: Access metadata
98
98
  type: object
99
+ additionalProperties: false
99
100
  properties:
100
101
  access:
101
102
  description: Access level
@@ -107,8 +108,28 @@ components:
107
108
  - 'citation-only'
108
109
  - 'dark'
109
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
+ readLocation:
121
+ description: If access is "location-based", which location should have access.
122
+ type: string
123
+ enum:
124
+ - 'spec'
125
+ - 'music'
126
+ - 'ars'
127
+ - 'art'
128
+ - 'hoover'
129
+ - 'm&m'
110
130
  Administrative:
111
131
  type: object
132
+ additionalProperties: false
112
133
  properties:
113
134
  hasAdminPolicy:
114
135
  $ref: '#/components/schemas/Druid'
@@ -123,6 +144,7 @@ components:
123
144
  type: string
124
145
  AdminPolicy:
125
146
  type: object
147
+ additionalProperties: false
126
148
  properties:
127
149
  type:
128
150
  type: string
@@ -147,6 +169,7 @@ components:
147
169
  - administrative
148
170
  AdminPolicyAdministrative:
149
171
  type: object
172
+ additionalProperties: false
150
173
  properties:
151
174
  defaultObjectRights:
152
175
  type: string
@@ -159,6 +182,7 @@ components:
159
182
  description: Property model for indicating the parts, aspects, or versions of the resource to which a
160
183
  descriptive element is applicable.
161
184
  type: object
185
+ additionalProperties: false
162
186
  properties:
163
187
  appliesTo:
164
188
  type: array
@@ -166,6 +190,7 @@ components:
166
190
  $ref: "#/components/schemas/DescriptiveBasicValue"
167
191
  CatalogLink:
168
192
  type: object
193
+ additionalProperties: false
169
194
  required:
170
195
  - catalog
171
196
  - catalogRecordId
@@ -181,6 +206,7 @@ components:
181
206
  Collection:
182
207
  description: A group of Digital Repository Objects that indicate some type of conceptual grouping within the domain that is worth reusing across the system.
183
208
  type: object
209
+ additionalProperties: false
184
210
  properties:
185
211
  type:
186
212
  description: The content type of the Collection. Selected from an established set of values.
@@ -216,6 +242,7 @@ components:
216
242
  - access
217
243
  CollectionIdentification:
218
244
  type: object
245
+ additionalProperties: false
219
246
  properties:
220
247
  catalogLinks:
221
248
  type: array
@@ -225,6 +252,7 @@ components:
225
252
  description: Property model for describing agents contributing in some way to
226
253
  the creation and history of the resource
227
254
  type: object
255
+ additionalProperties: false
228
256
  properties:
229
257
  name:
230
258
  description: Names associated with a contributor.
@@ -246,6 +274,7 @@ components:
246
274
  DescriptiveAdminMetadata:
247
275
  description: Information about this description of the resource.
248
276
  type: object
277
+ additionalProperties: false
249
278
  properties:
250
279
  contributor:
251
280
  type: array
@@ -266,6 +295,7 @@ components:
266
295
  DescriptiveBasicValue:
267
296
  description: Value model for descriptive elements without recursive properties.
268
297
  type: object
298
+ additionalProperties: false
269
299
  properties:
270
300
  value:
271
301
  description: String value of the descriptive element.
@@ -299,6 +329,7 @@ components:
299
329
  DescriptiveStructuredValue:
300
330
  description: Value model for descriptive elements structured as typed values.
301
331
  type: object
332
+ additionalProperties: false
302
333
  properties:
303
334
  structuredValue:
304
335
  type: array
@@ -307,12 +338,14 @@ components:
307
338
  DescriptiveValue:
308
339
  description: Default value model for descriptive elements.
309
340
  type: object
341
+ additionalProperties: false
310
342
  allOf:
311
343
  - $ref: "#/components/schemas/DescriptiveBasicValue"
312
344
  - $ref: "#/components/schemas/DescriptiveStructuredValue"
313
345
  - $ref: "#/components/schemas/AppliesTo"
314
346
  DescriptiveValueRequired:
315
347
  type: object
348
+ additionalProperties: false
316
349
  allOf:
317
350
  - $ref: "#/components/schemas/DescriptiveValue"
318
351
  - anyOf:
@@ -324,6 +357,7 @@ components:
324
357
  - structuredValue
325
358
  Description:
326
359
  type: object
360
+ additionalProperties: false
327
361
  properties:
328
362
  title:
329
363
  description: Titles of the resource.
@@ -384,6 +418,7 @@ components:
384
418
  DRO:
385
419
  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.
386
420
  type: object
421
+ additionalProperties: false
387
422
  properties:
388
423
  type:
389
424
  description: The content type of the DRO. Selected from an established set of values.
@@ -433,6 +468,7 @@ components:
433
468
  - access
434
469
  DROAccess:
435
470
  type: object
471
+ additionalProperties: false
436
472
  properties:
437
473
  access:
438
474
  type: string
@@ -447,15 +483,43 @@ components:
447
483
  description: The human readable copyright statement that applies
448
484
  example: Copyright World Trade Organization
449
485
  type: string
486
+ embargo:
487
+ $ref: '#/components/schemas/Embargo'
488
+ download:
489
+ description: >
490
+ Download access level. This is used in the transition from Fedora as
491
+ a way to set a default download level at registration that is copied
492
+ down to all the files.
493
+
494
+ type: string
495
+ enum:
496
+ - 'world'
497
+ - 'stanford'
498
+ - 'location-based'
499
+ - 'none'
500
+ default: 'none'
501
+ readLocation:
502
+ description: >
503
+ If access is "location-based", which location should have access.
504
+ This is used in the transition from Fedora as a way to set a default
505
+ readLocation at registration that is copied down to all the files.
506
+
507
+ type: string
508
+ enum:
509
+ - 'spec'
510
+ - 'music'
511
+ - 'ars'
512
+ - 'art'
513
+ - 'hoover'
514
+ - 'm&m'
450
515
  useAndReproductionStatement:
451
516
  description: The human readable use and reproduction statement that applies
452
517
  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).
453
518
  type: string
454
- embargo:
455
- $ref: '#/components/schemas/Embargo'
456
519
  DROStructural:
457
520
  description: Structural metadata
458
521
  type: object
522
+ additionalProperties: false
459
523
  properties:
460
524
  contains:
461
525
  description: Filesets that contain the digital representations (Files)
@@ -478,6 +542,7 @@ components:
478
542
  example: 'druid:bc123df4567'
479
543
  Embargo:
480
544
  type: object
545
+ additionalProperties: false
481
546
  properties:
482
547
  releaseDate:
483
548
  description: Date when the Collection is released from an embargo.
@@ -503,35 +568,40 @@ components:
503
568
  Event:
504
569
  description: Property model for describing events in the history of the resource.
505
570
  type: object
506
- properties:
507
- type:
508
- description: Description of the event (creation, publication, etc.).
509
- type: string
510
- date:
511
- description: Dates associated with the event.
512
- type: array
513
- items:
514
- $ref: "#/components/schemas/DescriptiveValue"
515
- contributor:
516
- description: Contributors associated with the event.
517
- type: array
518
- items:
519
- $ref: "#/components/schemas/Contributor"
520
- location:
521
- description: Locations associated with the event.
522
- type: array
523
- items:
524
- $ref: "#/components/schemas/DescriptiveValue"
525
- note:
526
- description: Other information about the event.
527
- type: array
528
- items:
529
- $ref: "#/components/schemas/DescriptiveValue"
571
+ additionalProperties: false
530
572
  allOf:
531
573
  - $ref: "#/components/schemas/DescriptiveStructuredValue"
574
+ - type: object
575
+ additionalProperties: false
576
+ properties:
577
+ type:
578
+ description: Description of the event (creation, publication, etc.).
579
+ type: string
580
+ date:
581
+ description: Dates associated with the event.
582
+ type: array
583
+ items:
584
+ $ref: "#/components/schemas/DescriptiveValue"
585
+ contributor:
586
+ description: Contributors associated with the event.
587
+ type: array
588
+ items:
589
+ $ref: "#/components/schemas/Contributor"
590
+ location:
591
+ description: Locations associated with the event.
592
+ type: array
593
+ items:
594
+ $ref: "#/components/schemas/DescriptiveValue"
595
+ note:
596
+ description: Other information about the event.
597
+ type: array
598
+ items:
599
+ $ref: "#/components/schemas/DescriptiveValue"
600
+
532
601
  File:
533
602
  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.
534
603
  type: object
604
+ additionalProperties: false
535
605
  properties:
536
606
  type:
537
607
  description: The content type of the File.
@@ -579,6 +649,7 @@ components:
579
649
  - hasMessageDigests
580
650
  FileAdministrative:
581
651
  type: object
652
+ additionalProperties: false
582
653
  properties:
583
654
  sdrPreserve:
584
655
  type: boolean
@@ -592,6 +663,7 @@ components:
592
663
  FileSet:
593
664
  description: Relevant groupings of Files. Also called a File Grouping.
594
665
  type: object
666
+ additionalProperties: false
595
667
  properties:
596
668
  type:
597
669
  description: The content type of the Fileset.
@@ -616,6 +688,7 @@ components:
616
688
  FileSetStructural:
617
689
  description: Structural metadata
618
690
  type: object
691
+ additionalProperties: false
619
692
  properties:
620
693
  contains:
621
694
  type: array
@@ -624,6 +697,7 @@ components:
624
697
  Geographic:
625
698
  description: Geographic metadata
626
699
  type: object
700
+ additionalProperties: false
627
701
  properties:
628
702
  iso19139:
629
703
  description: Geographic ISO 19139 XML metadata
@@ -632,6 +706,7 @@ components:
632
706
  - iso19139
633
707
  Identification:
634
708
  type: object
709
+ additionalProperties: false
635
710
  properties:
636
711
  sourceId:
637
712
  type: string
@@ -643,6 +718,7 @@ components:
643
718
  MessageDigest:
644
719
  description: The output of the message digest algorithm.
645
720
  type: object
721
+ additionalProperties: false
646
722
  properties:
647
723
  type:
648
724
  description: The algorithm that was used
@@ -659,6 +735,7 @@ components:
659
735
  Presentation:
660
736
  description: Presentation data for the File.
661
737
  type: object
738
+ additionalProperties: false
662
739
  properties:
663
740
  height:
664
741
  description: Height in pixels
@@ -669,6 +746,7 @@ components:
669
746
  ReleaseTag:
670
747
  description: A tag that indicates the item or collection should be released.
671
748
  type: object
749
+ additionalProperties: false
672
750
  required:
673
751
  - release
674
752
  properties:
@@ -696,6 +774,7 @@ components:
696
774
  RequestAdminPolicy:
697
775
  description: Same as an AdminPolicy, but doesn't have an externalIdentifier as one will be created
698
776
  type: object
777
+ additionalProperties: false
699
778
  properties:
700
779
  type:
701
780
  type: string
@@ -718,6 +797,7 @@ components:
718
797
  RequestCollection:
719
798
  description: Same as a Collection, but doesn't have an externalIdentifier as one will be created
720
799
  type: object
800
+ additionalProperties: false
721
801
  properties:
722
802
  type:
723
803
  type: string
@@ -748,6 +828,7 @@ components:
748
828
  RequestDRO:
749
829
  description: A request to create a DRO. This has the same general structure as a DRO but doesn't have externalIdentifier and doesn't require the access subschema. If no access subschema is provided, these values will be inherited from the AdminPolicy.
750
830
  type: object
831
+ additionalProperties: false
751
832
  properties:
752
833
  type:
753
834
  type: string
@@ -791,6 +872,7 @@ components:
791
872
  RequestDROStructural:
792
873
  description: Structural metadata
793
874
  type: object
875
+ additionalProperties: false
794
876
  properties:
795
877
  contains:
796
878
  type: array
@@ -806,6 +888,7 @@ components:
806
888
  type: string
807
889
  RequestFile:
808
890
  type: object
891
+ additionalProperties: false
809
892
  properties:
810
893
  type:
811
894
  type: string
@@ -845,6 +928,7 @@ components:
845
928
  - hasMessageDigests
846
929
  RequestFileSet:
847
930
  type: object
931
+ additionalProperties: false
848
932
  properties:
849
933
  type:
850
934
  type: string
@@ -864,6 +948,7 @@ components:
864
948
  RequestFileSetStructural:
865
949
  description: Structural metadata
866
950
  type: object
951
+ additionalProperties: false
867
952
  properties:
868
953
  contains:
869
954
  type: array
@@ -872,6 +957,7 @@ components:
872
957
  Sequence:
873
958
  description: A sequence or ordering of resources within a Collection or Object.
874
959
  type: object
960
+ additionalProperties: false
875
961
  properties:
876
962
  viewingDirection:
877
963
  description: The direction that a sequence of canvases should be displayed to the user
@@ -883,6 +969,7 @@ components:
883
969
  description: Property model for indicating the vocabulary, authority, or other
884
970
  origin for a term, code, or identifier.
885
971
  type: object
972
+ additionalProperties: false
886
973
  properties:
887
974
  code:
888
975
  description: Code representing the value source.