From 6711efbe0afd4a4ece01457ea1c1212167f06501 Mon Sep 17 00:00:00 2001 From: Marko Ristin Date: Sun, 25 Aug 2024 05:44:41 +0200 Subject: [PATCH] Update to meta-model V3.0.1 (#11) We patch the Python SDK which has been updated to the meta-model V3.0.1. --- aas_core3/jsonization.py | 8 ++++++-- aas_core3/types.py | 10 ++++------ aas_core3/types.pyi | 4 ++-- aas_core3/xmlization.py | 7 +++---- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/aas_core3/jsonization.py b/aas_core3/jsonization.py index 4ef3641..d798341 100644 --- a/aas_core3/jsonization.py +++ b/aas_core3/jsonization.py @@ -5312,6 +5312,11 @@ def embedded_data_specification_from_jsonable( "The required property 'dataSpecificationContent' is missing" ) + if setter.data_specification is None: + raise DeserializationException( + "The required property 'dataSpecification' is missing" + ) + return aas_types.EmbeddedDataSpecification( setter.data_specification_content, setter.data_specification ) @@ -7563,8 +7568,7 @@ def transform_embedded_data_specification(self, that): that.data_specification_content ) - if that.data_specification is not None: - jsonable["dataSpecification"] = self.transform(that.data_specification) + jsonable["dataSpecification"] = self.transform(that.data_specification) return jsonable diff --git a/aas_core3/types.py b/aas_core3/types.py index c500d50..92aabca 100644 --- a/aas_core3/types.py +++ b/aas_core3/types.py @@ -3501,8 +3501,7 @@ def descend_once(self): yield self.data_specification_content - if self.data_specification is not None: - yield self.data_specification + yield self.data_specification def descend(self): @@ -3510,10 +3509,9 @@ def descend(self): yield from self.data_specification_content.descend() - if self.data_specification is not None: - yield self.data_specification + yield self.data_specification - yield from self.data_specification.descend() + yield from self.data_specification.descend() def accept(self, visitor): @@ -3540,7 +3538,7 @@ def transform_with_context( def __init__( self, data_specification_content, - data_specification=None, + data_specification, ): self.data_specification_content = data_specification_content diff --git a/aas_core3/types.pyi b/aas_core3/types.pyi index 6549671..5c3e06c 100644 --- a/aas_core3/types.pyi +++ b/aas_core3/types.pyi @@ -3554,7 +3554,7 @@ class EmbeddedDataSpecification(Class): data_specification_content: "DataSpecificationContent" #: Reference to the data specification - data_specification: Optional["Reference"] + data_specification: "Reference" def descend_once(self) -> Iterator[Class]: """ @@ -3601,7 +3601,7 @@ class EmbeddedDataSpecification(Class): def __init__( self, data_specification_content: "DataSpecificationContent", - data_specification: Optional["Reference"] = None, + data_specification: "Reference", ) -> None: """Initialize with the given values.""" ... diff --git a/aas_core3/xmlization.py b/aas_core3/xmlization.py index 2e657a7..bdcdbcb 100644 --- a/aas_core3/xmlization.py +++ b/aas_core3/xmlization.py @@ -1991,10 +1991,9 @@ def _write_embedded_data_specification_as_sequence(self, that): self.visit(that.data_specification_content) self._write_end_element("dataSpecificationContent") - if that.data_specification is not None: - self._write_start_element("dataSpecification") - self._write_reference_as_sequence(that.data_specification) - self._write_end_element("dataSpecification") + self._write_start_element("dataSpecification") + self._write_reference_as_sequence(that.data_specification) + self._write_end_element("dataSpecification") def visit_embedded_data_specification(self, that):