-
Notifications
You must be signed in to change notification settings - Fork 2
Mapping Debugging Tips
Peter Mangiafico edited this page Nov 3, 2020
·
2 revisions
Cocina Mapping debugging tips
Trying to debug why validation is failing on the FromFedora mapping? From your local dor-services-app code, you can try this:
- Get the descMetadata datatream for the object and copy the XML to a local file.
- Lode the file up and create a nokogiri doc from it.
ng_xml = Nokogiri::XML(File.read('modsfile.xml'));
desc_props = Cocina::FromFedora::Descriptive.props(mods: ng_xml)
pp desc_props;nil
Cocina::Models::Validator.validate(Cocina::Models::Description, desc_props.with_indifferent_access)
# see the validation error, examine the hash props to see what the problem might be, you can try altering the hash manually and then re-validating
c = Cocina::Models::Description.new(desc_props) # runs the validation and then maps if successful
puts c.to_json