From 33c506427e7060ff9f30222fa8587f944287d195 Mon Sep 17 00:00:00 2001 From: Yifan Liu Date: Fri, 6 May 2022 08:54:10 +0800 Subject: [PATCH] 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 --- misc/config_tools/scenario_config/jsonschema/converter.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/misc/config_tools/scenario_config/jsonschema/converter.py b/misc/config_tools/scenario_config/jsonschema/converter.py index e78b79d61..052441db9 100644 --- a/misc/config_tools/scenario_config/jsonschema/converter.py +++ b/misc/config_tools/scenario_config/jsonschema/converter.py @@ -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