spase-group / spase-base-model

Specification for the SPASE base information model.
Apache License 2.0
1 stars 0 forks source link

Include backward compatible versions in spase.xsd #24

Open berniegsfc opened 1 year ago

berniegsfc commented 1 year ago

spase-version.xsd only includes a single Version value so it is not possible to use it to validate documents with older, yet compatible Version values. For example, with spase-2.5.0.xsd, we have

   <xsd:simpleType name="Version">
      <xsd:restriction base="xsd:string">
         <xsd:enumeration value="2.5.0" />
      </xsd:restriction>
      </xsd:simpleType>

which fails to validate an older version spase document

$ xmllint --schema spase-2.5.0.xsd HP_DataPolicy_v1.2.xml
...
HP_DataPolicy_v1.2.xml:2: element Version: Schemas validity error : Element '{http://www.spase-group.org/data/schema}Version': [facet 'enumeration'] The value '2.3.0' is not an element of the set {'2.5.0'}.
HP_DataPolicy_v1.2.xml:2: element Version: Schemas validity error : Element '{http://www.spase-group.org/data/schema}Version': '2.3.0' is not a valid value of the atomic type '{http://www.spase-group.org/data/schema}Version'.
HP_DataPolicy_v1.2.xml fails to validate

If however, spase-2.5.0.xsd contained

   <xsd:simpleType name="Version">
      <xsd:restriction base="xsd:string">
         <xsd:enumeration value="2.2.1" />
         <xsd:enumeration value="2.2.2" />
         <xsd:enumeration value="2.3.0" />
         <xsd:enumeration value="2.4.0" />
         <xsd:enumeration value="2.4.1" />
         <xsd:enumeration value="2.5.0" />
      </xsd:restriction>
      </xsd:simpleType>

the older version document would validate with the 2.5.0 schema.

lfb12345 commented 1 year ago

I am not sure how to adjust the XSD construction for your request but am looking into this.