From 3b8c1d1ae1d22f634c85055fc70e7092244cf81c Mon Sep 17 00:00:00 2001 From: s-heppner Date: Tue, 8 Oct 2024 13:15:26 +0200 Subject: [PATCH] V3.1: Make first and second of RelationshipElement optional Previously, `RelationshipElement.first` and `RelationshipElement.second` were mandatory attributes. As decided in [aas-specs#412] and specified in [aas-specs#431], we now make these attributes optional. Furthermore, we extend these changes to the constructor of `AnnotatedRelationshipElement`. Fixes #340 [aas-specs#412](https://github.com/admin-shell-io/aas-specs/issues/412) [aas-specs#431](https://github.com/admin-shell-io/aas-specs/pull/431) --- aas_core_meta/v3_1.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/aas_core_meta/v3_1.py b/aas_core_meta/v3_1.py index 46c15ee..0a2b4e3 100644 --- a/aas_core_meta/v3_1.py +++ b/aas_core_meta/v3_1.py @@ -2586,20 +2586,18 @@ class Relationship_element(Submodel_element): being either referable (model reference) or external (global reference). """ - first: "Reference" + first: Optional["Reference"] """ Reference to the first element in the relationship taking the role of the subject. """ - second: "Reference" + second: Optional["Reference"] """ Reference to the second element in the relationship taking the role of the object. """ def __init__( self, - first: "Reference", - second: "Reference", extensions: Optional[List["Extension"]] = None, category: Optional[Name_type] = None, ID_short: Optional[ID_short_type] = None, @@ -2611,6 +2609,8 @@ def __init__( embedded_data_specifications: Optional[ List["Embedded_data_specification"] ] = None, + first: Optional["Reference"] = None, + second: Optional["Reference"] = None, ) -> None: Submodel_element.__init__( self, @@ -3396,8 +3396,6 @@ class Annotated_relationship_element(Relationship_element): def __init__( self, - first: "Reference", - second: "Reference", extensions: Optional[List["Extension"]] = None, category: Optional[Name_type] = None, ID_short: Optional[ID_short_type] = None, @@ -3409,6 +3407,8 @@ def __init__( embedded_data_specifications: Optional[ List["Embedded_data_specification"] ] = None, + first: Optional["Reference"] = None, + second: Optional["Reference"] = None, annotations: Optional[List[Data_element]] = None, ) -> None: Relationship_element.__init__(