openhab/openhab-core

Dimension in `thing-description-1.0.0.xsd`

Closed this issue · 2 comments

I randomly noticed that there is a list of dimensions in thing-description-1.0.0.xsd:

<xs:simpleType name="dimension">
<xs:restriction base="xs:string">
<xs:enumeration value="Intensity" />
<xs:enumeration value="Acceleration" />
<xs:enumeration value="AmountOfSubstance" />
<xs:enumeration value="Angle" />
<xs:enumeration value="AngularAcceleration" />
<xs:enumeration value="AngularVelocity" />
<xs:enumeration value="Area" />
<xs:enumeration value="CatalyticActivity" />
<xs:enumeration value="DataAmount" />
<xs:enumeration value="DataRate" />
<xs:enumeration value="Dimensionless" />
<xs:enumeration value="Duration" />
<xs:enumeration value="DynamicViscosity" />
<xs:enumeration value="ElectricCapacitance" />
<xs:enumeration value="ElectricCharge" />
<xs:enumeration value="ElectricConductance" />
<xs:enumeration value="ElectricCurrent" />
<xs:enumeration value="ElectricInductance" />
<xs:enumeration value="ElectricPotential" />
<xs:enumeration value="ElectricResistance" />
<xs:enumeration value="Energy" />
<xs:enumeration value="Force" />
<xs:enumeration value="Frequency" />
<xs:enumeration value="Illuminance" />
<xs:enumeration value="KinematicViscosity" />
<xs:enumeration value="Length" />
<xs:enumeration value="LuminousFlux" />
<xs:enumeration value="LuminousIntensity" />
<xs:enumeration value="MagneticFlux" />
<xs:enumeration value="MagneticFluxDensity" />
<xs:enumeration value="Mass" />
<xs:enumeration value="MassFlowRate" />
<xs:enumeration value="Power" />
<xs:enumeration value="Pressure" />
<xs:enumeration value="RadiationDoseAbsorbed" />
<xs:enumeration value="RadiationDoseEffective" />
<xs:enumeration value="RadioactiveActivity" />
<xs:enumeration value="SolidAngle" />
<xs:enumeration value="Speed" />
<xs:enumeration value="Temperature" />
<xs:enumeration value="Torque" />
<xs:enumeration value="Velocity" />
<xs:enumeration value="Time" />
<xs:enumeration value="Volume" />
<xs:enumeration value="VolumetricDensity" />
<xs:enumeration value="VolumetricFlowRate" />
</xs:restriction>
</xs:simpleType>

This list hasn't been updated for a while, for example the following are missing:

  • DataAmount introduced in #681
  • EmissionIntensity introduced in #4069
  • EnergyPrice introduced in #3503
  • RadiationSpecificActivity introduced in #3608

and probably others as well.

But then I validated a thing type definition containing one of those, and it passed. Apparently dimension is not used at all, since item-type is defined as xs:string:

<xs:element name="item-type" type="xs:string" minOccurs="0"/>

So I'm wondering: Should it even be in the file? Is it a left-over, or deliberately kept for some sort of legacy backwards compatibility?

Expected Behavior

I would expect dimension to be either maintained and used, or not in the XSD at all.

Current Behavior

The XSD contains a definition for dimension, but apparently it is not used.

Possible Solution

Remove it from the XSD, if this is feasible without breaking compatibility and/or requiring a new version, which might complicate things.

Given openhab/openhab-webui#2485 I would say to remove it. And as it seems never to have been used anyway, there would seem to be little risk of breaking anything..

In my opinion the <xs:element name="item-type" type="xs:string" minOccurs="0"/>should be fixed.