diff --git a/scripts/py_matter_idl/matter_idl/data_model_xml/handlers/handlers.py b/scripts/py_matter_idl/matter_idl/data_model_xml/handlers/handlers.py index 28a17d5f80a81d..a162e62bfb5e15 100644 --- a/scripts/py_matter_idl/matter_idl/data_model_xml/handlers/handlers.py +++ b/scripts/py_matter_idl/matter_idl/data_model_xml/handlers/handlers.py @@ -98,7 +98,7 @@ def GetNextProcessor(self, name: str, attrs): return BaseHandler(self.context) -class MandatoryConfirmFieldHandler(BaseHandler): +class MandatoryConformFieldHandler(BaseHandler): def __init__(self, context: Context, field: Field): super().__init__(context, handled=HandledDepth.SINGLE_TAG) self._field = field @@ -125,7 +125,7 @@ def GetNextProcessor(self, name: str, attrs): ApplyConstraint(attrs, self._field) return BaseHandler(self.context, handled=HandledDepth.SINGLE_TAG) elif name == "mandatoryConform": - return MandatoryConfirmFieldHandler(self.context, self._field) + return MandatoryConformFieldHandler(self.context, self._field) elif name == "optionalConform": self._field.qualities |= FieldQuality.OPTIONAL return BaseHandler(self.context, handled=HandledDepth.ENTIRE_TREE) @@ -325,8 +325,11 @@ def GetNextProcessor(self, name: str, attrs): elif name == "optionalConform": self._attribute.definition.qualities |= FieldQuality.OPTIONAL return BaseHandler(self.context, handled=HandledDepth.ENTIRE_TREE) + elif name == "otherwiseConform": + self._attribute.definition.qualities |= FieldQuality.OPTIONAL + return BaseHandler(self.context, handled=HandledDepth.ENTIRE_TREE) elif name == "mandatoryConform": - return MandatoryConfirmFieldHandler(self.context, self._attribute.definition) + return MandatoryConformFieldHandler(self.context, self._attribute.definition) elif name == "deprecateConform": self._deprecated = True return BaseHandler(self.context, handled=HandledDepth.ENTIRE_TREE) diff --git a/scripts/py_matter_idl/matter_idl/test_data_model_xml.py b/scripts/py_matter_idl/matter_idl/test_data_model_xml.py index ec2f0cae33c990..dfb4870d29d360 100755 --- a/scripts/py_matter_idl/matter_idl/test_data_model_xml.py +++ b/scripts/py_matter_idl/matter_idl/test_data_model_xml.py @@ -204,6 +204,17 @@ def testAttributes(self): + + + + + + + + + + + ''') @@ -215,6 +226,7 @@ def testAttributes(self): } readonly attribute OutputInfoStruct outputList[] = 0; + readonly attribute optional enum8 testConform = 1; readonly attribute attrib_id attributeList[] = 65531; readonly attribute event_id eventList[] = 65530;