Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9344592
D7319.id26731.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D7319.id26731.diff
View Options
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
@@ -162,6 +162,38 @@
</entry>
""",
),
+ (
+ "codemeta-date-month",
+ # Allowed by ISO8601, therefore by schema:Date, but not by xsd:date
+ f"""\
+ <entry {XMLNS}>
+ <url>some url</url>
+ <external_identifier>some id</external_identifier>
+ <name>nar</name>
+ <author>no one</author>
+ <codemeta:datePublished>2020-12</codemeta:datePublished>
+ <codemeta:dateCreated>2020-12</codemeta:dateCreated>
+ <codemeta:dateModified>2020-12</codemeta:dateModified>
+ {PROVENANCE_XML}
+ </entry>
+ """,
+ ),
+ (
+ "codemeta-date-year",
+ # Allowed by ISO8601, therefore by schema:Date, but not by xsd:date
+ f"""\
+ <entry {XMLNS}>
+ <url>some url</url>
+ <external_identifier>some id</external_identifier>
+ <name>nar</name>
+ <author>no one</author>
+ <codemeta:datePublished>2020</codemeta:datePublished>
+ <codemeta:dateCreated>2020</codemeta:dateCreated>
+ <codemeta:dateModified>2020</codemeta:dateModified>
+ {PROVENANCE_XML}
+ </entry>
+ """,
+ ),
(
"codemeta-datetimes",
# technically, only Date is allowed for datePublished; but we allow DateTime
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
@@ -16,8 +16,18 @@
<xsd:element name="dateModified" type="codemeta:DateOrDateTime" />
<xsd:element name="embargoDate" type="xsd:date" />
+ <xsd:simpleType name="Date">
+ <!-- schema:Date allows truncated formats, but XML Schema primitive types
+ need to be joined to approximate it:
+ https://www.w3.org/TR/xmlschema-2/#truncatedformats
+ Note that this is stricter than ISO8601. For example, it does not
+ allow week dates or ordinal days.
+ -->
+ <xsd:union memberTypes="xsd:date xsd:gYearMonth xsd:gYear"/>
+ </xsd:simpleType>
+
<xsd:simpleType name="DateOrDateTime">
- <xsd:union memberTypes="xsd:date xsd:dateTime"/>
+ <xsd:union memberTypes="codemeta:Date xsd:dateTime"/>
</xsd:simpleType>
<xsd:element name="author" type="codemeta:PersonOrOrganization" />
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 3, 2:36 PM (5 d, 5 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3219238
Attached To
D7319: Add support for YYYY and YYYY-MM as date formats
Event Timeline
Log In to Comment