diff --git a/misc/config_tools/scenario_config/jsonschema/converter.py b/misc/config_tools/scenario_config/jsonschema/converter.py index 086aed148..8274c1bf0 100644 --- a/misc/config_tools/scenario_config/jsonschema/converter.py +++ b/misc/config_tools/scenario_config/jsonschema/converter.py @@ -151,6 +151,17 @@ class XS2JS: if '@acrn:widget-options' in annotation: js_ele['ui:options'] = eval(f"{{{annotation['@acrn:widget-options']}}}") + def convert_errormsg_config(self, annotation, js_ele): + if '@acrn:errormsg' in annotation: + opts = eval(f"{{{annotation['@acrn:errormsg']}}}") + + # An items of an error schema requires an "err:" prefix. + keys = list(opts.keys()) + for key in keys: + opts[f"err:{key}"] = opts.pop(key) + + js_ele.update(opts) + def xst2jst(self, type_name) -> str: """convert xml schema type name to json schema type name""" if type_name in self.xst2jst_mapping: @@ -195,9 +206,10 @@ class XS2JS: enum_names.append(enum_name) js_st["enumNames"] = enum_names - # widget and its options + # widget configs and error messages if 'xs:annotation' in obj: self.convert_widget_config(obj['xs:annotation'], js_st) + self.convert_errormsg_config(obj['xs:annotation'], js_st) js_st.update(self.xsa2jsa(restriction)) return js_st @@ -298,7 +310,7 @@ class XS2JS: if '@maxOccurs' in element: # ui:options seen at this moment are copied from the annotation of the type. - possible_keys = ['type', '$ref', 'oneOf', 'ui:options'] + possible_keys = ['type', '$ref', 'oneOf', 'ui:options', 'err:required', 'err:pattern'] convert_to_items_success = False js_ele['items'] = {} for possible_key in possible_keys: @@ -353,6 +365,9 @@ class XS2JS: # widget and its options self.convert_widget_config(element['xs:annotation'], js_ele) + # Error messages + self.convert_errormsg_config(element['xs:annotation'], js_ele) + properties[name] = js_ele # build result diff --git a/misc/config_tools/schema/VMtypes.xsd b/misc/config_tools/schema/VMtypes.xsd index c085370c4..24c71874e 100644 --- a/misc/config_tools/schema/VMtypes.xsd +++ b/misc/config_tools/schema/VMtypes.xsd @@ -71,12 +71,14 @@ - + Specify the enclave page cache (EPC) section base for Intel Software Guard Extensions (SGX). Must be page aligned. - + Specify the enclave page cache (EPC) section size in bytes for Intel Software Guard Extensions (SGX). Must be page aligned. @@ -86,12 +88,14 @@ - + Specify the starting address for non-contiguous allocation. - + Specify the physical memory size for non-contiguous allocation in megabytes. The size is a subset of the VM's total memory size specified on the Basic tab. @@ -278,7 +282,8 @@ The size is a subset of the VM's total memory size specified on the Basic tab. + acrn:options="//usb_device/@description" acrn:options-sorted-by="lambda s: s" + acrn:errormsg="'required': 'USB device required. If no USB device is available, click the X at the top right corner of this entry to remove.'"> Select the USB physical bus and port number that will be emulated by the ACRN Device Model for this VM. USB 3.0, 2.0, and 1.0 are supported. diff --git a/misc/config_tools/schema/config.xsd b/misc/config_tools/schema/config.xsd index b7b191a1e..0c70660b0 100644 --- a/misc/config_tools/schema/config.xsd +++ b/misc/config_tools/schema/config.xsd @@ -124,7 +124,8 @@ - + Specify the size of the memory stack in bytes for each physical CPU. For example, if you specify 8 kilobytes, each CPU will get its own 8-kilobyte stack. @@ -299,9 +300,10 @@ Refer to :ref:`vuart_config` for detailed vUART settings. - - Specify the name used to identify this VM. The VM name will be shown in the hypervisor console vm_list command. - + + Specify the name used to identify this VM. The VM name will be shown in the hypervisor console vm_list command. + @@ -484,8 +486,9 @@ mouse, and tablet. It sends Linux input layer events over virtio.The virtio-blk device presents a block device to the VM. Each virtio-blk device appears as a disk inside the VM. - - + + diff --git a/misc/config_tools/schema/types.xsd b/misc/config_tools/schema/types.xsd index b77e46b43..e4e7eefc0 100644 --- a/misc/config_tools/schema/types.xsd +++ b/misc/config_tools/schema/types.xsd @@ -14,7 +14,8 @@ - + An Integer value in hexadecimal format (with a leading ``0x``). @@ -167,7 +168,8 @@ Read more about the available scheduling options in :ref:`cpu_sharing`. - + A string of up to 15 letters, digits, ``_``, or ``-``.