Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7123974
D7252.id26307.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
D7252.id26307.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
@@ -67,7 +67,21 @@
<entry {XMLNS}>
<url>some url</url>
<codemeta:name>bar</codemeta:name>
- <codemeta:author>no one</codemeta:author>
+ <codemeta:author>
+ <codemeta:name>no one</codemeta:name>
+ </codemeta:author>
+ {PROVENANCE_XML}
+ </entry>
+ """,
+ ),
+ (
+ f"""\
+ <entry {XMLNS}>
+ <url>some url</url>
+ <codemeta:name>bar</codemeta:name>
+ <codemeta:author>
+ <schema:unknown-tag>should allow anything here</schema:unknown-tag>
+ </codemeta:author>
{PROVENANCE_XML}
</entry>
""",
@@ -304,6 +318,22 @@
},
],
),
+ (
+ f"""\
+ <entry {XMLNS}>
+ <url>some url</url>
+ <codemeta:name>bar</codemeta:name>
+ <codemeta:author>no one</codemeta:author>
+ {PROVENANCE_XML}
+ </entry>
+ """,
+ [
+ {
+ "summary": ".*Reason: character data between child elements.*",
+ "fields": ["codemeta:author"],
+ },
+ ],
+ ),
(
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
@@ -17,5 +17,18 @@
<xsd:union memberTypes="xsd:date xsd:dateTime"/>
</xsd:simpleType>
+ <xsd:element name="author" type="codemeta:PersonOrOrganization">
+ </xsd:element>
+ <xsd:element name="contributor" type="codemeta:PersonOrOrganization">
+ </xsd:element>
+
+ <xsd:complexType name="PersonOrOrganization">
+ <!-- Allows anything, but at least <codemeta:name> should be present -->
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element ref="codemeta:name" />
+ <xsd:any processContents="lax" />
+ </xsd:choice>
+ </xsd:complexType>
+
<xsd:element name="name" type="xsd:string" />
</xsd:schema>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Dec 20 2024, 7:31 AM (11 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3217457
Attached To
D7252: Add basic validation for codemeta:author and codemeta:contributor
Event Timeline
Log In to Comment