adobe / acc-js-sdk

A JavaScript SDK for Adobe Campaign Classic
Apache License 2.0
21 stars 20 forks source link

Support for xtk:dataTransfer:decimalCount enumeration #88

Closed mkiki closed 1 year ago

mkiki commented 1 year ago

Description

Some enumerations such as xtk:dataTransfer:decimalCount are a little bit special.

This cause a problem loading schemas since enumeration values are indexed in an array map as both a map (indexed by enum name) and as an array (indexed by the order of apperance of value elements). In this example, the first value (with name "all") is indexed with index 0 (as it is the first one), and the second value is indexed with name "0" which collides with the previous and causes an error.

<enumeration name="decimalCount" basetype="short">
    <value value="-1" name="all" label="All"/>
    <value name="0"/>
    <value name="1"/>
    <value name="2"/>
    <value name="3"/>
    <value name="4"/>
    <value name="5"/>
    <value name="6"/>
    <value name="7"/>
    <value name="8"/>
    <value name="9"/>
  </enumeration>

The fix consists in detecting such enumerations and only index by name.

How Has This Been Tested?

Unit tests

Types of changes

Checklist: