misc: configurator: Bugfix: misplaced enum property

During conversion from xml to scenario.json, elements with "maxOccurs"
property is processed as json array, and (most) properties of that elements
goes to the json array. However the "enum" property should belong to the
array item, not the array itself.

Tracked-On: #7421
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
This commit is contained in:
Yifan Liu 2022-05-06 08:54:10 +08:00 committed by acrnsi-robot
parent bf656a1141
commit 33c506427e

View File

@ -331,6 +331,10 @@ class XS2JS:
'selector': element['xs:annotation']['@acrn:options'], 'selector': element['xs:annotation']['@acrn:options'],
'sorted': element['xs:annotation'].get('@acrn:options-sorted-by', None) 'sorted': element['xs:annotation'].get('@acrn:options-sorted-by', None)
} }
# enum should be applied to array items instead of array itself
if 'items' in js_ele:
js_ele['items']['enum'] = dynamic_enum
else:
js_ele['enum'] = dynamic_enum js_ele['enum'] = dynamic_enum
properties[name] = js_ele properties[name] = js_ele