Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XSD file is broken and does not match the docs #167

Closed
jtojnar opened this issue Jan 19, 2018 · 3 comments
Closed

XSD file is broken and does not match the docs #167

jtojnar opened this issue Jan 19, 2018 · 3 comments

Comments

@jtojnar
Copy link

jtojnar commented Jan 19, 2018

Some are easy to fix, like the following but there are also references to missing elements and various wrong things like <pkgname> inside <component> instead of <components>.

--- a/data/appstream.xsd
+++ b/data/appstream.xsd
@@ -13,7 +13,8 @@
     <xsd:complexType mixed="true">
       <xsd:sequence>
         <xsd:element ref="id" minOccurs="1" maxOccurs="unbounded"/>
-        <xsd:element ref="pkgname" minOccurs="1" maxOccurs="1"/>
+        <xsd:element ref="metadata_license" minOccurs="1" maxOccurs="1"/>
+        <!-- <xsd:element ref="pkgname" minOccurs="1" maxOccurs="1"/> -->
         <xsd:element ref="name" minOccurs="1" maxOccurs="unbounded"/>
         <xsd:element ref="summary" minOccurs="1" maxOccurs="unbounded"/>
         <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
@@ -21,7 +22,7 @@
         <xsd:element ref="project_group" minOccurs="0" maxOccurs="1"/>
         <xsd:element ref="keywords" minOccurs="0" maxOccurs="1"/>
         <xsd:element ref="icon" minOccurs="1" maxOccurs="unbounded"/>
-        <xsd:element ref="appcategories"/>
+        <!-- <xsd:element ref="appcategories"/> -->
         <xsd:element ref="mimetypes" minOccurs="0" maxOccurs="1"/>
         <xsd:element ref="url" minOccurs="0" maxOccurs="unbounded"/>
         <xsd:element ref="screenshots" minOccurs="0" maxOccurs="1"/>
@@ -29,26 +30,24 @@
         <xsd:element ref="releases" minOccurs="0" maxOccurs="1"/>
         <xsd:element ref="architectures" minOccurs="0" maxOccurs="1"/>
       </xsd:sequence>
-      <xsd:simpleContent>
-        <xsd:extension base="xsd:string">
-          <xsd:attribute name="type" use="optional">
-            <xsd:simpleType>
-              <xsd:restriction base="xsd:string">
-                <xsd:enumeration value="generic"/>
-                <xsd:enumeration value="desktop"/>
-                <xsd:enumeration value="codec"/>
-                <xsd:enumeration value="font"/>
-                <xsd:enumeration value="inputmethod"/>
-              </xsd:restriction>
-            </xsd:simpleType>
-          </xsd:attribute>
-        </xsd:extension>
-      </xsd:simpleContent>
+      <xsd:attribute name="type" use="optional">
+        <xsd:simpleType>
+          <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="generic"/>
+            <xsd:enumeration value="desktop-application"/>
+            <xsd:enumeration value="codec"/>
+            <xsd:enumeration value="font"/>
+            <xsd:enumeration value="inputmethod"/>
+          </xsd:restriction>
+        </xsd:simpleType>
+      </xsd:attribute>
     </xsd:complexType>
   </xsd:element>
 
   <xsd:element name="id" type="xsd:string"/>
 
+  <xsd:element name="metadata_license" type="xsd:string"/>
+
   <xsd:element name="pkgname" type="xsd:string"/>
   <xsd:element name="name">
     <xsd:complexType>
@@ -191,24 +190,18 @@
     </xsd:complexType>
   </xsd:element>
   <xsd:element name="screenshot">
-    <xsd:complexType>
-      <xsd:simpleContent>
-        <xsd:extension base="xsd:string">
-          <xsd:attribute name="type" use="optional">
-            <xsd:simpleType>
-              <xsd:restriction base="xsd:string">
-                <xsd:enumeration value="default"/>
-              </xsd:restriction>
-            </xsd:simpleType>
-          </xsd:attribute>
-        </xsd:extension>
-      </xsd:simpleContent>
-    </xsd:complexType>
     <xsd:complexType mixed="true">
       <xsd:choice maxOccurs="unbounded" minOccurs="1">
         <xsd:element ref="image"/>
         <xsd:element ref="caption"/>
       </xsd:choice>
+      <xsd:attribute name="type" use="optional">
+        <xsd:simpleType>
+          <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="default"/>
+          </xsd:restriction>
+        </xsd:simpleType>
+      </xsd:attribute>
     </xsd:complexType>
   </xsd:element>
   <xsd:element name="image">
@@ -223,8 +216,8 @@
               </xsd:restriction>
             </xsd:simpleType>
           </xsd:attribute>
-	  <xs:attribute name="width" type="xsd:positiveInteger" use="required"/>
-	  <xs:attribute name="height" type="xsd:positiveInteger" use="required"/>
+          <xsd:attribute name="width" type="xsd:positiveInteger" use="required"/>
+          <xsd:attribute name="height" type="xsd:positiveInteger" use="required"/>
         </xsd:extension>
       </xsd:simpleContent>
     </xsd:complexType>
@ximion
Copy link
Owner

ximion commented Jan 19, 2018

That file is old and outdated (it has not been touched for 4 years) and I should likely just remove it. If you want to validate your metadata files, they way to do it is to use appstreamcli validate now.

@jtojnar
Copy link
Author

jtojnar commented Jan 19, 2018

Cool, that works much better than the validator from appstream-glib. Though a working schema is much more useful than just for validation – for example, I wanted to see what values can the <component>’s type attribute contain. I was curious about desktop vs desktop application, as it is not very clear from the docs.

@ximion
Copy link
Owner

ximion commented Jan 19, 2018

Hmm, the specification should actionally mention that particular information... desktop is legacy but eternally supported, while desktop-application is the "new" thing. Since we will support both names forever, they are essentially aliases to one another.
See also the code for those enums: https://github.com/ximion/appstream/blob/master/src/as-component.c#L185-L268 (although to just get the values, looking at the API documentation is easier).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants