cocina-models 0.37.0 → 0.38.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -0
- data/docs/maps/DRO.json +5 -2
- data/lib/cocina/generator/datatype.rb +22 -0
- data/lib/cocina/generator/generator.rb +7 -2
- data/lib/cocina/models/dro_structural.rb +1 -2
- data/lib/cocina/models/druid.rb +9 -0
- data/lib/cocina/models/identification.rb +1 -1
- data/lib/cocina/models/request_dro_structural.rb +1 -2
- data/lib/cocina/models/request_identification.rb +1 -1
- data/lib/cocina/models/source_id.rb +9 -0
- data/lib/cocina/models/version.rb +1 -1
- data/openapi.yml +21 -20
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c956bcb234bb19ae05ab24d3b64efd2827bf23ab0d7953c5dc8405532f2391f
|
4
|
+
data.tar.gz: 3fa549a561323f9cb19a595159e3c7eafd100be257920240dc2dde6800766af7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03ba5b89ddf4fdbaa9a3167004771b9bcacf92409800735e1816e3db132bc3d4199fe62218f48053d7cd2bf5faeb53d2c542b16ee1b420bf5fec154f8a444da9
|
7
|
+
data.tar.gz: b2fbbd2b9b1477bcdead8c3c8a186ae96c577e3b8431f7c23d92fa44b97d320f3e3f415121e26231f88f2ee594c0e3949eed5f65865e88fed24d52c7f1952cda
|
data/README.md
CHANGED
@@ -32,6 +32,17 @@ 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
|
+
|
35
46
|
## Using this gem
|
36
47
|
|
37
48
|
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`.
|
data/docs/maps/DRO.json
CHANGED
@@ -298,8 +298,11 @@
|
|
298
298
|
}
|
299
299
|
},
|
300
300
|
"isMemberOf": {
|
301
|
-
"description": "
|
302
|
-
"type": "
|
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
|
@@ -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?
|
59
|
+
return nil if schema_doc.nil?
|
60
60
|
|
61
|
-
|
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)
|
@@ -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
|
-
|
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
|
@@ -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)
|
@@ -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
|
-
|
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
|
data/openapi.yml
CHANGED
@@ -624,7 +624,10 @@ components:
|
|
624
624
|
items:
|
625
625
|
$ref: '#/components/schemas/Sequence'
|
626
626
|
isMemberOf:
|
627
|
-
|
627
|
+
description: Collections that this DRO is a member of
|
628
|
+
type: array
|
629
|
+
items:
|
630
|
+
$ref: '#/components/schemas/Druid'
|
628
631
|
hasAgreement:
|
629
632
|
description: Agreement that covers the deposit of the DRO into SDR.
|
630
633
|
type: string
|
@@ -839,15 +842,7 @@ components:
|
|
839
842
|
additionalProperties: false
|
840
843
|
properties:
|
841
844
|
sourceId:
|
842
|
-
|
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'
|
845
|
+
$ref: '#/components/schemas/SourceId'
|
851
846
|
catalogLinks:
|
852
847
|
type: array
|
853
848
|
items:
|
@@ -1096,7 +1091,10 @@ components:
|
|
1096
1091
|
items:
|
1097
1092
|
$ref: '#/components/schemas/Sequence'
|
1098
1093
|
isMemberOf:
|
1099
|
-
|
1094
|
+
description: Collections that this DRO is a member of
|
1095
|
+
type: array
|
1096
|
+
items:
|
1097
|
+
$ref: '#/components/schemas/Druid'
|
1100
1098
|
hasAgreement:
|
1101
1099
|
type: string
|
1102
1100
|
RequestFile:
|
@@ -1173,15 +1171,7 @@ components:
|
|
1173
1171
|
additionalProperties: false
|
1174
1172
|
properties:
|
1175
1173
|
sourceId:
|
1176
|
-
|
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'
|
1174
|
+
$ref: '#/components/schemas/SourceId'
|
1185
1175
|
catalogLinks:
|
1186
1176
|
type: array
|
1187
1177
|
items:
|
@@ -1248,3 +1238,14 @@ components:
|
|
1248
1238
|
$ref: "#/components/schemas/DescriptiveValue"
|
1249
1239
|
source:
|
1250
1240
|
$ref: "#/components/schemas/Source"
|
1241
|
+
SourceId:
|
1242
|
+
type: string
|
1243
|
+
pattern: '^.+:.+$'
|
1244
|
+
description: >
|
1245
|
+
Unique identifier in some other system. This is because a large proportion of what is deposited in SDR,
|
1246
|
+
historically and currently, are representations of objects that are also represented in other systems.
|
1247
|
+
For example, digitized paper and A/V collections have physical manifestations, and those physical objects are managed
|
1248
|
+
in systems that have their own identifiers. Similarly, books have barcodes, archival materials have collection numbers
|
1249
|
+
and physical locations, etc. The sourceId allows determining if an item has been deposited before and where to
|
1250
|
+
look for the original item if you're looking at its SDR representation. The format is: "namespace:identifier"
|
1251
|
+
example: 'sul:PC0170_s3_Fiesta_Bowl_2012-01-02_210609_2026'
|
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.
|
4
|
+
version: 0.38.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-
|
11
|
+
date: 2020-08-29 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
|
@@ -273,6 +274,7 @@ files:
|
|
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,6 +299,7 @@ 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
|
301
304
|
- lib/cocina/models/validator.rb
|
302
305
|
- lib/cocina/models/version.rb
|