configurator: fix some schema field does not provide display name issue

fix some schema field does not provide display name issue

Tracked-On: #6691
Signed-off-by: Weiyi Feng <weiyix.feng@intel.com>
This commit is contained in:
Weiyi Feng 2022-04-01 11:24:04 +08:00 committed by acrnsi-robot
parent 3f1057b747
commit ce71921011
2 changed files with 2425 additions and 2392 deletions

File diff suppressed because it is too large Load Diff

View File

@ -171,7 +171,12 @@ class XS2JS:
if enum and '@acrn:title' in restriction['xs:enumeration'][0].get('xs:annotation', {}):
enum_names = []
for enum_element in restriction['xs:enumeration']:
enum_names.append(enum_element['xs:annotation']['@acrn:title'])
if 'xs:annotation' in enum_element and '@acrn:title' in enum_element.get('xs:annotation', {}):
enum_names.append(enum_element['xs:annotation']['@acrn:title'])
else:
enum_name = enum_element['@value']
print('Warning!: enum element {} does not provide a enumName'.format(str(enum_element)))
enum_names.append(enum_name)
js_st["enumNames"] = enum_names
js_st.update(self.xsa2jsa(restriction))