diff --git a/app/controllers/dois_controller.rb b/app/controllers/dois_controller.rb index 3155a53a2..9f8ccbf49 100644 --- a/app/controllers/dois_controller.rb +++ b/app/controllers/dois_controller.rb @@ -544,7 +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] + p[:schemaVersion] = METADATA_FORMATS.include?(meta["from"]) ? LAST_SCHEMA_VERSION : p[:schemaVersion] xml = meta["string"] read_attrs = [p[:creators], p[:contributors], p[:titles], p[:publisher], diff --git a/config/initializers/constants.rb b/config/initializers/constants.rb index 477f2578c..e0a3163ed 100644 --- a/config/initializers/constants.rb +++ b/config/initializers/constants.rb @@ -46,3 +46,14 @@ class IdentifierError < RuntimeError; end "EMEA" => "Europe, Middle East and Africa", "AMER" => "Americas" } + +LAST_SCHEMA_VERSION = "http://datacite.org/schema/kernel-4" + +METADATA_FORMATS = [ + "schema_org", + "ris", + "bibtex", + "citeproc", + "crossref", + "codemeta" +] \ No newline at end of file