From 97de7fe76de1dca0e09d439490ac35b661cccc09 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 7 Sep 2023 19:44:26 -0400 Subject: [PATCH] Update description tag handling in xml (#29114) * Update description tag handling in xml * enable description on events * Fix test --- scripts/py_matter_idl/matter_idl/matter_idl_types.py | 1 + scripts/py_matter_idl/matter_idl/test_xml_parser.py | 1 + scripts/py_matter_idl/matter_idl/zapxml/handlers/handlers.py | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/py_matter_idl/matter_idl/matter_idl_types.py b/scripts/py_matter_idl/matter_idl/matter_idl_types.py index eb86e3ec4b99fc..3a680058c5e24d 100644 --- a/scripts/py_matter_idl/matter_idl/matter_idl_types.py +++ b/scripts/py_matter_idl/matter_idl/matter_idl_types.py @@ -166,6 +166,7 @@ class Event: fields: List[Field] readacl: AccessPrivilege = AccessPrivilege.VIEW qualities: EventQuality = EventQuality.NONE + description: Optional[str] = None @property def is_fabric_sensitive(self): diff --git a/scripts/py_matter_idl/matter_idl/test_xml_parser.py b/scripts/py_matter_idl/matter_idl/test_xml_parser.py index d8c7bb0a6c5dc1..6f42ca3c71d6b7 100755 --- a/scripts/py_matter_idl/matter_idl/test_xml_parser.py +++ b/scripts/py_matter_idl/matter_idl/test_xml_parser.py @@ -212,6 +212,7 @@ def testFabricScopedAndSensitive(self): events=[Event(priority=EventPriority.INFO, name='FabricEvent', code=0x1234, + description="This is a test event", fields=[Field(data_type=DataType(name='node_id'), code=1, name='AdminNodeID', diff --git a/scripts/py_matter_idl/matter_idl/zapxml/handlers/handlers.py b/scripts/py_matter_idl/matter_idl/zapxml/handlers/handlers.py index 9545d5ce8b51db..8150924efe1c4c 100644 --- a/scripts/py_matter_idl/matter_idl/zapxml/handlers/handlers.py +++ b/scripts/py_matter_idl/matter_idl/zapxml/handlers/handlers.py @@ -347,7 +347,7 @@ class DescriptionHandler(BaseHandler): """ def __init__(self, context: Context, target: Any): - super().__init__(context, handled=HandledDepth.ENTIRE_TREE) + super().__init__(context, handled=HandledDepth.SINGLE_TAG) self.target = target def HandleContent(self, content):