summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRepository QA checks <repo-qa-checks@gentoo.org>2016-04-16 07:02:53 +0000
committerRepository QA checks <repo-qa-checks@gentoo.org>2016-04-16 07:02:53 +0000
commitd23ba0ab1d8e594c4317fde5af71740d0bc8380d (patch)
treeefcf4b24c495846afb0023e2359a7dd3417b7ad9 /metadata/xml-schema/projects.xsd
parent2016-04-16 06:46:23 UTC (diff)
parentprojects: Ensure at most one <description/> for each project (diff)
downloadgentoo-d23ba0ab1d8e594c4317fde5af71740d0bc8380d.tar.gz
gentoo-d23ba0ab1d8e594c4317fde5af71740d0bc8380d.tar.bz2
gentoo-d23ba0ab1d8e594c4317fde5af71740d0bc8380d.zip
Add 'metadata/xml-schema/' from commit 'b2d68e09fd2e3ac5edfde4049f32a963e261d1f6'
git-subtree-dir: metadata/xml-schema git-subtree-mainline: b1f1d03f16d3c10d5b2554be0bf4b07aa0788910 git-subtree-split: b2d68e09fd2e3ac5edfde4049f32a963e261d1f6
Diffstat (limited to 'metadata/xml-schema/projects.xsd')
-rw-r--r--metadata/xml-schema/projects.xsd98
1 files changed, 98 insertions, 0 deletions
diff --git a/metadata/xml-schema/projects.xsd b/metadata/xml-schema/projects.xsd
new file mode 100644
index 000000000000..770bd6769c6c
--- /dev/null
+++ b/metadata/xml-schema/projects.xsd
@@ -0,0 +1,98 @@
+<?xml version='1.0' encoding='UTF-8'?>
+
+<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
+ <xs:element name='projects'>
+ <xs:complexType>
+ <xs:choice minOccurs='0' maxOccurs='unbounded'>
+ <xs:element name='project' type='projectType'>
+ <xs:unique name='descUniquityConstraint'>
+ <xs:selector xpath='description'/>
+ <xs:field xpath='@fake-only-once'/>
+ </xs:unique>
+ </xs:element>
+ </xs:choice>
+ </xs:complexType>
+ <xs:key name='projectKey'>
+ <xs:selector xpath='project'/>
+ <xs:field xpath='email'/>
+ </xs:key>
+ <xs:keyref name='subprojectRef' refer='projectKey'>
+ <xs:selector xpath='project/subproject'/>
+ <xs:field xpath='@ref'/>
+ </xs:keyref>
+ <!-- define additional keys to enforce exactly one element
+ of each kind -->
+ <xs:key name='projectNameKey'>
+ <xs:selector xpath='project'/>
+ <xs:field xpath='name'/>
+ </xs:key>
+ <xs:key name='projectURLKey'>
+ <xs:selector xpath='project'/>
+ <xs:field xpath='url'/>
+ </xs:key>
+ </xs:element>
+
+ <xs:complexType name='projectType'>
+ <xs:choice minOccurs='0' maxOccurs='unbounded'>
+ <xs:element name='email' type='emailType'/>
+ <xs:element name='name' type='xs:token'/>
+ <xs:element name='url' type='urlType'/>
+ <xs:element name='description' type='descriptionType'/>
+ <xs:element name='subproject' type='subprojectType'/>
+ <xs:element name='member' type='memberType'/>
+ </xs:choice>
+ </xs:complexType>
+
+ <xs:complexType name='descriptionType'>
+ <xs:simpleContent>
+ <xs:extension base='xs:token'>
+ <xs:attribute name='fake-only-once'
+ fixed='there can be at most one &lt;description/&gt; element'/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:complexType name='subprojectType'>
+ <xs:attribute name='inherit-members' type='numericBoolType'/>
+ <xs:attribute name='ref' type='projectRefType'/>
+ </xs:complexType>
+
+ <xs:simpleType name='projectRefType'>
+ <xs:restriction base='emailType'>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:complexType name='memberType'>
+ <xs:all>
+ <xs:element name='email' type='emailType'
+ minOccurs='1' maxOccurs='1'/>
+ <xs:element name='name' type='xs:token'
+ minOccurs='0' maxOccurs='1'/>
+ <xs:element name='role' type='xs:token'
+ minOccurs='0' maxOccurs='1'/>
+ </xs:all>
+ <xs:attribute name='is-lead' type='numericBoolType'/>
+ </xs:complexType>
+
+ <!-- generic types -->
+ <xs:simpleType name='emailType'>
+ <xs:restriction base='xs:token'>
+ <!-- minimal safe regex -->
+ <xs:pattern value="[^@]+@[^.]+\..+"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name='urlType'>
+ <xs:restriction base='xs:token'>
+ <!-- TODO: something better? -->
+ <xs:pattern value="(mailto:[^@]+@[^.]+\..+|https?://.+)"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name='numericBoolType'>
+ <xs:restriction base='xs:integer'>
+ <xs:minInclusive value='0'/>
+ <xs:maxInclusive value='1'/>
+ </xs:restriction>
+ </xs:simpleType>
+</xs:schema>