Some value types in FEEL/DMN require special formatting when marshalling/unmarshalling. For instance:
So it seems that ISO 8601 does not define negative intervals. I.e., ISO 8601 only supports things like "PT1H". XPath extends that with a leading optional sign, like "+PT1H" and "-PT1H". Java extends that allowing the sign to be used in each of the units in the duration like, "PT+1H", "PT-1H", besides the leading sign "-PT1H".
The FEEL spec on page 113 seems to follow the XPath lexical definition, so the leading sign "-PT1H" seems to be the correct format.
Implement an object marshaller for DMN/FEEL that is capable of marshalling/unmarshalling objects. Most object types are straightforward, but a few of them (like durations) need special handling. In particular:
- negative duration should use a leading - sign instead of having the sign in the unit numbers
- durations need to be normalized before marshalled:
A days and time duration in the semantic domain is a sequence of numbers for the days, hours, minutes, and seconds of duration, normalized such that the sum of these numbers is minimized.