cocina-models 0.56.0 → 0.58.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cocina/generator/schema.rb +1 -0
- data/lib/cocina/generator/schema_base.rb +11 -2
- data/lib/cocina/generator/schema_value.rb +2 -1
- data/lib/cocina/models/access.rb +3 -0
- data/lib/cocina/models/admin_policy_administrative.rb +1 -1
- data/lib/cocina/models/admin_policy_default_access.rb +4 -5
- data/lib/cocina/models/version.rb +1 -1
- data/openapi.yml +10 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 373c87def65c96c5e54fca772ded4c486a26ed1ed2ec5679e4d1f4483241d950
|
4
|
+
data.tar.gz: 58fd159bc6341d831d42ffd59cb7c42ff8fb0643c87c724753e69c100ec271f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ef5aec119f9230e8a274d2c97130c1c1fa421acf227f856613e7c2fb93542ef6f2af64b22e87b44448b6f428b37ba9e091bc1ed01acd16058f30329156e0d31
|
7
|
+
data.tar.gz: 759e9eee67dc7fc016727e0a4954c07c9d5d1a7a36b5f0eda210b26a12550112210bd7b0b8e59f0ab45e5a57b8e685fb377abb8a78ff74777ebbdc64c474c38a
|
@@ -4,12 +4,13 @@ module Cocina
|
|
4
4
|
module Generator
|
5
5
|
# Base class for generating from openapi
|
6
6
|
class SchemaBase
|
7
|
-
attr_reader :schema_doc, :key, :required, :parent
|
7
|
+
attr_reader :schema_doc, :key, :required, :nullable, :parent
|
8
8
|
|
9
|
-
def initialize(schema_doc, key: nil, required: false, parent: nil)
|
9
|
+
def initialize(schema_doc, key: nil, required: false, nullable: false, parent: nil)
|
10
10
|
@schema_doc = schema_doc
|
11
11
|
@key = key
|
12
12
|
@required = required
|
13
|
+
@nullable = nullable
|
13
14
|
@parent = parent
|
14
15
|
end
|
15
16
|
|
@@ -21,12 +22,20 @@ module Cocina
|
|
21
22
|
key || schema_doc.name
|
22
23
|
end
|
23
24
|
|
25
|
+
# Allows non-required values to not be provided. This allows smaller
|
26
|
+
# requests as not every field needs to be present.
|
24
27
|
def omittable
|
25
28
|
return '' if required
|
26
29
|
|
27
30
|
'.meta(omittable: true)'
|
28
31
|
end
|
29
32
|
|
33
|
+
# Allows nillable values to be set to nil. This is useful when doing
|
34
|
+
# an update and you want to clear out a value.
|
35
|
+
def optional
|
36
|
+
nullable ? '.optional' : ''
|
37
|
+
end
|
38
|
+
|
30
39
|
def quote(item)
|
31
40
|
return item unless schema_doc.type == 'string'
|
32
41
|
|
@@ -6,7 +6,8 @@ module Cocina
|
|
6
6
|
class SchemaValue < SchemaBase
|
7
7
|
# rubocop:disable Layout/LineLength
|
8
8
|
def generate
|
9
|
-
|
9
|
+
# optional has to come before default or the default value that gets set will be nil.
|
10
|
+
"#{description}#{example}attribute :#{name.camelize(:lower)}, Types::#{dry_datatype(schema_doc)}#{optional}#{default}#{enum}#{omittable}"
|
10
11
|
end
|
11
12
|
# rubocop:enable Layout/LineLength
|
12
13
|
|
data/lib/cocina/models/access.rb
CHANGED
@@ -5,6 +5,9 @@ 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
|
+
# The human readable copyright statement that applies
|
9
|
+
# example: Copyright World Trade Organization
|
10
|
+
attribute :copyright, Types::Strict::String.meta(omittable: true)
|
8
11
|
# If access is "location-based", which location should have access.
|
9
12
|
attribute :readLocation, Types::Strict::String.enum('spec', 'music', 'ars', 'art', 'hoover', 'm&m').meta(omittable: true)
|
10
13
|
# The human readable use and reproduction statement that applies
|
@@ -5,7 +5,7 @@ module Cocina
|
|
5
5
|
class AdminPolicyAdministrative < Struct
|
6
6
|
# This is an XML expression of the default access (see defaultAccess)
|
7
7
|
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)
|
8
|
-
attribute :defaultAccess,
|
8
|
+
attribute :defaultAccess, AdminPolicyDefaultAccess.optional.meta(omittable: true)
|
9
9
|
attribute :registrationWorkflow, Types::Strict::Array.of(Types::Strict::String).meta(omittable: true)
|
10
10
|
# An additional workflow to start for objects managed by this admin policy once the end-accession workflow step is complete
|
11
11
|
# example: wasCrawlPreassemblyWF
|
@@ -8,19 +8,18 @@ module Cocina
|
|
8
8
|
attribute :controlledDigitalLending, Types::Strict::Bool.meta(omittable: true)
|
9
9
|
# The human readable copyright statement that applies
|
10
10
|
# example: Copyright World Trade Organization
|
11
|
-
attribute :copyright, Types::Strict::String.meta(omittable: true)
|
12
|
-
attribute :embargo, Embargo.optional.meta(omittable: true)
|
11
|
+
attribute :copyright, Types::Strict::String.optional.meta(omittable: true)
|
13
12
|
# Download access level. This is used in the transition from Fedora as a way to set a default download level at registration that is copied down to all the files.
|
14
13
|
|
15
14
|
attribute :download, Types::Strict::String.enum('world', 'stanford', 'location-based', 'none').meta(omittable: true)
|
16
15
|
# 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.
|
17
16
|
|
18
|
-
attribute :readLocation, Types::Strict::String.enum('spec', 'music', 'ars', 'art', 'hoover', 'm&m').meta(omittable: true)
|
17
|
+
attribute :readLocation, Types::Strict::String.optional.enum('spec', 'music', 'ars', 'art', 'hoover', 'm&m').meta(omittable: true)
|
19
18
|
# The human readable use and reproduction statement that applies
|
20
19
|
# example: Property rights reside with the repository. Literary rights reside with the creators of the documents or their heirs. To obtain permission to publish or reproduce, please contact the Public Services Librarian of the Dept. of Special Collections (http://library.stanford.edu/spc).
|
21
|
-
attribute :useAndReproductionStatement, Types::Strict::String.meta(omittable: true)
|
20
|
+
attribute :useAndReproductionStatement, Types::Strict::String.optional.meta(omittable: true)
|
22
21
|
# The license governing reuse of the Collection. Should be an IRI for known licenses (i.e. CC, RightsStatement.org URI, etc.).
|
23
|
-
attribute :license, Types::Strict::String.meta(omittable: true)
|
22
|
+
attribute :license, Types::Strict::String.optional.meta(omittable: true)
|
24
23
|
end
|
25
24
|
end
|
26
25
|
end
|
data/openapi.yml
CHANGED
@@ -108,6 +108,10 @@ components:
|
|
108
108
|
- 'citation-only'
|
109
109
|
- 'dark'
|
110
110
|
default: 'dark'
|
111
|
+
copyright:
|
112
|
+
description: The human readable copyright statement that applies
|
113
|
+
example: Copyright World Trade Organization
|
114
|
+
type: string
|
111
115
|
readLocation:
|
112
116
|
description: If access is "location-based", which location should have access.
|
113
117
|
type: string
|
@@ -225,7 +229,7 @@ components:
|
|
225
229
|
deprecated: true
|
226
230
|
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>
|
227
231
|
defaultAccess:
|
228
|
-
$ref: '#/components/schemas/
|
232
|
+
$ref: '#/components/schemas/AdminPolicyDefaultAccess'
|
229
233
|
registrationWorkflow:
|
230
234
|
description: When you register an item with this admin policy, these are the workflows that are available.
|
231
235
|
type: array
|
@@ -252,7 +256,7 @@ components:
|
|
252
256
|
required:
|
253
257
|
- hasAdminPolicy
|
254
258
|
AdminPolicyDefaultAccess:
|
255
|
-
description: 'Provides the default access settings for an AdminPolicy. This is almost the same as DROAccess, but it provides no defaults.'
|
259
|
+
description: 'Provides the default access settings for an AdminPolicy. This is almost the same as DROAccess, but it provides no defaults and has no embargo.'
|
256
260
|
type: object
|
257
261
|
additionalProperties: false
|
258
262
|
properties:
|
@@ -271,8 +275,7 @@ components:
|
|
271
275
|
description: The human readable copyright statement that applies
|
272
276
|
example: Copyright World Trade Organization
|
273
277
|
type: string
|
274
|
-
|
275
|
-
$ref: '#/components/schemas/Embargo'
|
278
|
+
nullable: true
|
276
279
|
download:
|
277
280
|
description: >
|
278
281
|
Download access level. This is used in the transition from Fedora as
|
@@ -292,6 +295,7 @@ components:
|
|
292
295
|
readLocation at registration that is copied down to all the files.
|
293
296
|
|
294
297
|
type: string
|
298
|
+
nullable: true
|
295
299
|
enum:
|
296
300
|
- 'spec'
|
297
301
|
- 'music'
|
@@ -303,9 +307,11 @@ components:
|
|
303
307
|
description: The human readable use and reproduction statement that applies
|
304
308
|
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).
|
305
309
|
type: string
|
310
|
+
nullable: true
|
306
311
|
license:
|
307
312
|
description: The license governing reuse of the Collection. Should be an IRI for known licenses (i.e. CC, RightsStatement.org URI, etc.).
|
308
313
|
type: string
|
314
|
+
nullable: true
|
309
315
|
AppliesTo:
|
310
316
|
description: Property model for indicating the parts, aspects, or versions of the resource to which a
|
311
317
|
descriptive element is applicable.
|
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.58.2
|
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-03-
|
11
|
+
date: 2021-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -334,7 +334,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
334
334
|
- !ruby/object:Gem::Version
|
335
335
|
version: '0'
|
336
336
|
requirements: []
|
337
|
-
rubygems_version: 3.
|
337
|
+
rubygems_version: 3.1.4
|
338
338
|
signing_key:
|
339
339
|
specification_version: 4
|
340
340
|
summary: Data models for the SDR
|