diff --git a/lib/cocina/models/identification.rb b/lib/cocina/models/identification.rb index 73176120..1ad751d7 100644 --- a/lib/cocina/models/identification.rb +++ b/lib/cocina/models/identification.rb @@ -3,7 +3,7 @@ module Cocina module Models class Identification < Struct - # 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. + # 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" # example: sul:PC0170_s3_Fiesta_Bowl_2012-01-02_210609_2026 attribute :sourceId, Types::Strict::String.meta(omittable: true) diff --git a/lib/cocina/models/request_identification.rb b/lib/cocina/models/request_identification.rb index da765e99..64b17195 100644 --- a/lib/cocina/models/request_identification.rb +++ b/lib/cocina/models/request_identification.rb @@ -3,7 +3,7 @@ module Cocina module Models class RequestIdentification < Struct - # 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. + # 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" # example: sul:PC0170_s3_Fiesta_Bowl_2012-01-02_210609_2026 attribute :sourceId, Types::Strict::String diff --git a/lib/cocina/models/source_id.rb b/lib/cocina/models/source_id.rb new file mode 100644 index 00000000..db30971b --- /dev/null +++ b/lib/cocina/models/source_id.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module Cocina + module Models + SourceId = Types::String.constrained( + format: /^.+:.+$/i + ) + end +end diff --git a/openapi.yml b/openapi.yml index cb0af409..99395484 100644 --- a/openapi.yml +++ b/openapi.yml @@ -842,15 +842,7 @@ components: additionalProperties: false properties: sourceId: - type: string - description: > - 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. - example: 'sul:PC0170_s3_Fiesta_Bowl_2012-01-02_210609_2026' + $ref: '#/components/schemas/SourceId' catalogLinks: type: array items: @@ -1179,15 +1171,7 @@ components: additionalProperties: false properties: sourceId: - type: string - description: > - 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. - example: 'sul:PC0170_s3_Fiesta_Bowl_2012-01-02_210609_2026' + $ref: '#/components/schemas/SourceId' catalogLinks: type: array items: @@ -1254,3 +1238,14 @@ components: $ref: "#/components/schemas/DescriptiveValue" source: $ref: "#/components/schemas/Source" + SourceId: + type: string + pattern: '^.+:.+$' + description: > + 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" + example: 'sul:PC0170_s3_Fiesta_Bowl_2012-01-02_210609_2026'