Skip to content

Commit

Permalink
defaults to schema 4version when the metadata is in schema_org
Browse files Browse the repository at this point in the history
  • Loading branch information
kjgarza committed Apr 15, 2019
1 parent 0ffa5dd commit 431adeb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/controllers/dois_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ def safe_params
end

meta = xml.present? ? parse_xml(xml, doi: p[:doi]) : {}
p[:schemaVersion] = meta["from"] == "schema_org" ? "http://datacite.org/schema/kernel-4" : p[:schemaVersion]
xml = meta["string"]

read_attrs = [p[:creators], p[:contributors], p[:titles], p[:publisher],
Expand Down
1 change: 1 addition & 0 deletions spec/concerns/crosscitable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@
expect(meta["titles"]).to eq([{"title"=>"Hydrological and meteorological investigations in a lake near Kangerlussuaq, west Greenland"}])
expect(meta["publication_year"]).to eq("2014")
expect(meta["publisher"]).to eq("PANGAEA")
expect(meta["schema_version"]).to eq(nil)
end
end

Expand Down

Large diffs are not rendered by default.

0 comments on commit 431adeb

Please sign in to comment.