sul-dlss / cocina-models

Cocina repository data model (implemented in Ruby)
https://sul-dlss.github.io/cocina-models/
3 stars 0 forks source link

Validate title note with type "associated name" #391

Closed justinlittman closed 2 years ago

justinlittman commented 2 years ago

Create a new validator that validates that when title.note with type "associated name" has a value, it must match a contributor name.

When there is a mismatch, it should raise a validation error with the message "Missing data: Name associated with uniform title does not match any contributor."

refs https://github.com/sul-dlss/argo/issues/3375

justinlittman commented 2 years ago

@arcadiafalcone Can you provide some examples?

arcadiafalcone commented 2 years ago

Correct:

{ title: [ {
    value: "A title", 
    type: "uniform",
    note: [ { value: "Smith, John",
                 type: "associated name" } ] } ],
  contributor: [ {
    name: [ { value: "Smith, John" } ] } ] }

Incorrect:

{ title: [ {
    value: "A title", 
    type: "uniform",
    note: [ { value: "Smith, John",
                 type: "associated name" } ] } ],
  contributor: [ {
    name: [ { value: "Smith, John A." } ] } ] }

Also incorrect:

{ title: [ {
    value: "A title", 
    type: "uniform",
    note: [ { value: "Smith, John",
                 type: "associated name" } ] } ],
  contributor: [ ] }

For more complex patterns where structuredValue is involved, see uniform title specs in https://github.com/sul-dlss/dor-services-app/blob/name-title-groups-2/spec/services/cocina/mapping/descriptive/mods/title_info_spec.rb.