Separate collection and non-collection data element

in tool schema. New lxml is more strict when validating
the xml schema and fails with

```
lxml.etree.XMLSchemaParseError: complex type 'Output': The content model is not determinist., line 5329
```

this is because `filter` and `discover_datasets` are present in
OutputDataElement and OutputCollectionElement, making

```
     <xs:sequence>
       <xs:group ref="OutputDataElement" minOccurs="0" maxOccurs="unbounded" />
       <xs:group ref="OutputCollectionElement" minOccurs="0" maxOccurs="unbounded" />
     </xs:sequence>
```

not deterministic.

In any case this isn't an accurate model of what is allowed and parsed,
as you can't use collection-specific discover_datasets options outside
of a dataset collection.

I **think** that the reason for adding
OutputCollectionElement to the sequence is that you can have a `data`
element nested in a `collection` element.

To continue allowing this and making it more precise I've added an
additional `OutputCollectionDataElement` type that is allowed within
`collection`. This then should allow us to remove
`OutputCollectionElement` from the `OutputData` type.

A quick test against IUC and devteam revealed no problem with this
approach per se, however it showed that https://github.com/galaxyproject/tools-iuc/blob/aa8360cb3ec9faf1488938a430855977632706ff/tools/krakentools/extract_kraken_reads.xml#L145
uses `change_format` which is not implemented for collections.
This commit is contained in:
mvdbeek
2023-12-31 19:59:17 +02:00
parent f450dee29b
commit b1361c8e79
+9 -2
View File
@@ -5282,12 +5282,20 @@ on Human (hg18)``.
<xs:group name="OutputCollectionElement">
<xs:choice>
<xs:element name="data" type="OutputData" />
<xs:element name="data" type="OutputCollectionDataElement" />
<xs:element name="discover_datasets" type="OutputCollectionDiscoverDatasets" />
<xs:element name="filter" type="OutputFilter" />
</xs:choice>
</xs:group>
<xs:complexType name="OutputCollectionDataElement">
<xs:sequence>
<xs:group ref="OutputCollectionElement" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attributeGroup ref="OutputCommon" />
<xs:attributeGroup ref="OutputDataAttributes" />
</xs:complexType>
<xs:complexType name="OutputCollection">
<xs:annotation>
<xs:documentation xml:lang="en"><![CDATA[
@@ -5335,7 +5343,6 @@ This tag describes an output to the tool.
</xs:annotation>
<xs:sequence>
<xs:group ref="OutputDataElement" minOccurs="0" maxOccurs="unbounded" />
<xs:group ref="OutputCollectionElement" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attributeGroup ref="OutputCommon"/>
<xs:attributeGroup ref="OutputCollectionAttributes"/>