Skip to content

Commit

Permalink
Change DC JSON writing behavior for publisher value before official S…
Browse files Browse the repository at this point in the history
…chema 4.5 release
  • Loading branch information
codycooperross committed Dec 4, 2023
1 parent 23a3e94 commit aa464c2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/bolognese/writers/datacite_json_writer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ module Writers
module DataciteJsonWriter
def datacite_json
# Remove the following line for the schema 4.5 release
self.publisher = self.publisher['name'] if self.publisher&.respond_to?(:to_hash) && self.publisher.has_key?('name') && !self.publisher['name'].blank?
JSON.pretty_generate crosscite_hsh.transform_keys! { |key| key.camelcase(uppercase_first_letter = :lower) } if crosscite_hsh.present?
if crosscite_hsh.present?
datacite_json_hsh = crosscite_hsh
datacite_json_hsh['publisher'] = self.publisher['name'] if self.publisher&.respond_to?(:to_hash) && self.publisher.has_key?('name') && !self.publisher['name'].blank?
JSON.pretty_generate datacite_json_hsh.transform_keys! { |key| key.camelcase(uppercase_first_letter = :lower) }
end
end
end
end
Expand Down

1 comment on commit aa464c2

@svogt0511
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @codycooperross for fixing this. I should not have been updating self.publisher, but using a local variable to construct the return value for the writer. We did not want to modify the doi itself with a new publisher value.

Please sign in to comment.