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
1 changed files with 5 additions and 1 deletions

View File

@ -331,7 +331,11 @@ class XS2JS:
'selector': element['xs:annotation']['@acrn:options'],
'sorted': element['xs:annotation'].get('@acrn:options-sorted-by', None)
}
js_ele['enum'] = dynamic_enum
# 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
properties[name] = js_ele