Questions about common field attributes
OleksandrKvl opened this issue · 2 comments
OleksandrKvl commented
nullValueis mutually exclusive withpresence = required/constant.
presence=requiresis mutually exclusive withnullValue
My understanding of that phrase is that having a nullValue attribute automatically makes field optional. This can hardly be correct because nullValue is not a valid value for a required field so it actually needs this attribute to check its value, in other words, nullValue is NOT mutually exclusive with required/optional. Is it correct and documentation is wrong here?
- The same page says that
presence=constantis mutually exclusive withmin/max/nullValue. Does it mean that no constraints are applied to constant values? For example is it legal to have constant255foruint8type? Because forrequiredtypesnullValueis not a valid value.
- Is it allowed to customize
min/max/nullValuefor floating point types? I suspect that yes, just want to be sure. The real question: isNaNliteral supported? I mean, can I write<type name="MyDouble" primitiveType="double" maxValue="100" nullValue="NaN"/>? No hint about it in the documentation.
donmendelson commented
- There is just no reason to set a null value if a value is required or constant.
- Min and max are used to set a valid range. If the value is constant, the valid range is simply that value.
- NaN as the null value for floating point is covered by the spec here: https://github.com/FIXTradingCommunity/fix-simple-binary-encoding/blob/master/v1-0-STANDARD/doc/02FieldEncoding.md#null-values Min or max could be set for a valid range.
OleksandrKvl commented
- How so? Documentation says that
nullValueis not a valid value for required field so in order to validate required field one should dominValue <= value && value <= maxValue && value != nullValue, how could there be no reason to set it? Moreover, all built-in types havenullValue, all other types inherit or redefine it so there's actually no type withoutnullValue. If we suppose that required fields have nonullValueand one receive255foruint8required field, how to check it, just by range? And what if the type hasmin=0, max=10, null=9? Or such a configuration is not allowed by saying that null value is not a valid value? - OK, clear enough, thanks.
- From that part it's not clear if
NaNis just a shortening fornot-a-numberfor the description purpose or it is a legal literal which can be used in the XML schema. So you confirm that it can be used in XML?