From 3a4b84e078f53c02b2ec043220783bba11bbdacd Mon Sep 17 00:00:00 2001 From: Junjie Mao Date: Sat, 3 Sep 2022 00:43:48 +0800 Subject: [PATCH] config_tools: handle multiple xs:documentation properly With multiple xs:documentation nodes under the same xs:annotation, xs2js will convert the XML into a dict where the key `xs:documentation` maps to a list rather than a string. This patch enhances the converter.py to handle such case properly. Tracked-On: #8098 Signed-off-by: Junjie Mao --- misc/config_tools/scenario_config/jsonschema/converter.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/misc/config_tools/scenario_config/jsonschema/converter.py b/misc/config_tools/scenario_config/jsonschema/converter.py index 1df17530a..96df5588e 100644 --- a/misc/config_tools/scenario_config/jsonschema/converter.py +++ b/misc/config_tools/scenario_config/jsonschema/converter.py @@ -346,7 +346,9 @@ class XS2JS: js_ele['title'] = annotation.get('@acrn:title', name) # documentation - documentation: str = annotation.get('xs:documentation', None) + documentation = annotation.get('xs:documentation', None) + if isinstance(documentation, list): + documentation = documentation[0] if documentation is None or documentation.strip() == '': documentation = '' if documentation: