diff --git a/lib/cocina/models/request_dro.rb b/lib/cocina/models/request_dro.rb index a355df07..3cf411a3 100644 --- a/lib/cocina/models/request_dro.rb +++ b/lib/cocina/models/request_dro.rb @@ -28,7 +28,7 @@ class RequestDRO < Struct attribute :access, DROAccess.optional.meta(omittable: true) attribute :administrative, Administrative.optional.meta(omittable: true) attribute :description, Description.optional.meta(omittable: true) - attribute :identification, Identification.optional.meta(omittable: true) + attribute(:identification, RequestIdentification.default { RequestIdentification.new }) attribute :structural, RequestDROStructural.optional.meta(omittable: true) attribute :geographic, Geographic.optional.meta(omittable: true) diff --git a/lib/cocina/models/request_identification.rb b/lib/cocina/models/request_identification.rb new file mode 100644 index 00000000..0b3893f5 --- /dev/null +++ b/lib/cocina/models/request_identification.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Cocina + module Models + class RequestIdentification < Struct + # example: sul:PC0170_s3_Fiesta_Bowl_2012-01-02_210609_2026 + attribute :sourceId, Types::Strict::String + attribute :catalogLinks, Types::Strict::Array.of(CatalogLink).meta(omittable: true) + end + end +end diff --git a/openapi.yml b/openapi.yml index b6d45a92..3fbf36d6 100644 --- a/openapi.yml +++ b/openapi.yml @@ -597,7 +597,6 @@ components: type: array items: $ref: "#/components/schemas/DescriptiveValue" - File: 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. type: object @@ -861,7 +860,7 @@ components: description: $ref: '#/components/schemas/Description' identification: - $ref: '#/components/schemas/Identification' + $ref: '#/components/schemas/RequestIdentification' structural: $ref: '#/components/schemas/RequestDROStructural' geographic: @@ -870,6 +869,7 @@ components: - label - type - version + - identification RequestDROStructural: description: Structural metadata type: object @@ -955,6 +955,20 @@ components: type: array items: $ref: '#/components/schemas/RequestFile' + RequestIdentification: + description: Same as a Identification, but requires a sourceId. + type: object + additionalProperties: false + properties: + sourceId: + type: string + example: 'sul:PC0170_s3_Fiesta_Bowl_2012-01-02_210609_2026' + catalogLinks: + type: array + items: + $ref: '#/components/schemas/CatalogLink' + required: + - sourceId Sequence: description: A sequence or ordering of resources within a Collection or Object. type: object diff --git a/spec/cocina/generator/schema_value_spec.rb b/spec/cocina/generator/schema_value_spec.rb index 4b065e37..bfeefd99 100644 --- a/spec/cocina/generator/schema_value_spec.rb +++ b/spec/cocina/generator/schema_value_spec.rb @@ -11,7 +11,8 @@ Cocina::Models::RequestDRO.new({ label: 'The Prince', type: Cocina::Models::Vocab.book, - version: 5 + version: 5, + identification: { sourceId: 'sul:123' } }, false, false) end @@ -26,7 +27,8 @@ Cocina::Models::RequestDRO.new({ label: 'The Blue and Brown Books', type: Cocina::Models::Vocab.book, - version: 5 + version: 5, + identification: { sourceId: 'sul:123' } }, false, false) end diff --git a/spec/cocina/models_spec.rb b/spec/cocina/models_spec.rb index 894f3dee..23ae01e6 100644 --- a/spec/cocina/models_spec.rb +++ b/spec/cocina/models_spec.rb @@ -111,7 +111,8 @@ 'type' => 'http://cocina.sul.stanford.edu/models/image.jsonld', 'label' => 'bar', 'version' => 5, - 'access' => {} + 'access' => {}, + 'identification' => { 'sourceId' => 'sul:123' } } end