datacite / lupo

DataCite REST API
https://api.datacite.org
MIT License
12 stars 8 forks source link

Unexpected `publisher` and `publisher_obj` values when using `doi:import_one` #1103

Closed codycooperross closed 10 months ago

codycooperross commented 10 months ago

Describe the bug

When using the doi:import_one rake task, DOIs may save with null in the publisher column and {} in the publisher_obj column. The original publisher value is still present in the XML after the save.

Expected Behaviour

publisher is populated with the XML publisher property contents and publisher_obj contains a populated hash.

Current Behaviour

Steps to Reproduce

Create a DOI and then run the doi:import_one command on the DOI.

Context (Environment)

Screenshots

Further details

The DataCite JSON will also contain the following value for publisher:

  "publisher": {
    "name": ""
  },

Proposal

Hypothesis

Because the publisher_before_type_cast keys don't appear symbolized here, there are downstream errors:

https://github.com/datacite/lupo/blob/f60a480abbd56bbfb2cf60f1985cee5e7ee6548a/app/models/doi.rb#L2510-L2522

Possible Implementation