Page MenuHomeSoftware Heritage

D7250.id26316.diff
No OneTemporary

D7250.id26316.diff

diff --git a/swh/deposit/tests/api/test_checks.py b/swh/deposit/tests/api/test_checks.py
--- a/swh/deposit/tests/api/test_checks.py
+++ b/swh/deposit/tests/api/test_checks.py
@@ -81,6 +81,23 @@
<author>no one</author>
<codemeta:datePublished>2020-12-21</codemeta:datePublished>
<codemeta:dateCreated>2020-12-21</codemeta:dateCreated>
+ <codemeta:dateModified>2020-12-25</codemeta:dateModified>
+ {PROVENANCE_XML}
+ </entry>
+ """,
+ ),
+ (
+ # technically, only Date is allowed for datePublished; but we allow DateTime
+ # for backward compatibility with old swh-deposit versions
+ f"""\
+ <entry {XMLNS}>
+ <url>some url</url>
+ <external_identifier>some id</external_identifier>
+ <name>nar</name>
+ <author>no one</author>
+ <codemeta:datePublished>2020-12-21T12:00:00</codemeta:datePublished>
+ <codemeta:dateCreated>2020-12-21T12:00:00</codemeta:dateCreated>
+ <codemeta:dateModified>2020-12-25T12:00:00</codemeta:dateModified>
{PROVENANCE_XML}
</entry>
""",
@@ -314,6 +331,23 @@
},
],
),
+ (
+ f"""\
+ <entry {XMLNS}>
+ <url>some url</url>
+ <external_identifier>someid</external_identifier>
+ <title>bar</title>
+ <author>no one</author>
+ <codemeta:dateModified>2020-12-aa</codemeta:dateModified>
+ </entry>
+ """,
+ [
+ {
+ "summary": ".*Reason: invalid value '2020-12-aa'.*",
+ "fields": ["codemeta:dateModified"],
+ },
+ ],
+ ),
(
f"""\
<entry {XMLNS}>
diff --git a/swh/deposit/xsd/codemeta.xsd b/swh/deposit/xsd/codemeta.xsd
--- a/swh/deposit/xsd/codemeta.xsd
+++ b/swh/deposit/xsd/codemeta.xsd
@@ -7,8 +7,11 @@
<!-- This is a non-exhaustive schema used to find likely errors in XML-encoded
Codemeta documents -->
+ <!-- technically, only Date is allowed for datePublished; but we allow DateTime
+ for backward compatibility with old swh-deposit versions -->
<xsd:element name="datePublished" type="codemeta:DateOrDateTime" />
<xsd:element name="dateCreated" type="codemeta:DateOrDateTime" />
+ <xsd:element name="dateModified" type="codemeta:DateOrDateTime" />
<xsd:simpleType name="DateOrDateTime">
<xsd:union memberTypes="xsd:date xsd:dateTime"/>

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 18, 10:33 PM (21 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3221065

Event Timeline