diff --git a/capella2polarion/converters/link_converter.py b/capella2polarion/converters/link_converter.py index c489f97..ac2405b 100644 --- a/capella2polarion/converters/link_converter.py +++ b/capella2polarion/converters/link_converter.py @@ -24,7 +24,7 @@ TYPE_RESOLVERS = {"Part": lambda obj: obj.type.uuid} _Serializer: t.TypeAlias = cabc.Callable[ - [m.ModelObject, str, str, dict[str, t.Any]], + [m.ModelElement | m.Diagram, str, str, dict[str, t.Any]], list[polarion_api.WorkItemLink], ] @@ -139,19 +139,18 @@ def _get_work_item_ids( def _handle_description_reference_links( self, - obj: m.ModelObject, + obj: m.ModelElement | m.Diagram, work_item_id: str, role_id: str, links: dict[str, polarion_api.WorkItemLink], ) -> list[polarion_api.WorkItemLink]: - assert isinstance(obj, m.ModelElement) refs = self.converter_session[obj.uuid].description_references ref_set = set(self._get_work_item_ids(work_item_id, refs, role_id)) return self._create(work_item_id, role_id, ref_set, links) def _handle_diagram_reference_links( self, - diagram: m.ModelObject, + diagram: m.ModelElement | m.Diagram, work_item_id: str, role_id: str, links: dict[str, polarion_api.WorkItemLink], @@ -384,7 +383,7 @@ def _sorted_unordered_html_list( def _resolve_attribute( - obj: m.ModelObject, attr_id: str + obj: m.ModelElement | m.Diagram, attr_id: str ) -> m.ElementList[m.ModelElement] | m.ModelElement: attr_name, _, map_id = attr_id.partition(".") objs = getattr(obj, attr_name) diff --git a/jupyter-notebooks/document_templates/test-icd.html.j2 b/jupyter-notebooks/document_templates/test-icd.html.j2 index e1992f0..2aa4303 100644 --- a/jupyter-notebooks/document_templates/test-icd.html.j2 +++ b/jupyter-notebooks/document_templates/test-icd.html.j2 @@ -76,7 +76,7 @@ This interface control document defines functional interactions between the foll {{ heading(3, "Message Catalog", session)}}
This section identifies messages used within the interface.
{%- set classes = [] %} -{% for ei in interface.exchange_items | unique %} +{% for ei in interface.exchange_items | unique(attribute="uuid") %} {{ insert_work_item(ei, session) }} {% for el in ei.elements %} {{ add_class_dependencies(el.abstract_type, classes) }} @@ -84,6 +84,6 @@ This interface control document defines functional interactions between the foll {% endfor %} {{ heading(3, "Message Description", session)}}This section provides a detailed description of each message used within the interface.
-{% for cl in classes | unique %} +{% for cl in classes | unique(attribute="uuid") %} {{ insert_work_item(cl, session) }} {% endfor %}