-
-
Notifications
You must be signed in to change notification settings - Fork 450
Description
Note: the solution proposed below depends on XSD schema v1.1 .. and apparently neither Maven nor (say) Eclipse IDE actually yet support v1.1 .. so this issue has to be parked awaiting such support in future.
Currently the XSD schema validation for tags in channel-types is a bit loose. See below. Currently it checks for the presence of one or two tags, and checks that both of them are either Point or Property; so it does erroneously allow two Points, or two Properties, or a Property without a Point.
Current XSD
<xs:complexType name="tags">
<xs:sequence>
<xs:element name="tag" type="thing-description:semanticPropertyOrPointTag" minOccurs="1" maxOccurs="2"/>
</xs:sequence>
</xs:complexType>
I have been checking if it might be possible to further harden the XSD validation via the assert
logic. See below. So it checks that there is exactly one Point and zero or one Property.
Possible New XSD
<xs:complexType name="tags">
<xs:sequence>
<xs:element name="tag" type="xs:string" minOccurs="1" maxOccurs="2"/>
</xs:sequence>
<xs:assert test="count(tag[. = $semanticPointTag]) = 1 and count(tag[. = $semanticPropertyTag]) >= 0"/>
</xs:complexType>
The revised XSD is here thing-description-1.0.0.zip. Note: it would require @jimtng to modify the schema generation script so that the semanticPropertyOrPointTag
enum would be split into two separate enums semanticPointTag
and semanticPropertyTag
.
Note: I have not yet tested this new model. But I am posting this as a suggestion for comments.