Repository: aas-core-works/aas-core-codegen (language: python)

Issue:
Add enhancing to C#
We want to allow downstream users to "enhance", *i.e.* wrap, our model classes with custom properties and methods.

To that end, we generate as much boiler plate code as possible to make their wrapping task easier.

In this patch, we also fix various omissions from the previous commit (#327) in ``types.cs``. Namely, we did not generate the complete interfaces (the methods were missing), 327) in ``types.cs``. Namely:

* we did not generate the complete interfaces (the methods were missing), and
* the C# snippets were not adapted yet.

These omissions were only revealed once we started testing the enhancing.


Discussion / hints:

Fix patch:
diff --git a/setup.py b/setup.py
index 29fcb5aa3..39e6ad6be 100644
--- a/setup.py
+++ b/setup.py
@@ -50,7 +50,7 @@
             "twine",
             "jsonschema==3.2.0",
             "xmlschema==1.10.0",
-            "aas-core-meta@git+https://github.com/aas-core-works/aas-core-meta@cb28d18#egg=aas-core-meta",
+            "aas-core-meta@git+https://github.com/aas-core-works/aas-core-meta@6d5411b#egg=aas-core-meta",
             "ssort==0.12.3",
         ]
     },


Test patch:
diff --git a/test_data/cpp/test_main/aas_core_meta.v3/expected_output/enhancing.hpp b/test_data/cpp/test_main/aas_core_meta.v3/expected_output/enhancing.hpp
index 1d5092f64..fb9d81d23 100644
--- a/test_data/cpp/test_main/aas_core_meta.v3/expected_output/enhancing.hpp
+++ b/test_data/cpp/test_main/aas_core_meta.v3/expected_output/enhancing.hpp
@@ -7104,20 +7104,6 @@ class EnhancedEmbeddedDataSpecification
     return types::ModelType::kEmbeddedDataSpecification;
   }
 
-  const std::shared_ptr<types::IReference>& data_specification() const override {
-    return instance_->data_specification();
-  }
-
-  std::shared_ptr<types::IReference>& mutable_data_specification() override {
-    return instance_->mutable_data_specification();
-  }
-
-  void set_data_specification(
-    std::shared_ptr<types::IReference> value
-  ) override {
-    instance_->set_data_specification(value);
-  }
-
   const std::shared_ptr<types::IDataSpecificationContent>& data_specification_content() const override {
     return instance_->data_specification_content();
   }
@@ -7132,6 +7118,26 @@ class EnhancedEmbeddedDataSpecification
     instance_->set_data_specification_content(value);
   }
 
+  const common::optional<
+    std::shared_ptr<types::IReference>
+  >& data_specification() const override {
+    return instance_->data_specification();
+  }
+
+  common::optional<
+    std::shared_ptr<types::IReference>
+  >& mutable_data_specification() override {
+    return instance_->mutable_data_specification();
+  }
+
+  void set_data_specification(
+    common::optional<
+      std::shared_ptr<types::IReference>
+    > value
+  ) override {
+    instance_->set_data_specification(value);
+  }
+
   const std::shared_ptr<E>& enhancement() const {
     return enhancement_;
   }
@@ -13524,13 +13530,6 @@ std::shared_ptr<types::IEmbeddedDataSpecification> WrapEmbeddedDataSpecification
   // We assume that we already checked whether `that` has been enhanced
   // in the caller.
 
-  that->set_data_specification(
-    Wrap<E>(
-      that->data_specification(),
-      factory
-    )
-  );
-
   that->set_data_specification_content(
     Wrap<E>(
       that->data_specification_content(),
@@ -13538,6 +13537,27 @@ std::shared_ptr<types::IEmbeddedDataSpecification> WrapEmbeddedDataSpecification
     )
   );
 
+  if (that->data_specification().has_value()) {
+    const std::shared_ptr<types::IReference>& value(
+      that->data_specification().value()
+    );
+
+    std::shared_ptr<
+      types::IReference
+    > wrapped(
+      Wrap<E>(
+        value,
+        factory
+      )
+    );
+
+    that->set_data_specification(
+      common::make_optional(
+        std::move(wrapped)
+      )
+    );
+  }
+
   std::shared_ptr<E> enh(
     factory(that)
   );
diff --git a/test_data/cpp/test_main/aas_core_meta.v3/expected_output/iteration.cpp b/test_data/cpp/test_main/aas_core_meta.v3/expected_output/iteration.cpp
index 927cff635..d16d04262 100644
--- a/test_data/cpp/test_main/aas_core_meta.v3/expected_output/iteration.cpp
+++ b/test_data/cpp/test_main/aas_core_meta.v3/expected_output/iteration.cpp
@@ -11300,10 +11300,10 @@ void IteratorOverEmbeddedDataSpecification::Execute() {
         index_ = -1;
         done_ = false;
 
-        property_ = Property::kDataSpecification;
+        property_ = Property::kDataSpecificationContent;
         item_ = std::move(
           std::static_pointer_cast<types::IClass>(
-            casted_->data_specification()
+            casted_->data_specification_content()
           )
         );
         ++index_;
@@ -11313,10 +11313,15 @@ void IteratorOverEmbeddedDataSpecification::Execute() {
       }
 
       case 1: {
-        property_ = Property::kDataSpecificationContent;
+        if (!(casted_->data_specification().has_value())) {
+          state_ = 2;
+          continue;
+        }
+
+        property_ = Property::kDataSpecification;
         item_ = std::move(
           std::static_pointer_cast<types::IClass>(
-            casted_->data_specification_content()
+            *(casted_->data_specification())
           )
         );
         ++index_;
diff --git a/test_data/cpp/test_main/aas_core_meta.v3/expected_output/jsonization.cpp b/test_data/cpp/test_main/aas_core_meta.v3/expected_output/jsonization.cpp
index 5b427bb2f..0e465b69d 100644
--- a/test_data/cpp/test_main/aas_core_meta.v3/expected_output/jsonization.cpp
+++ b/test_data/cpp/test_main/aas_core_meta.v3/expected_output/jsonization.cpp
@@ -22421,8 +22421,8 @@ std::pair<
 }
 
 std::set<std::string> kPropertiesInEmbeddedDataSpecification = {
-  "dataSpecification",
-  "dataSpecificationContent"
+  "dataSpecificationContent",
+  "dataSpecification"
 };
 
 std::pair<
@@ -22477,18 +22477,6 @@ std::pair<
 
   // region Check required properties
 
-  if (!json.contains("dataSpecification")) {
-    return std::make_pair<
-      common::optional<std::shared_ptr<types::IEmbeddedDataSpecification> >,
-      common::optional<DeserializationError>
-    >(
-      common::nullopt,
-      common::make_optional<DeserializationError>(
-        L"The required property dataSpecification is missing"
-      )
-    );
-  }
-
   if (!json.contains("dataSpecificationContent")) {
     return std::make_pair<
       common::optional<std::shared_ptr<types::IEmbeddedDataSpecification> >,
@@ -22507,39 +22495,13 @@ std::pair<
 
   common::optional<DeserializationError> error;
 
-  common::optional<std::shared_ptr<types::IReference> > the_data_specification;
-
   common::optional<std::shared_ptr<types::IDataSpecificationContent> > the_data_specification_content;
 
-  // endregion Initialization
-
-  // region De-serialize dataSpecification
-
-  std::tie(
-    the_data_specification,
-    error
-  ) = DeserializeReference(
-    json["dataSpecification"],
-    additional_properties
-  );
-
-  if (error.has_value()) {
-    error->path.segments.emplace_front(
-      common::make_unique<PropertySegment>(
-        L"dataSpecification"
-      )
-    );
-
-    return std::make_pair<
-      common::optional<std::shared_ptr<types::IEmbeddedDataSpecification> >,
-      common::optional<DeserializationError>
-    >(
-      common::nullopt,
-      std::move(error)
-    );
-  }
+  common::optional<
+    std::shared_ptr<types::IReference>
+  > the_data_specification;
 
-  // endregion De-serialize dataSpecification
+  // endregion Initialization
 
   // region De-serialize dataSpecificationContent
 
@@ -22569,6 +22531,36 @@ std::pair<
 
   // endregion De-serialize dataSpecificationContent
 
+  // region De-serialize dataSpecification
+
+  if (json.contains("dataSpecification")) {
+    std::tie(
+      the_data_specification,
+      error
+    ) = DeserializeReference(
+      json["dataSpecification"],
+      additional_properties
+    );
+
+    if (error.has_value()) {
+      error->path.segments.emplace_front(
+        common::make_unique<PropertySegment>(
+          L"dataSpecification"
+        )
+      );
+
+      return std::make_pair<
+        common::optional<std::shared_ptr<types::IEmbeddedDataSpecification> >,
+        common::optional<DeserializationError>
+      >(
+        common::nullopt,
+        std::move(error)
+      );
+    }
+  }
+
+  // endregion De-serialize dataSpecification
+
   return std::make_pair(
     common::make_optional<
       std::shared_ptr<types::IEmbeddedDataSpecification>
@@ -22577,8 +22569,8 @@ std::pair<
       // We deliberately do not use std::make_shared here to avoid an unnecessary
       // upcast.
       new types::EmbeddedDataSpecification(
-        std::move(*the_data_specification),
-        std::move(*the_data_specification_content)
+        std::move(*the_data_specification_content),
+        std::move(the_data_specification)
       )
     ),
     common::nullopt
@@ -35748,33 +35740,6 @@ std::pair<
 
   common::optional<SerializationError> error;
 
-  common::optional<nlohmann::json> json_data_specification;
-  std::tie(
-    json_data_specification,
-    error
-  ) = SerializeIClass(
-    *that.data_specification()
-  );
-  if (error.has_value()) {
-    error->path.segments.emplace_front(
-      common::make_unique<iteration::PropertySegment>(
-        iteration::Property::kDataSpecification
-      )
-    );
-
-    return std::make_pair<
-      common::optional<nlohmann::json>,
-      common::optional<SerializationError>
-    >(
-      common::nullopt,
-      std::move(error)
-    );
-  }
-
-  result["dataSpecification"] = std::move(
-    *json_data_specification
-  );
-
   common::optional<nlohmann::json> json_data_specification_content;
   std::tie(
     json_data_specification_content,
@@ -35802,6 +35767,40 @@ std::pair<
     *json_data_specification_content
   );
 
+  const common::optional<
+    std::shared_ptr<types::IReference>
+  >& maybe_data_specification(
+    that.data_specification()
+  );
+  if (maybe_data_specification.has_value()) {
+    common::optional<nlohmann::json> json_data_specification;
+    std::tie(
+      json_data_specification,
+      error
+    ) = SerializeIClass(
+      **maybe_data_specification
+    );
+    if (error.has_value()) {
+      error->path.segments.emplace_front(
+        common::make_unique<iteration::PropertySegment>(
+          iteration::Property::kDataSpecification
+        )
+      );
+
+      return std::make_pair<
+        common::optional<nlohmann::json>,
+        common::optional<SerializationError>
+      >(
+        common::nullopt,
+        std::move(error)
+      );
+    }
+
+    result["dataSpecification"] = std::move(
+      *json_data_specification
+    );
+  }
+
   return std::make_pair<
     common::optional<nlohmann::json>,
     common::optional<SerializationError>
diff --git a/test_data/cpp/test_main/aas_core_meta.v3/expected_output/types.cpp b/test_data/cpp/test_main/aas_core_meta.v3/expected_output/types.cpp
index 42afaa141..36e1f1da5 100644
--- a/test_data/cpp/test_main/aas_core_meta.v3/expected_output/types.cpp
+++ b/test_data/cpp/test_main/aas_core_meta.v3/expected_output/types.cpp
@@ -6911,32 +6911,20 @@ void Environment::set_concept_descriptions(
 // region EmbeddedDataSpecification
 
 EmbeddedDataSpecification::EmbeddedDataSpecification(
-  std::shared_ptr<IReference> data_specification,
-  std::shared_ptr<IDataSpecificationContent> data_specification_content
+  std::shared_ptr<IDataSpecificationContent> data_specification_content,
+  common::optional<
+    std::shared_ptr<IReference>
+  > data_specification
 ) {
-  data_specification_ = std::move(data_specification);
-
   data_specification_content_ = std::move(data_specification_content);
+
+  data_specification_ = std::move(data_specification);
 }
 
 ModelType EmbeddedDataSpecification::model_type() const {
   return ModelType::kEmbeddedDataSpecification;
 }
 
-const std::shared_ptr<IReference>& EmbeddedDataSpecification::data_specification() const {
-  return data_specification_;
-}
-
-std::shared_ptr<IReference>& EmbeddedDataSpecification::mutable_data_specification() {
-  return data_specification_;
-}
-
-void EmbeddedDataSpecification::set_data_specification(
-  std::shared_ptr<IReference> value
-) {
-  data_specification_ = value;
-}
-
 const std::shared_ptr<IDataSpecificationContent>& EmbeddedDataSpecification::data_specification_content() const {
   return data_specification_content_;
 }
@@ -6951,6 +6939,26 @@ void EmbeddedDataSpecification::set_data_specification_content(
   data_specification_content_ = value;
 }
 
+const common::optional<
+  std::shared_ptr<IReference>
+>& EmbeddedDataSpecification::data_specification() const {
+  return data_specification_;
+}
+
+common::optional<
+  std::shared_ptr<IReference>
+>& EmbeddedDataSpecification::mutable_data_specification() {
+  return data_specification_;
+}
+
+void EmbeddedDataSpecification::set_data_specification(
+  common::optional<
+    std::shared_ptr<IReference>
+  > value
+) {
+  data_specification_ = value;
+}
+
 // endregion EmbeddedDataSpecification
 
 // region LevelType
diff --git a/test_data/cpp/test_main/aas_core_meta.v3/expected_output/types.hpp b/test_data/cpp/test_main/aas_core_meta.v3/expected_output/types.hpp
index 8136b0c15..373367775 100644
--- a/test_data/cpp/test_main/aas_core_meta.v3/expected_output/types.hpp
+++ b/test_data/cpp/test_main/aas_core_meta.v3/expected_output/types.hpp
@@ -2927,27 +2927,33 @@ class IEmbeddedDataSpecification
     : virtual public IClass {
  public:
   ///@{
-  /// \brief Reference to the data specification
+  /// \brief Actual content of the data specification
 
-  virtual const std::shared_ptr<IReference>& data_specification() const = 0;
+  virtual const std::shared_ptr<IDataSpecificationContent>& data_specification_content() const = 0;
 
-  virtual std::shared_ptr<IReference>& mutable_data_specification() = 0;
+  virtual std::shared_ptr<IDataSpecificationContent>& mutable_data_specification_content() = 0;
 
-  virtual void set_data_specification(
-    std::shared_ptr<IReference> value
+  virtual void set_data_specification_content(
+    std::shared_ptr<IDataSpecificationContent> value
   ) = 0;
 
   ///@}
 
   ///@{
-  /// \brief Actual content of the data specification
+  /// \brief Reference to the data specification
 
-  virtual const std::shared_ptr<IDataSpecificationContent>& data_specification_content() const = 0;
+  virtual const common::optional<
+    std::shared_ptr<IReference>
+  >& data_specification() const = 0;
 
-  virtual std::shared_ptr<IDataSpecificationContent>& mutable_data_specification_content() = 0;
+  virtual common::optional<
+    std::shared_ptr<IReference>
+  >& mutable_data_specification() = 0;
 
-  virtual void set_data_specification_content(
-    std::shared_ptr<IDataSpecificationContent> value
+  virtual void set_data_specification(
+    common::optional<
+      std::shared_ptr<IReference>
+    > value
   ) = 0;
 
   ///@}
@@ -10269,33 +10275,41 @@ class Environment
 class EmbeddedDataSpecification
     : public IEmbeddedDataSpecification {
  public:
-  EmbeddedDataSpecification(
-    std::shared_ptr<IReference> data_specification,
-    std::shared_ptr<IDataSpecificationContent> data_specification_content
+  explicit EmbeddedDataSpecification(
+    std::shared_ptr<IDataSpecificationContent> data_specification_content,
+    common::optional<
+      std::shared_ptr<IReference>
+    > data_specification = common::nullopt
   );
 
   ModelType model_type() const override;
 
-  // region Get and set data_specification_
+  // region Get and set data_specification_content_
 
-  const std::shared_ptr<IReference>& data_specification() const override;
+  const std::shared_ptr<IDataSpecificationContent>& data_specification_content() const override;
 
-  std::shared_ptr<IReference>& mutable_data_specification() override;
+  std::shared_ptr<IDataSpecificationContent>& mutable_data_specification_content() override;
 
-  void set_data_specification(
-    std::shared_ptr<IReference> value
+  void set_data_specification_content(
+    std::shared_ptr<IDataSpecificationContent> value
   ) override;
 
   // endregion
 
-  // region Get and set data_specification_content_
+  // region Get and set data_specification_
 
-  const std::shared_ptr<IDataSpecificationContent>& data_specification_content() const override;
+  const common::optional<
+    std::shared_ptr<IReference>
+  >& data_specification() const override;
 
-  std::shared_ptr<IDataSpecificationContent>& mutable_data_specification_content() override;
+  common::optional<
+    std::shared_ptr<IReference>
+  >& mutable_data_specification() override;
 
-  void set_data_specification_content(
-    std::shared_ptr<IDataSpecificationContent> value
+  void set_data_specification(
+    common::optional<
+      std::shared_ptr<IReference>
+    > value
   ) override;
 
   // endregion
@@ -10303,9 +10317,11 @@ class EmbeddedDataSpecification
   ~EmbeddedDataSpecification() override = default;
 
  private:
-  std::shared_ptr<IReference> data_specification_;
-
   std::shared_ptr<IDataSpecificationContent> data_specification_content_;
+
+  common::optional<
+    std::shared_ptr<IReference>
+  > data_specification_;
 };
 
 class LevelType
diff --git a/test_data/cpp/test_main/aas_core_meta.v3/expected_output/visitation.cpp b/test_data/cpp/test_main/aas_core_meta.v3/expected_output/visitation.cpp
index 15641117c..953e5fb9f 100644
--- a/test_data/cpp/test_main/aas_core_meta.v3/expected_output/visitation.cpp
+++ b/test_data/cpp/test_main/aas_core_meta.v3/expected_output/visitation.cpp
@@ -3090,15 +3090,23 @@ void PassThroughVisitor::VisitEnvironment(
 void PassThroughVisitor::VisitEmbeddedDataSpecification(
   const std::shared_ptr<types::IEmbeddedDataSpecification>& that
 ) {
-  // mutable_data_specification
-  Visit(
-    that->mutable_data_specification()
-  );
-
   // mutable_data_specification_content
   Visit(
     that->mutable_data_specification_content()
   );
+
+  // region mutable_data_specification
+  const common::optional<
+    std::shared_ptr<types::IReference>
+  >& maybe_data_specification(
+    that->mutable_data_specification()
+  );
+  if (maybe_data_specification.has_value()) {
+    Visit(
+      maybe_data_specification.value()
+    );
+  }
+  // endregion
 }
 
 void PassThroughVisitor::VisitLevelType(
diff --git a/test_data/cpp/test_main/aas_core_meta.v3/expected_output/xmlization.cpp b/test_data/cpp/test_main/aas_core_meta.v3/expected_output/xmlization.cpp
index 3b99a8502..9dd7593ae 100644
--- a/test_data/cpp/test_main/aas_core_meta.v3/expected_output/xmlization.cpp
+++ b/test_data/cpp/test_main/aas_core_meta.v3/expected_output/xmlization.cpp
@@ -14216,8 +14216,8 @@ enum class OfEnvironment : std::uint32_t {
 };  // enum class OfEnvironment
 
 enum class OfEmbeddedDataSpecification : std::uint32_t {
-  kDataSpecification = 0,
-  kDataSpecificationContent = 1
+  kDataSpecificationContent = 0,
+  kDataSpecification = 1
 };  // enum class OfEmbeddedDataSpecification
 
 enum class OfLevelType : std::uint32_t {
@@ -15446,13 +15446,13 @@ const std::unordered_map<
   std::string,
   OfEmbeddedDataSpecification
 > kMapOfEmbeddedDataSpecification = {
-  {
-    "dataSpecification",
-    OfEmbeddedDataSpecification::kDataSpecification
-  },
   {
     "dataSpecificationContent",
     OfEmbeddedDataSpecification::kDataSpecificationContent
+  },
+  {
+    "dataSpecification",
+    OfEmbeddedDataSpecification::kDataSpecification
   }
 };
 
@@ -31505,10 +31505,12 @@ std::pair<
 
   // region Initialization
 
-  common::optional<std::shared_ptr<types::IReference> > the_data_specification;
-
   common::optional<std::shared_ptr<types::IDataSpecificationContent> > the_data_specification_content;
 
+  common::optional<
+    std::shared_ptr<types::IReference>
+  > the_data_specification;
+
   // endregion Initialization
 
   while (true) {
@@ -31586,6 +31588,12 @@ std::pair<
     );
 
     switch (property) {
+      case properties::OfEmbeddedDataSpecification::kDataSpecificationContent:
+        std::tie(
+          the_data_specification_content,
+          error
+        ) = DataSpecificationContentFromElement(reader);
+        break;
       case properties::OfEmbeddedDataSpecification::kDataSpecification:
         std::tie(
           the_data_specification,
@@ -31594,12 +31602,6 @@ std::pair<
           types::IReference
         >(reader);
         break;
-      case properties::OfEmbeddedDataSpecification::kDataSpecificationContent:
-        std::tie(
-          the_data_specification_content,
-          error
-        ) = DataSpecificationContentFromElement(reader);
-        break;
       default:
         throw std::logic_error(
           common::Concat(
@@ -31684,14 +31686,6 @@ std::pair<
 
   // region Check required properties
 
-  if (!the_data_specification.has_value()) {
-    return NoInstanceAndDeserializationErrorWithCause<
-      std::shared_ptr<T>
-    >(
-      L"The required property dataSpecification is missing"
-    );
-  }
-
   if (!the_data_specification_content.has_value()) {
     return NoInstanceAndDeserializationErrorWithCause<
       std::shared_ptr<T>
@@ -31710,8 +31704,8 @@ std::pair<
       // We deliberately do not use std::make_shared here to avoid an unnecessary
       // upcast.
       new types::EmbeddedDataSpecification(
-        std::move(*the_data_specification),
-        std::move(*the_data_specification_content)
+        std::move(*the_data_specification_content),
+        std::move(the_data_specification)
       )
     ),
     common::nullopt
@@ -53744,43 +53738,6 @@ common::optional<SerializationError> SerializeEmbeddedDataSpecificationAsSequenc
 ) {
   common::optional<SerializationError> error;
 
-  const std::shared_ptr<types::IReference>& the_data_specification(
-    that.data_specification()
-  );
-  writer.StartElement(
-    "dataSpecification"
-  );
-  if (writer.error().has_value()) {
-    return writer.move_error();
-  }
-  error = SerializeReferenceAsSequence(
-    *the_data_specification,
-    writer
-  );
-  if (error.has_value()) {
-    error->path.segments.emplace_front(
-      common::make_unique<iteration::PropertySegment>(
-        iteration::Property::kDataSpecification
-      )
-    );
-
-    return error;
-  }
-  writer.StopElement(
-    "dataSpecification"
-  );
-  if (writer.error().has_value()) {
-    error = writer.move_error();
-
-    error->path.segments.emplace_front(
-      common::make_unique<iteration::PropertySegment>(
-        iteration::Property::kDataSpecification
-      )
-    );
-
-    return error;
-  }
-
   const std::shared_ptr<types::IDataSpecificationContent>& the_data_specification_content(
     that.data_specification_content()
   );
@@ -53818,6 +53775,48 @@ common::optional<SerializationError> SerializeEmbeddedDataSpecificationAsSequenc
     return error;
   }
 
+  const auto& maybe_data_specification(
+    that.data_specification()
+  );
+  if (maybe_data_specification.has_value()) {
+    const std::shared_ptr<types::IReference>& the_data_specification(
+      *maybe_data_specification
+    );
+    writer.StartElement(
+      "dataSpecification"
+    );
+    if (writer.error().has_value()) {
+      return writer.move_error();
+    }
+    error = SerializeReferenceAsSequence(
+      *the_data_specification,
+      writer
+    );
+    if (error.has_value()) {
+      error->path.segments.emplace_front(
+        common::make_unique<iteration::PropertySegment>(
+          iteration::Property::kDataSpecification
+        )
+      );
+
+      return error;
+    }
+    writer.StopElement(
+      "dataSpecification"
+    );
+    if (writer.error().has_value()) {
+      error = writer.move_error();
+
+      error->path.segments.emplace_front(
+        common::make_unique<iteration::PropertySegment>(
+          iteration::Property::kDataSpecification
+        )
+      );
+
+      return error;
+    }
+  }
+
   writer.Finish();
   if (writer.error().has_value()) {
     return writer.move_error();
diff --git a/test_data/csharp/test_main/aas_core_meta.v3/expected_output/copying.cs b/test_data/csharp/test_main/aas_core_meta.v3/expected_output/copying.cs
index 287556e49..c2fed0e44 100644
--- a/test_data/csharp/test_main/aas_core_meta.v3/expected_output/copying.cs
+++ b/test_data/csharp/test_main/aas_core_meta.v3/expected_output/copying.cs
@@ -502,8 +502,8 @@ Aas.IEmbeddedDataSpecification that
             )
             {
                 return new Aas.EmbeddedDataSpecification(
-                    that.DataSpecification,
-                    that.DataSpecificationContent);
+                    that.DataSpecificationContent,
+                    that.DataSpecification);
             }
 
             public override Aas.IClass TransformLevelType(
@@ -2456,8 +2456,10 @@ Aas.IEmbeddedDataSpecification that
             )
             {
                 return new Aas.EmbeddedDataSpecification(
-                    Deep(that.DataSpecification),
-                    Deep(that.DataSpecificationContent)
+                    Deep(that.DataSpecificationContent),
+                    (that.DataSpecification != null)
+                        ? Deep(that.DataSpecification)
+                        : null
                 );
             }
 
diff --git a/test_data/csharp/test_main/aas_core_meta.v3/expected_output/enhancing.cs b/test_data/csharp/test_main/aas_core_meta.v3/expected_output/enhancing.cs
index 62f2630f5..34c63df18 100644
--- a/test_data/csharp/test_main/aas_core_meta.v3/expected_output/enhancing.cs
+++ b/test_data/csharp/test_main/aas_core_meta.v3/expected_output/enhancing.cs
@@ -3713,18 +3713,18 @@ TEnhancement enhancement
                 _instance = instance;
             }
 
-            public IReference DataSpecification
-            {
-                get => _instance.DataSpecification;
-                set => _instance.DataSpecification = value;
-            }
-
             public IDataSpecificationContent DataSpecificationContent
             {
                 get => _instance.DataSpecificationContent;
                 set => _instance.DataSpecificationContent = value;
             }
 
+            public IReference? DataSpecification
+            {
+                get => _instance.DataSpecification;
+                set => _instance.DataSpecification = value;
+            }
+
             public IEnumerable<Aas.IClass> DescendOnce()
             {
                 return _instance.DescendOnce();
@@ -7649,17 +7649,6 @@ Aas.IEmbeddedDataSpecification that
                     );
                 }
 
-                var transformedDataSpecification = Transform(
-                    that.DataSpecification
-                );
-                var castedDataSpecification = (
-                    transformedDataSpecification as Aas.IReference
-                ) ?? throw new System.InvalidOperationException(
-                    "Expected the transformed value to be a IReference, " +
-                    $"but got: {transformedDataSpecification}"
-                );
-                that.DataSpecification = castedDataSpecification;
-
                 var transformedDataSpecificationContent = Transform(
                     that.DataSpecificationContent
                 );
@@ -7671,6 +7660,20 @@ transformedDataSpecificationContent as Aas.IDataSpecificationContent
                 );
                 that.DataSpecificationContent = castedDataSpecificationContent;
 
+                if (that.DataSpecification != null)
+                {
+                    var transformedDataSpecification = Transform(
+                        that.DataSpecification
+                    );
+                    var castedDataSpecification = (
+                        transformedDataSpecification as Aas.IReference
+                    ) ?? throw new System.InvalidOperationException(
+                        "Expected the transformed value to be a IReference, " +
+                        $"but got: {transformedDataSpecification}"
+                    );
+                    that.DataSpecification = castedDataSpecification;
+                }
+
                 var enhancement = _enhancementFactory(that);
                 return (enhancement == null)
                     ? that
diff --git a/test_data/csharp/test_main/aas_core_meta.v3/expected_output/jsonization.cs b/test_data/csharp/test_main/aas_core_meta.v3/expected_output/jsonization.cs
index ad3320e9d..83cc986a6 100644
--- a/test_data/csharp/test_main/aas_core_meta.v3/expected_output/jsonization.cs
+++ b/test_data/csharp/test_main/aas_core_meta.v3/expected_output/jsonization.cs
@@ -13160,58 +13160,58 @@ internal static class DeserializeImplementation
                     return null;
                 }
 
-                IReference? theDataSpecification = null;
                 IDataSpecificationContent? theDataSpecificationContent = null;
+                IReference? theDataSpecification = null;
 
                 foreach (var keyValue in obj)
                 {
                     switch (keyValue.Key)
                     {
-                        case "dataSpecification":
+                        case "dataSpecificationContent":
                         {
                             if (keyValue.Value == null)
                             {
                                 continue;
                             }
 
-                            theDataSpecification = DeserializeImplementation.ReferenceFrom(
+                            theDataSpecificationContent = DeserializeImplementation.IDataSpecificationContentFrom(
                                 keyValue.Value,
                                 out error);
                             if (error != null)
                             {
                                 error.PrependSegment(
                                     new Reporting.NameSegment(
-                                        "dataSpecification"));
+                                        "dataSpecificationContent"));
                                 return null;
                             }
-                            if (theDataSpecification == null)
+                            if (theDataSpecificationContent == null)
                             {
                                 throw new System.InvalidOperationException(
-                                    "Unexpected theDataSpecification null when error is also null");
+                                    "Unexpected theDataSpecificationContent null when error is also null");
                             }
                             break;
                         }
-                        case "dataSpecificationContent":
+                        case "dataSpecification":
                         {
                             if (keyValue.Value == null)
                             {
                                 continue;
                             }
 
-                            theDataSpecificationContent = DeserializeImplementation.IDataSpecificationContentFrom(
+                            theDataSpecification = DeserializeImplementation.ReferenceFrom(
                                 keyValue.Value,
                                 out error);
                             if (error != null)
                             {
                                 error.PrependSegment(
                                     new Reporting.NameSegment(
-                                        "dataSpecificationContent"));
+                                        "dataSpecification"));
                                 return null;
                             }
-                            if (theDataSpecificationContent == null)
+                            if (theDataSpecification == null)
                             {
                                 throw new System.InvalidOperationException(
-                                    "Unexpected theDataSpecificationContent null when error is also null");
+                                    "Unexpected theDataSpecification null when error is also null");
                             }
                             break;
                         }
@@ -13222,13 +13222,6 @@ internal static class DeserializeImplementation
                     }
                 }
 
-                if (theDataSpecification == null)
-                {
-                    error = new Reporting.Error(
-                        "Required property \"dataSpecification\" is missing");
-                    return null;
-                }
-
                 if (theDataSpecificationContent == null)
                 {
                     error = new Reporting.Error(
@@ -13237,12 +13230,10 @@ internal static class DeserializeImplementation
                 }
 
                 return new Aas.EmbeddedDataSpecification(
-                    theDataSpecification
-                         ?? throw new System.InvalidOperationException(
-                            "Unexpected null, had to be handled before"),
                     theDataSpecificationContent
                          ?? throw new System.InvalidOperationException(
-                            "Unexpected null, had to be handled before"));
+                            "Unexpected null, had to be handled before"),
+                    theDataSpecification);
             }  // internal static EmbeddedDataSpecificationFrom
 
             /// <summary>
@@ -18462,12 +18453,15 @@ Aas.IEmbeddedDataSpecification that
             {
                 var result = new Nodes.JsonObject();
 
-                result["dataSpecification"] = Transform(
-                    that.DataSpecification);
-
                 result["dataSpecificationContent"] = Transform(
                     that.DataSpecificationContent);
 
+                if (that.DataSpecification != null)
+                {
+                    result["dataSpecification"] = Transform(
+                        that.DataSpecification);
+                }
+
                 return result;
             }
 
diff --git a/test_data/csharp/test_main/aas_core_meta.v3/expected_output/types.cs b/test_data/csharp/test_main/aas_core_meta.v3/expected_output/types.cs
index 064c2e69c..888fb754e 100644
--- a/test_data/csharp/test_main/aas_core_meta.v3/expected_output/types.cs
+++ b/test_data/csharp/test_main/aas_core_meta.v3/expected_output/types.cs
@@ -11887,14 +11887,14 @@ public interface IDataSpecificationContent : IClass
     public interface IEmbeddedDataSpecification : IClass
     {
         /// <summary>
-        /// Reference to the data specification
+        /// Actual content of the data specification
         /// </summary>
-        public IReference DataSpecification { get; set; }
+        public IDataSpecificationContent DataSpecificationContent { get; set; }
 
         /// <summary>
-        /// Actual content of the data specification
+        /// Reference to the data specification
         /// </summary>
-        public IDataSpecificationContent DataSpecificationContent { get; set; }
+        public IReference? DataSpecification { get; set; }
     }
 
     /// <summary>
@@ -11903,14 +11903,14 @@ public interface IEmbeddedDataSpecification : IClass
     public class EmbeddedDataSpecification : IEmbeddedDataSpecification
     {
         /// <summary>
-        /// Reference to the data specification
+        /// Actual content of the data specification
         /// </summary>
-        public IReference DataSpecification { get; set; }
+        public IDataSpecificationContent DataSpecificationContent { get; set; }
 
         /// <summary>
-        /// Actual content of the data specification
+        /// Reference to the data specification
         /// </summary>
-        public IDataSpecificationContent DataSpecificationContent { get; set; }
+        public IReference? DataSpecification { get; set; }
 
         /// <summary>
         /// Iterate over all the class instances referenced from this instance
@@ -11918,9 +11918,12 @@ public class EmbeddedDataSpecification : IEmbeddedDataSpecification
         /// </summary>
         public IEnumerable<IClass> DescendOnce()
         {
-            yield return DataSpecification;
-
             yield return DataSpecificationContent;
+
+            if (DataSpecification != null)
+            {
+                yield return DataSpecification;
+            }
         }
 
         /// <summary>
@@ -11928,20 +11931,23 @@ public IEnumerable<IClass> DescendOnce()
         /// </summary>
         public IEnumerable<IClass> Descend()
         {
-            yield return DataSpecification;
+            yield return DataSpecificationContent;
 
             // Recurse
-            foreach (var anItem in DataSpecification.Descend())
+            foreach (var anItem in DataSpecificationContent.Descend())
             {
                 yield return anItem;
             }
 
-            yield return DataSpecificationContent;
-
-            // Recurse
-            foreach (var anItem in DataSpecificationContent.Descend())
+            if (DataSpecification != null)
             {
-                yield return anItem;
+                yield return DataSpecification;
+
+                // Recurse
+                foreach (var anItem in DataSpecification.Descend())
+                {
+                    yield return anItem;
+                }
             }
         }
 
@@ -11986,11 +11992,11 @@ public T Transform<TContext, T>(
         }
 
         public EmbeddedDataSpecification(
-            IReference dataSpecification,
-            IDataSpecificationContent dataSpecificationContent)
+            IDataSpecificationContent dataSpecificationContent,
+            IReference? dataSpecification = null)
         {
-            DataSpecification = dataSpecification;
             DataSpecificationContent = dataSpecificationContent;
+            DataSpecification = dataSpecification;
         }
     }
 
diff --git a/test_data/csharp/test_main/aas_core_meta.v3/expected_output/verification.cs b/test_data/csharp/test_main/aas_core_meta.v3/expected_output/verification.cs
index 5bc855768..05cc34180 100644
--- a/test_data/csharp/test_main/aas_core_meta.v3/expected_output/verification.cs
+++ b/test_data/csharp/test_main/aas_core_meta.v3/expected_output/verification.cs
@@ -9111,20 +9111,23 @@ Aas.IEnvironment that
                 Aas.IEmbeddedDataSpecification that
             )
             {
-                foreach (var error in Verification.Verify(that.DataSpecification))
+                foreach (var error in Verification.Verify(that.DataSpecificationContent))
                 {
                     error.PrependSegment(
                         new Reporting.NameSegment(
-                            "dataSpecification"));
+                            "dataSpecificationContent"));
                     yield return error;
                 }
 
-                foreach (var error in Verification.Verify(that.DataSpecificationContent))
+                if (that.DataSpecification != null)
                 {
-                    error.PrependSegment(
-                        new Reporting.NameSegment(
-                            "dataSpecificationContent"));
-                    yield return error;
+                    foreach (var error in Verification.Verify(that.DataSpecification))
+                    {
+                        error.PrependSegment(
+                            new Reporting.NameSegment(
+                                "dataSpecification"));
+                        yield return error;
+                    }
                 }
             }
 
diff --git a/test_data/csharp/test_main/aas_core_meta.v3/expected_output/xmlization.cs b/test_data/csharp/test_main/aas_core_meta.v3/expected_output/xmlization.cs
index bc6a2ba19..c343b5d35 100644
--- a/test_data/csharp/test_main/aas_core_meta.v3/expected_output/xmlization.cs
+++ b/test_data/csharp/test_main/aas_core_meta.v3/expected_output/xmlization.cs
@@ -16958,8 +16958,8 @@ out Reporting.Error? error
             {
                 error = null;
 
-                IReference? theDataSpecification = null;
                 IDataSpecificationContent? theDataSpecificationContent = null;
+                IReference? theDataSpecification = null;
 
                 if (!isEmptySequence)
                 {
@@ -17005,20 +17005,6 @@ out Reporting.Error? error
 
                         switch (elementName)
                         {
-                            case "dataSpecification":
-                            {
-                                theDataSpecification = ReferenceFromSequence(
-                                    reader, isEmptyProperty, out error);
-
-                                if (error != null)
-                                {
-                                    error.PrependSegment(
-                                        new Reporting.NameSegment(
-                                            "dataSpecification"));
-                                    return null;
-                                }
-                                break;
-                            }
                             case "dataSpecificationContent":
                             {
                                 if (isEmptyProperty)
@@ -17072,6 +17058,20 @@ out Reporting.Error? error
                                 }
                                 break;
                             }
+                            case "dataSpecification":
+                            {
+                                theDataSpecification = ReferenceFromSequence(
+                                    reader, isEmptyProperty, out error);
+
+                                if (error != null)
+                                {
+                                    error.PrependSegment(
+                                        new Reporting.NameSegment(
+                                            "dataSpecification"));
+                                    return null;
+                                }
+                                break;
+                            }
                             default:
                                 error = new Reporting.Error(
                                     "We expected properties of the class EmbeddedDataSpecification, " +
@@ -17125,14 +17125,6 @@ out Reporting.Error? error
                     }
                 }
 
-                if (theDataSpecification == null)
-                {
-                    error = new Reporting.Error(
-                        "The required property DataSpecification has not been given " +
-                        "in the XML representation of an instance of class EmbeddedDataSpecification");
-                    return null;
-                }
-
                 if (theDataSpecificationContent == null)
                 {
                     error = new Reporting.Error(
@@ -17142,12 +17134,10 @@ out Reporting.Error? error
                 }
 
                 return new Aas.EmbeddedDataSpecification(
-                    theDataSpecification
-                         ?? throw new System.InvalidOperationException(
-                            "Unexpected null, had to be handled before"),
                     theDataSpecificationContent
                          ?? throw new System.InvalidOperationException(
-                            "Unexpected null, had to be handled before"));
+                            "Unexpected null, had to be handled before"),
+                    theDataSpecification);
             }  // internal static Aas.EmbeddedDataSpecification? EmbeddedDataSpecificationFromSequence
 
             /// <summary>
@@ -25822,16 +25812,6 @@ private void EmbeddedDataSpecificationToSequence(
                 Aas.IEmbeddedDataSpecification that,
                 Xml.XmlWriter writer)
             {
-                writer.WriteStartElement(
-                    "dataSpecification",
-                    NS);
-
-                this.ReferenceToSequence(
-                    that.DataSpecification,
-                    writer);
-
-                writer.WriteEndElement();
-
                 writer.WriteStartElement(
                     "dataSpecificationContent",
                     NS);
@@ -25841,6 +25821,19 @@ private void EmbeddedDataSpecificationToSequence(
                     writer);
 
                 writer.WriteEndElement();
+
+                if (that.DataSpecification != null)
+                {
+                    writer.WriteStartElement(
+                        "dataSpecification",
+                        NS);
+
+                    this.ReferenceToSequence(
+                        that.DataSpecification,
+                        writer);
+
+                    writer.WriteEndElement();
+                }
             }  // private void EmbeddedDataSpecificationToSequence
 
             public override void VisitEmbeddedDataSpecification(
diff --git a/test_data/golang/test_main/aas_core_meta.v3/expected_output/enhancing/enhancing.go b/test_data/golang/test_main/aas_core_meta.v3/expected_output/enhancing/enhancing.go
index c2756ed51..aa14ad87f 100644
--- a/test_data/golang/test_main/aas_core_meta.v3/expected_output/enhancing/enhancing.go
+++ b/test_data/golang/test_main/aas_core_meta.v3/expected_output/enhancing/enhancing.go
@@ -6148,17 +6148,6 @@ func (eeds *enhancedEmbeddedDataSpecification[E]) Descend(
 	return eeds.instance.Descend(action)
 }
 
-func (eeds *enhancedEmbeddedDataSpecification[E]) DataSpecification(
-) aastypes.IReference {
-	return eeds.instance.DataSpecification()
-}
-
-func (eeds *enhancedEmbeddedDataSpecification[E]) SetDataSpecification(
-	value aastypes.IReference,
-) {
-	eeds.instance.SetDataSpecification(value)
-}
-
 func (eeds *enhancedEmbeddedDataSpecification[E]) DataSpecificationContent(
 ) aastypes.IDataSpecificationContent {
 	return eeds.instance.DataSpecificationContent()
@@ -6170,6 +6159,17 @@ func (eeds *enhancedEmbeddedDataSpecification[E]) SetDataSpecificationContent(
 	eeds.instance.SetDataSpecificationContent(value)
 }
 
+func (eeds *enhancedEmbeddedDataSpecification[E]) DataSpecification(
+) aastypes.IReference {
+	return eeds.instance.DataSpecification()
+}
+
+func (eeds *enhancedEmbeddedDataSpecification[E]) SetDataSpecification(
+	value aastypes.IReference,
+) {
+	eeds.instance.SetDataSpecification(value)
+}
+
 func (eeds *enhancedEmbeddedDataSpecification[E]) getEnhancement(
 ) E {
 	return eeds.enhancement
@@ -6198,14 +6198,6 @@ func wrapEmbeddedDataSpecification[E any](
 		result = that
 	}
 
-	theDataSpecification := that.DataSpecification()
-	that.SetDataSpecification(
-		Wrap[E](
-			theDataSpecification,
-			factory,
-		).(aastypes.IReference),
-	)
-
 	theDataSpecificationContent := that.DataSpecificationContent()
 	that.SetDataSpecificationContent(
 		Wrap[E](
@@ -6214,6 +6206,16 @@ func wrapEmbeddedDataSpecification[E any](
 		).(aastypes.IDataSpecificationContent),
 	)
 
+	theDataSpecification := that.DataSpecification()
+	if theDataSpecification != nil {
+		that.SetDataSpecification(
+			Wrap[E](
+				theDataSpecification,
+				factory,
+			).(aastypes.IReference),
+		)
+	}
+
 	return
 }
 
diff --git a/test_data/golang/test_main/aas_core_meta.v3/expected_output/jsonization/jsonization.go b/test_data/golang/test_main/aas_core_meta.v3/expected_output/jsonization/jsonization.go
index e0d9231af..a7bc0701d 100644
--- a/test_data/golang/test_main/aas_core_meta.v3/expected_output/jsonization/jsonization.go
+++ b/test_data/golang/test_main/aas_core_meta.v3/expected_output/jsonization/jsonization.go
@@ -11692,41 +11692,39 @@ func embeddedDataSpecificationFromMapWithoutDispatch(
 	result aastypes.IEmbeddedDataSpecification,
 	err *DeserializationError,
 ) {
-	var theDataSpecification aastypes.IReference
 	var theDataSpecificationContent aastypes.IDataSpecificationContent
+	var theDataSpecification aastypes.IReference
 
-	foundDataSpecification := false
 	foundDataSpecificationContent := false
 
 	for k, v := range m {
 		switch k {
-		case "dataSpecification":
-			theDataSpecification, err = ReferenceFromJsonable(
+		case "dataSpecificationContent":
+			theDataSpecificationContent, err = DataSpecificationContentFromJsonable(
 				v,
 			)
 			if err != nil {
 				err.Path.PrependName(
 					&aasreporting.NameSegment{
-						Name: "dataSpecification",
+						Name: "dataSpecificationContent",
 					},
 				)
 				return
 			}
-			foundDataSpecification = true
+			foundDataSpecificationContent = true
 
-		case "dataSpecificationContent":
-			theDataSpecificationContent, err = DataSpecificationContentFromJsonable(
+		case "dataSpecification":
+			theDataSpecification, err = ReferenceFromJsonable(
 				v,
 			)
 			if err != nil {
 				err.Path.PrependName(
 					&aasreporting.NameSegment{
-						Name: "dataSpecificationContent",
+						Name: "dataSpecification",
 					},
 				)
 				return
 			}
-			foundDataSpecificationContent = true
 
 		default:
 			err = newDeserializationError(
@@ -11739,13 +11737,6 @@ func embeddedDataSpecificationFromMapWithoutDispatch(
 		}
 	}
 
-	if !foundDataSpecification {
-		err = newDeserializationError(
-			"The required property 'dataSpecification' is missing",
-		)
-		return
-	}
-
 	if !foundDataSpecificationContent {
 		err = newDeserializationError(
 			"The required property 'dataSpecificationContent' is missing",
@@ -11754,9 +11745,11 @@ func embeddedDataSpecificationFromMapWithoutDispatch(
 	}
 
 	result = aastypes.NewEmbeddedDataSpecification(
-		theDataSpecification,
 		theDataSpecificationContent,
 	)
+	result.SetDataSpecification(
+		theDataSpecification,
+	)
 
 	return
 }
@@ -19308,21 +19301,6 @@ func embeddedDataSpecificationToMap(
 ) (result map[string]interface{}, err *SerializationError) {
 	result = make(map[string]interface{})
 
-	var jsonableDataSpecification interface{}
-	jsonableDataSpecification, err = ToJsonable(
-		that.DataSpecification(),
-	)
-	if err != nil {
-		err.Path.PrependName(
-			&aasreporting.NameSegment{
-				Name: "DataSpecification()",
-			},
-		)
-
-		return
-	}
-	result["dataSpecification"] = jsonableDataSpecification
-
 	var jsonableDataSpecificationContent interface{}
 	jsonableDataSpecificationContent, err = ToJsonable(
 		that.DataSpecificationContent(),
@@ -19338,6 +19316,23 @@ func embeddedDataSpecificationToMap(
 	}
 	result["dataSpecificationContent"] = jsonableDataSpecificationContent
 
+	if that.DataSpecification() != nil {
+		var jsonableDataSpecification interface{}
+		jsonableDataSpecification, err = ToJsonable(
+			that.DataSpecification(),
+		)
+		if err != nil {
+			err.Path.PrependName(
+				&aasreporting.NameSegment{
+					Name: "DataSpecification()",
+				},
+			)
+
+			return
+		}
+		result["dataSpecification"] = jsonableDataSpecification
+	}
+
 	return
 }
 
diff --git a/test_data/golang/test_main/aas_core_meta.v3/expected_output/types/types.go b/test_data/golang/test_main/aas_core_meta.v3/expected_output/types/types.go
index dec9d69c3..430ef01d9 100644
--- a/test_data/golang/test_main/aas_core_meta.v3/expected_output/types/types.go
+++ b/test_data/golang/test_main/aas_core_meta.v3/expected_output/types/types.go
@@ -11426,19 +11426,19 @@ func IsDataSpecificationContent(
 type IEmbeddedDataSpecification interface {
 	IClass
 
-	// Reference to the data specification
-	DataSpecification() IReference;
-
-	SetDataSpecification(
-		value IReference,
-	);
-
 	// Actual content of the data specification
 	DataSpecificationContent() IDataSpecificationContent;
 
 	SetDataSpecificationContent(
 		value IDataSpecificationContent,
 	);
+
+	// Reference to the data specification
+	DataSpecification() IReference;
+
+	SetDataSpecification(
+		value IReference,
+	);
 }
 
 // Check whether the instance corresponds to [aastypes.IEmbeddedDataSpecification]
@@ -11455,19 +11455,8 @@ func IsEmbeddedDataSpecification(
 
 // Implements IEmbeddedDataSpecification.
 type EmbeddedDataSpecification struct {
-	dataSpecification IReference
 	dataSpecificationContent IDataSpecificationContent
-}
-
-func (eds *EmbeddedDataSpecification) DataSpecification(
-) IReference {
-	return eds.dataSpecification
-}
-
-func (eds *EmbeddedDataSpecification) SetDataSpecification(
-	value IReference,
-) {
-	eds.dataSpecification = value
+	dataSpecification IReference
 }
 
 func (eds *EmbeddedDataSpecification) DataSpecificationContent(
@@ -11481,6 +11470,17 @@ func (eds *EmbeddedDataSpecification) SetDataSpecificationContent(
 	eds.dataSpecificationContent = value
 }
 
+func (eds *EmbeddedDataSpecification) DataSpecification(
+) IReference {
+	return eds.dataSpecification
+}
+
+func (eds *EmbeddedDataSpecification) SetDataSpecification(
+	value IReference,
+) {
+	eds.dataSpecification = value
+}
+
 func (eds *EmbeddedDataSpecification) ModelType(
 ) ModelType {
 	return ModelTypeEmbeddedDataSpecification
@@ -11498,17 +11498,19 @@ func (eds *EmbeddedDataSpecification) DescendOnce(
 	action func(IClass) bool,
 ) (abort bool) {
 	abort = action(
-		eds.dataSpecification,
+		eds.dataSpecificationContent,
 	)
 	if abort {
 		return
 	}
 
-	abort = action(
-		eds.dataSpecificationContent,
-	)
-	if abort {
-		return
+	if eds.dataSpecification != nil {
+		abort = action(
+			eds.dataSpecification,
+		)
+		if abort {
+			return
+		}
 	}
 
 	return
@@ -11523,19 +11525,6 @@ func (eds *EmbeddedDataSpecification) DescendOnce(
 func (eds *EmbeddedDataSpecification) Descend(
 	action func(IClass) bool,
 ) (abort bool) {
-	abort = action(
-		eds.dataSpecification,
-	)
-	if abort {
-		return
-	}
-	abort = eds.dataSpecification.Descend(
-		action,
-	)
-	if abort {
-		return
-	}
-
 	abort = action(
 		eds.dataSpecificationContent,
 	)
@@ -11549,18 +11538,32 @@ func (eds *EmbeddedDataSpecification) Descend(
 		return
 	}
 
+	if eds.dataSpecification != nil {
+		abort = action(
+			eds.dataSpecification,
+		)
+		if abort {
+			return
+		}
+		abort = eds.dataSpecification.Descend(
+			action,
+		)
+		if abort {
+			return
+		}
+	}
+
 	return
 }
 
 // Create a new instance of EmbeddedDataSpecification with
 // the given properties.
 func NewEmbeddedDataSpecification(
-	dataSpecification IReference,
 	dataSpecificationContent IDataSpecificationContent,
 ) *EmbeddedDataSpecification {
 	return &EmbeddedDataSpecification{
-		dataSpecification: dataSpecification,
 		dataSpecificationContent: dataSpecificationContent,
+		dataSpecification: nil,
 	}
 }
 
diff --git a/test_data/golang/test_main/aas_core_meta.v3/expected_output/verification/verification.go b/test_data/golang/test_main/aas_core_meta.v3/expected_output/verification/verification.go
index 6055a5fc9..aa61899ff 100644
--- a/test_data/golang/test_main/aas_core_meta.v3/expected_output/verification/verification.go
+++ b/test_data/golang/test_main/aas_core_meta.v3/expected_output/verification/verification.go
@@ -12325,10 +12325,10 @@ func VerifyEmbeddedDataSpecification(
 ) (abort bool) {
 	abort = false
 
-	if that.DataSpecification() == nil {
+	if that.DataSpecificationContent() == nil {
 		abort = onError(
 			newVerificationError(
-				"Required property not set: DataSpecification",
+				"Required property not set: DataSpecificationContent",
 			),
 		)
 		if abort {
@@ -12336,11 +12336,11 @@ func VerifyEmbeddedDataSpecification(
 		}
 	} else {
 		abort = Verify(
-			that.DataSpecification(),
+			that.DataSpecificationContent(),
 			func(err *VerificationError) bool {
 				err.Path.PrependName(
 					&aasreporting.NameSegment{
-						Name: "DataSpecification",
+						Name: "DataSpecificationContent",
 					},
 				)
 				return onError(err)
@@ -12351,22 +12351,13 @@ func VerifyEmbeddedDataSpecification(
 		}
 	}
 
-	if that.DataSpecificationContent() == nil {
-		abort = onError(
-			newVerificationError(
-				"Required property not set: DataSpecificationContent",
-			),
-		)
-		if abort {
-			return
-		}
-	} else {
+	if that.DataSpecification() != nil {
 		abort = Verify(
-			that.DataSpecificationContent(),
+			that.DataSpecification(),
 			func(err *VerificationError) bool {
 				err.Path.PrependName(
 					&aasreporting.NameSegment{
-						Name: "DataSpecificationContent",
+						Name: "DataSpecification",
 					},
 				)
 				return onError(err)
diff --git a/test_data/golang/test_main/aas_core_meta.v3/expected_output/xmlization/xmlization.go b/test_data/golang/test_main/aas_core_meta.v3/expected_output/xmlization/xmlization.go
index dbaee46e5..85a14bb66 100644
--- a/test_data/golang/test_main/aas_core_meta.v3/expected_output/xmlization/xmlization.go
+++ b/test_data/golang/test_main/aas_core_meta.v3/expected_output/xmlization/xmlization.go
@@ -10755,10 +10755,9 @@ func readEmbeddedDataSpecificationAsSequence(
 	next xml.Token,
 	err error,
 ) {
-	var theDataSpecification aastypes.IReference
 	var theDataSpecificationContent aastypes.IDataSpecificationContent
+	var theDataSpecification aastypes.IReference
 
-	foundDataSpecification := false
 	foundDataSpecificationContent := false
 
 	for {
@@ -10801,13 +10800,6 @@ func readEmbeddedDataSpecificationAsSequence(
 
 		var valueErr error
 		switch local {
-		case "dataSpecification":
-			theDataSpecification, current, valueErr =  readReferenceAsSequence(
-				decoder,
-				current,
-			)
-			foundDataSpecification = true
-
 		case "dataSpecificationContent":
 			theDataSpecificationContent, valueErr =  unmarshalDataSpecificationContent(
 				decoder,
@@ -10819,6 +10811,12 @@ func readEmbeddedDataSpecificationAsSequence(
 			}
 			foundDataSpecificationContent = true
 
+		case "dataSpecification":
+			theDataSpecification, current, valueErr =  readReferenceAsSequence(
+				decoder,
+				current,
+			)
+
 		default:
 			valueErr = newDeserializationError(
 				fmt.Sprintf(
@@ -10863,13 +10861,6 @@ func readEmbeddedDataSpecificationAsSequence(
 
 	next = current
 
-	if !foundDataSpecification {
-		err = newDeserializationError(
-			"The required property 'dataSpecification' is missing",
-		)
-		return
-	}
-
 	if !foundDataSpecificationContent {
 		err = newDeserializationError(
 			"The required property 'dataSpecificationContent' is missing",
@@ -10878,9 +10869,11 @@ func readEmbeddedDataSpecificationAsSequence(
 	}
 
 	instance = aastypes.NewEmbeddedDataSpecification(
-		theDataSpecification,
 		theDataSpecificationContent,
 	)
+	instance.SetDataSpecification(
+		theDataSpecification,
+	)
 	return
 }
 
@@ -22955,25 +22948,26 @@ func writeEmbeddedDataSpecificationAsSequence(
 	encoder *xml.Encoder,
 	that aastypes.IEmbeddedDataSpecification,
 ) (err error) {
-	// region DataSpecification
+	// region DataSpecificationContent
 
 	err = writeStartElement(
 		encoder,
-		"dataSpecification",
-		false,
+		"dataSpecificationContent",
+	false,
 	)
 	if err != nil {
 		return
 	}
-	err = writeReferenceAsSequence(
+	err = Marshal(
 		encoder,
-		that.DataSpecification(),
+		that.DataSpecificationContent(),
+		false,
 	)
 	if err != nil {
 		if seriaErr, ok := err.(*SerializationError); ok {
 			seriaErr.Path.PrependName(
 				&aasreporting.NameSegment{
-					Name: "DataSpecification()",
+					Name: "DataSpecificationContent()",
 				},
 			)
 		}
@@ -22981,8 +22975,8 @@ func writeEmbeddedDataSpecificationAsSequence(
 	}
 	err = writeEndElement(
 		encoder,
-		"dataSpecification",
-		false,
+		"dataSpecificationContent",
+	false,
 	)
 	if err != nil {
 		return
@@ -22995,38 +22989,41 @@ func writeEmbeddedDataSpecificationAsSequence(
 
 	// endregion
 
-	// region DataSpecificationContent
+	// region DataSpecification
 
-	err = writeStartElement(
-		encoder,
-		"dataSpecificationContent",
-	false,
-	)
-	if err != nil {
-		return
-	}
-	err = Marshal(
-		encoder,
-		that.DataSpecificationContent(),
-		false,
-	)
-	if err != nil {
-		if seriaErr, ok := err.(*SerializationError); ok {
-			seriaErr.Path.PrependName(
-				&aasreporting.NameSegment{
-					Name: "DataSpecificationContent()",
-				},
-			)
+	theDataSpecification := that.DataSpecification()
+
+	if theDataSpecification != nil {
+		err = writeStartElement(
+			encoder,
+			"dataSpecification",
+			false,
+		)
+		if err != nil {
+			return
+		}
+		err = writeReferenceAsSequence(
+			encoder,
+			theDataSpecification,
+		)
+		if err != nil {
+			if seriaErr, ok := err.(*SerializationError); ok {
+				seriaErr.Path.PrependName(
+					&aasreporting.NameSegment{
+						Name: "DataSpecification()",
+					},
+				)
+			}
+			return
+		}
+		err = writeEndElement(
+			encoder,
+			"dataSpecification",
+			false,
+		)
+		if err != nil {
+			return
 		}
-		return
-	}
-	err = writeEndElement(
-		encoder,
-		"dataSpecificationContent",
-	false,
-	)
-	if err != nil {
-		return
 	}
 
 	err = encoder.Flush()
diff --git a/test_data/intermediate/real_meta_models/aas_core_meta.v3/expected_symbol_table.txt b/test_data/intermediate/real_meta_models/aas_core_meta.v3/expected_symbol_table.txt
index 6d179fcaa..0c5e4b3da 100644
--- a/test_data/intermediate/real_meta_models/aas_core_meta.v3/expected_symbol_table.txt
+++ b/test_data/intermediate/real_meta_models/aas_core_meta.v3/expected_symbol_table.txt
@@ -25625,24 +25625,26 @@ SymbolTable(
       concrete_descendants=[],
       properties=[
         Property(
-          name='data_specification',
+          name='data_specification_content',
           type_annotation=OurTypeAnnotation(
-            our_type='Reference to our type Reference',
+            our_type='Reference to our type Data_specification_content',
             parsed=...),
           description=DescriptionOfProperty(
-            summary='<paragraph>Reference to the data specification</paragraph>',
+            summary='<paragraph>Actual content of the data specification</paragraph>',
             remarks=[],
             constraints_by_identifier=[],
             parsed=...),
           specified_for='Reference to ConcreteClass Embedded_data_specification',
           parsed=...),
         Property(
-          name='data_specification_content',
-          type_annotation=OurTypeAnnotation(
-            our_type='Reference to our type Data_specification_content',
+          name='data_specification',
+          type_annotation=OptionalTypeAnnotation(
+            value=OurTypeAnnotation(
+              our_type='Reference to our type Reference',
+              parsed=...),
             parsed=...),
           description=DescriptionOfProperty(
-            summary='<paragraph>Actual content of the data specification</paragraph>',
+            summary='<paragraph>Reference to the data specification</paragraph>',
             remarks=[],
             constraints_by_identifier=[],
             parsed=...),
@@ -25653,18 +25655,22 @@ SymbolTable(
         name='__init__',
         arguments=[
           Argument(
-            name='data_specification',
+            name='data_specification_content',
             type_annotation=OurTypeAnnotation(
-              our_type='Reference to our type Reference',
+              our_type='Reference to our type Data_specification_content',
               parsed=...),
             default=None,
             parsed=...),
           Argument(
-            name='data_specification_content',
-            type_annotation=OurTypeAnnotation(
-              our_type='Reference to our type Data_specification_content',
+            name='data_specification',
+            type_annotation=OptionalTypeAnnotation(
+              value=OurTypeAnnotation(
+                our_type='Reference to our type Reference',
+                parsed=...),
+              parsed=...),
+            default=DefaultPrimitive(
+              value=None,
               parsed=...),
-            default=None,
             parsed=...)],
         returns=None,
         description=None,
@@ -25676,26 +25682,26 @@ SymbolTable(
         arguments_by_name=...,
         is_implementation_specific=False,
         statements=[
-          textwrap.dedent("""\
-            AssignArgument(
-              name='data_specification',
-              argument='data_specification',
-              default=None)"""),
           textwrap.dedent("""\
             AssignArgument(
               name='data_specification_content',
               argument='data_specification_content',
-              default=None)""")],
-        inlined_statements=[
+              default=None)"""),
           textwrap.dedent("""\
             AssignArgument(
               name='data_specification',
               argument='data_specification',
-              default=None)"""),
+              default=None)""")],
+        inlined_statements=[
           textwrap.dedent("""\
             AssignArgument(
               name='data_specification_content',
               argument='data_specification_content',
+              default=None)"""),
+          textwrap.dedent("""\
+            AssignArgument(
+              name='data_specification',
+              argument='data_specification',
               default=None)""")]),
       invariants=[],
       serialization=Serialization(
diff --git a/test_data/java/test_main/aas_core_meta.v3/expected_output/copying/Copying.java b/test_data/java/test_main/aas_core_meta.v3/expected_output/copying/Copying.java
index 347dc69e1..cf7259461 100644
--- a/test_data/java/test_main/aas_core_meta.v3/expected_output/copying/Copying.java
+++ b/test_data/java/test_main/aas_core_meta.v3/expected_output/copying/Copying.java
@@ -506,8 +506,8 @@ public IClass transformEmbeddedDataSpecification(
             IEmbeddedDataSpecification that
         ) {
             return new EmbeddedDataSpecification(
-                that.getDataSpecification(),
-                that.getDataSpecificationContent());
+                that.getDataSpecificationContent(),
+                that.getDataSpecification().orElse(null));
         }
 
         @Override
@@ -2512,8 +2512,8 @@ public IClass transformEmbeddedDataSpecification (
             IEmbeddedDataSpecification that
         ) {
             return new EmbeddedDataSpecification(
-                deep(that.getDataSpecification()),
-                deep(that.getDataSpecificationContent())
+                deep(that.getDataSpecificationContent()),
+                that.getDataSpecification().orElse(null)
             );
         }
 
diff --git a/test_data/java/test_main/aas_core_meta.v3/expected_output/enhancing/EnhancedEmbeddedDataSpecification.java b/test_data/java/test_main/aas_core_meta.v3/expected_output/enhancing/EnhancedEmbeddedDataSpecification.java
index d2b8ca1cb..564dc612c 100644
--- a/test_data/java/test_main/aas_core_meta.v3/expected_output/enhancing/EnhancedEmbeddedDataSpecification.java
+++ b/test_data/java/test_main/aas_core_meta.v3/expected_output/enhancing/EnhancedEmbeddedDataSpecification.java
@@ -30,23 +30,23 @@ public EnhancedEmbeddedDataSpecification(
   }
 
   @Override
-  public IReference getDataSpecification() {
-    return instance.getDataSpecification();
+  public IDataSpecificationContent getDataSpecificationContent() {
+    return instance.getDataSpecificationContent();
   }
 
   @Override
-  public void setDataSpecification(IReference dataSpecification) {
-    instance.setDataSpecification(dataSpecification);
+  public void setDataSpecificationContent(IDataSpecificationContent dataSpecificationContent) {
+    instance.setDataSpecificationContent(dataSpecificationContent);
   }
 
   @Override
-  public IDataSpecificationContent getDataSpecificationContent() {
-    return instance.getDataSpecificationContent();
+  public Optional<IReference> getDataSpecification() {
+    return instance.getDataSpecification();
   }
 
   @Override
-  public void setDataSpecificationContent(IDataSpecificationContent dataSpecificationContent) {
-    instance.setDataSpecificationContent(dataSpecificationContent);
+  public void setDataSpecification(IReference dataSpecification) {
+    instance.setDataSpecification(dataSpecification);
   }
 
   public Iterable<IClass> descendOnce() {
diff --git a/test_data/java/test_main/aas_core_meta.v3/expected_output/enhancing/Wrapper.java b/test_data/java/test_main/aas_core_meta.v3/expected_output/enhancing/Wrapper.java
index 478350f2b..986da172c 100644
--- a/test_data/java/test_main/aas_core_meta.v3/expected_output/enhancing/Wrapper.java
+++ b/test_data/java/test_main/aas_core_meta.v3/expected_output/enhancing/Wrapper.java
@@ -3105,17 +3105,6 @@ public IClass transformEmbeddedDataSpecification(
       );
     }
 
-    IReference dataSpecification = that.getDataSpecification();
-    IClass transformedDataSpecification = transform(dataSpecification);
-    if (!(transformedDataSpecification instanceof IReference)) {
-      throw new UnsupportedOperationException(
-        "Expected the transformed value to be a IReference " +
-        ", but got: " + transformedDataSpecification
-      );
-    }
-    IReference castedDataSpecification = (IReference) transformedDataSpecification;
-    that.setDataSpecification(castedDataSpecification);
-
     IDataSpecificationContent dataSpecificationContent = that.getDataSpecificationContent();
     IClass transformedDataSpecificationContent = transform(dataSpecificationContent);
     if (!(transformedDataSpecificationContent instanceof IDataSpecificationContent)) {
@@ -3127,6 +3116,19 @@ public IClass transformEmbeddedDataSpecification(
     IDataSpecificationContent castedDataSpecificationContent = (IDataSpecificationContent) transformedDataSpecificationContent;
     that.setDataSpecificationContent(castedDataSpecificationContent);
 
+    if (that.getDataSpecification().isPresent()) {
+      IReference dataSpecification = that.getDataSpecification().get();
+      IClass transformedDataSpecification = transform(dataSpecification);
+      if (!(transformedDataSpecification instanceof IReference)) {
+        throw new UnsupportedOperationException(
+          "Expected the transformed value to be a IReference " +
+          ", but got: " + transformedDataSpecification
+        );
+      }
+      IReference castedDataSpecification = (IReference) transformedDataSpecification;
+      that.setDataSpecification(castedDataSpecification);
+    }
+
     Optional<EnhancementT> enhancement = enhancementFactory.apply(that);
     return !enhancement.isPresent()
       ? that
diff --git a/test_data/java/test_main/aas_core_meta.v3/expected_output/generation/EmbeddedDataSpecificationBuilder.java b/test_data/java/test_main/aas_core_meta.v3/expected_output/generation/EmbeddedDataSpecificationBuilder.java
new file mode 100644
index 000000000..b44baa6ec
--- /dev/null
+++ b/test_data/java/test_main/aas_core_meta.v3/expected_output/generation/EmbeddedDataSpecificationBuilder.java
@@ -0,0 +1,40 @@
+package aas_core.aas3_0.generation;
+
+import aas_core.aas3_0.types.enums.*;
+import aas_core.aas3_0.types.impl.*;
+import aas_core.aas3_0.types.model.*;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+
+/**
+ * Builder for the EmbeddedDataSpecification type.
+ */
+public class EmbeddedDataSpecificationBuilder {
+  /**
+   * Actual content of the data specification
+   */
+  private IDataSpecificationContent dataSpecificationContent;
+
+  /**
+   * Reference to the data specification
+   */
+  private IReference dataSpecification;
+
+  public EmbeddedDataSpecificationBuilder(IDataSpecificationContent dataSpecificationContent) {
+    this.dataSpecificationContent = Objects.requireNonNull(
+      dataSpecificationContent,
+      "Argument \"dataSpecificationContent\" must be non-null.");
+  }
+
+  public EmbeddedDataSpecificationBuilder setDataspecification(IReference dataSpecification) {
+    this.dataSpecification = dataSpecification;
+    return this;
+  }
+
+  public EmbeddedDataSpecification build() {
+    return new EmbeddedDataSpecification(
+      this.dataSpecificationContent,
+      this.dataSpecification);
+  }
+}
diff --git a/test_data/java/test_main/aas_core_meta.v3/expected_output/jsonization/Jsonization.java b/test_data/java/test_main/aas_core_meta.v3/expected_output/jsonization/Jsonization.java
index c1e51d40f..fabee710d 100644
--- a/test_data/java/test_main/aas_core_meta.v3/expected_output/jsonization/Jsonization.java
+++ b/test_data/java/test_main/aas_core_meta.v3/expected_output/jsonization/Jsonization.java
@@ -10436,27 +10436,13 @@ private static Result<EmbeddedDataSpecification> tryEmbeddedDataSpecificationFro
           return Result.failure(error);
         }
 
-        IReference theDataSpecification = null;
         IDataSpecificationContent theDataSpecificationContent = null;
+        IReference theDataSpecification = null;
 
         for (Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); iterator.hasNext(); ) {
           Map.Entry<String, JsonNode> currentNode = iterator.next();
 
           switch (currentNode.getKey()) {
-            case "dataSpecification": {
-              if (currentNode.getValue() == null) {
-                continue;
-              }
-
-              final Result<? extends IReference> theDataSpecificationResult = tryReferenceFrom(currentNode.getValue());
-              if (theDataSpecificationResult.isError()) {
-                theDataSpecificationResult.getError()
-                  .prependSegment(new Reporting.NameSegment("dataSpecification"));
-                return theDataSpecificationResult.castTo(EmbeddedDataSpecification.class);
-              }
-              theDataSpecification = theDataSpecificationResult.getResult();
-              break;
-            }
             case "dataSpecificationContent": {
               if (currentNode.getValue() == null) {
                 continue;
@@ -10471,6 +10457,20 @@ private static Result<EmbeddedDataSpecification> tryEmbeddedDataSpecificationFro
               theDataSpecificationContent = theDataSpecificationContentResult.getResult();
               break;
             }
+            case "dataSpecification": {
+              if (currentNode.getValue() == null) {
+                continue;
+              }
+
+              final Result<? extends IReference> theDataSpecificationResult = tryReferenceFrom(currentNode.getValue());
+              if (theDataSpecificationResult.isError()) {
+                theDataSpecificationResult.getError()
+                  .prependSegment(new Reporting.NameSegment("dataSpecification"));
+                return theDataSpecificationResult.castTo(EmbeddedDataSpecification.class);
+              }
+              theDataSpecification = theDataSpecificationResult.getResult();
+              break;
+            }
             default: {
               final Reporting.Error error = new Reporting.Error(
                 "Unexpected property: " + currentNode.getKey());
@@ -10479,12 +10479,6 @@ private static Result<EmbeddedDataSpecification> tryEmbeddedDataSpecificationFro
           }
         }
 
-        if (theDataSpecification == null) {
-          final Reporting.Error error = new Reporting.Error(
-            "Required property \"dataSpecification\" is missing");
-          return Result.failure(error);
-        }
-
         if (theDataSpecificationContent == null) {
           final Reporting.Error error = new Reporting.Error(
             "Required property \"dataSpecificationContent\" is missing");
@@ -10492,8 +10486,8 @@ private static Result<EmbeddedDataSpecification> tryEmbeddedDataSpecificationFro
         }
 
         return Result.success(new EmbeddedDataSpecification(
-          theDataSpecification,
-          theDataSpecificationContent));
+          theDataSpecificationContent,
+          theDataSpecification));
       }
 
       /**
@@ -14599,12 +14593,14 @@ public JsonNode transformEmbeddedDataSpecification(
       ) {
         final ObjectNode result = JsonNodeFactory.instance.objectNode();
 
-        result.set("dataSpecification", transform(
-          that.getDataSpecification()));
-
         result.set("dataSpecificationContent", transform(
           that.getDataSpecificationContent()));
 
+        if (that.getDataSpecification().isPresent()) {
+          result.set("dataSpecification", transform(
+            that.getDataSpecification().get()));
+        }
+
         return result;
       }
 
diff --git a/test_data/java/test_main/aas_core_meta.v3/expected_output/types/impl/EmbeddedDataSpecification.java b/test_data/java/test_main/aas_core_meta.v3/expected_output/types/impl/EmbeddedDataSpecification.java
index 4082b6144..0ab22470d 100644
--- a/test_data/java/test_main/aas_core_meta.v3/expected_output/types/impl/EmbeddedDataSpecification.java
+++ b/test_data/java/test_main/aas_core_meta.v3/expected_output/types/impl/EmbeddedDataSpecification.java
@@ -31,36 +31,28 @@
  */
 public class EmbeddedDataSpecification implements IEmbeddedDataSpecification {
   /**
-   * Reference to the data specification
+   * Actual content of the data specification
    */
-  private IReference dataSpecification;
+  private IDataSpecificationContent dataSpecificationContent;
 
   /**
-   * Actual content of the data specification
+   * Reference to the data specification
    */
-  private IDataSpecificationContent dataSpecificationContent;
+  private IReference dataSpecification;
 
-  public EmbeddedDataSpecification(
-    IReference dataSpecification,
-    IDataSpecificationContent dataSpecificationContent) {
-    this.dataSpecification = Objects.requireNonNull(
-      dataSpecification,
-      "Argument \"dataSpecification\" must be non-null.");
+  public EmbeddedDataSpecification(IDataSpecificationContent dataSpecificationContent) {
     this.dataSpecificationContent = Objects.requireNonNull(
       dataSpecificationContent,
       "Argument \"dataSpecificationContent\" must be non-null.");
   }
 
-  @Override
-  public IReference getDataSpecification() {
-    return dataSpecification;
-  }
-
-  @Override
-  public void setDataSpecification(IReference dataSpecification) {
-    this.dataSpecification = Objects.requireNonNull(
-      dataSpecification,
-      "Argument \"dataSpecification\" must be non-null.");
+  public EmbeddedDataSpecification(
+    IDataSpecificationContent dataSpecificationContent,
+    IReference dataSpecification) {
+    this.dataSpecificationContent = Objects.requireNonNull(
+      dataSpecificationContent,
+      "Argument \"dataSpecificationContent\" must be non-null.");
+    this.dataSpecification = dataSpecification;
   }
 
   @Override
@@ -75,6 +67,16 @@ public void setDataSpecificationContent(IDataSpecificationContent dataSpecificat
       "Argument \"dataSpecificationContent\" must be non-null.");
   }
 
+  @Override
+  public Optional<IReference> getDataSpecification() {
+    return Optional.ofNullable(dataSpecification);
+  }
+
+  @Override
+  public void setDataSpecification(IReference dataSpecification) {
+    this.dataSpecification = dataSpecification;
+  }
+
   /**
    * Iterate recursively over all the class instances referenced from this instance.
    */
@@ -152,14 +154,14 @@ public Spliterator<IClass> spliterator() {
     private Stream<IClass> stream() {
       Stream<IClass> memberStream = Stream.empty();
 
-      if (dataSpecification != null) {
+      if (dataSpecificationContent != null) {
         memberStream = Stream.concat(memberStream,
-          Stream.<IClass>of(EmbeddedDataSpecification.this.dataSpecification));
+          Stream.<IClass>of(EmbeddedDataSpecification.this.dataSpecificationContent));
       }
 
-      if (dataSpecificationContent != null) {
+      if (dataSpecification != null) {
         memberStream = Stream.concat(memberStream,
-          Stream.<IClass>of(EmbeddedDataSpecification.this.dataSpecificationContent));
+          Stream.<IClass>of(EmbeddedDataSpecification.this.dataSpecification));
       }
 
       return memberStream;
@@ -191,18 +193,18 @@ public Spliterator<IClass> spliterator() {
     private Stream<IClass> stream() {
       Stream<IClass> memberStream = Stream.empty();
 
-      if (dataSpecification != null) {
-        memberStream = Stream.concat(memberStream,
-          Stream.concat(Stream.<IClass>of(EmbeddedDataSpecification.this.dataSpecification),
-            StreamSupport.stream(EmbeddedDataSpecification.this.dataSpecification.descend().spliterator(), false)));
-      }
-
       if (dataSpecificationContent != null) {
         memberStream = Stream.concat(memberStream,
           Stream.concat(Stream.<IClass>of(EmbeddedDataSpecification.this.dataSpecificationContent),
             StreamSupport.stream(EmbeddedDataSpecification.this.dataSpecificationContent.descend().spliterator(), false)));
       }
 
+      if (dataSpecification != null) {
+        memberStream = Stream.concat(memberStream,
+          Stream.concat(Stream.<IClass>of(EmbeddedDataSpecification.this.dataSpecification),
+            StreamSupport.stream(EmbeddedDataSpecification.this.dataSpecification.descend().spliterator(), false)));
+      }
+
       return memberStream;
     }
   }
diff --git a/test_data/java/test_main/aas_core_meta.v3/expected_output/types/model/IEmbeddedDataSpecification.java b/test_data/java/test_main/aas_core_meta.v3/expected_output/types/model/IEmbeddedDataSpecification.java
index 577cbc854..0de1d31e9 100644
--- a/test_data/java/test_main/aas_core_meta.v3/expected_output/types/model/IEmbeddedDataSpecification.java
+++ b/test_data/java/test_main/aas_core_meta.v3/expected_output/types/model/IEmbeddedDataSpecification.java
@@ -17,18 +17,18 @@
  */
 public interface IEmbeddedDataSpecification extends IClass {
   /**
-   * Reference to the data specification
+   * Actual content of the data specification
    */
-  IReference getDataSpecification();
+  IDataSpecificationContent getDataSpecificationContent();
 
-  void setDataSpecification(IReference dataSpecification);
+  void setDataSpecificationContent(IDataSpecificationContent dataSpecificationContent);
 
   /**
-   * Actual content of the data specification
+   * Reference to the data specification
    */
-  IDataSpecificationContent getDataSpecificationContent();
+  Optional<IReference> getDataSpecification();
 
-  void setDataSpecificationContent(IDataSpecificationContent dataSpecificationContent);
+  void setDataSpecification(IReference dataSpecification);
 }
 
 /*
diff --git a/test_data/java/test_main/aas_core_meta.v3/expected_output/verification/Verification.java b/test_data/java/test_main/aas_core_meta.v3/expected_output/verification/Verification.java
index 86ee6e77a..0878dbad4 100644
--- a/test_data/java/test_main/aas_core_meta.v3/expected_output/verification/Verification.java
+++ b/test_data/java/test_main/aas_core_meta.v3/expected_output/verification/Verification.java
@@ -8870,15 +8870,6 @@ public Stream<Reporting.Error> transformEmbeddedDataSpecification(
       IEmbeddedDataSpecification that) {
       Stream<Reporting.Error> errorStream = Stream.empty();
 
-      errorStream = Stream.<Reporting.Error>concat(errorStream,
-        Stream.of(that.getDataSpecification())
-          .flatMap(Verification::verifyToErrorStream)
-            .map(error -> {
-              error.prependSegment(
-                new Reporting.NameSegment("dataSpecification"));
-              return error;
-            }));
-
       errorStream = Stream.<Reporting.Error>concat(errorStream,
         Stream.of(that.getDataSpecificationContent())
           .flatMap(Verification::verifyToErrorStream)
@@ -8888,6 +8879,17 @@ public Stream<Reporting.Error> transformEmbeddedDataSpecification(
               return error;
             }));
 
+      if (that.getDataSpecification().isPresent()) {
+        errorStream = Stream.<Reporting.Error>concat(errorStream,
+          Stream.of(that.getDataSpecification().get())
+            .flatMap(Verification::verifyToErrorStream)
+              .map(error -> {
+                error.prependSegment(
+                  new Reporting.NameSegment("dataSpecification"));
+                return error;
+              }));
+      }
+
       return errorStream;
     }
 
diff --git a/test_data/java/test_main/aas_core_meta.v3/expected_output/xmlization/Xmlization.java b/test_data/java/test_main/aas_core_meta.v3/expected_output/xmlization/Xmlization.java
index d43dce1c8..409bcf8c1 100644
--- a/test_data/java/test_main/aas_core_meta.v3/expected_output/xmlization/Xmlization.java
+++ b/test_data/java/test_main/aas_core_meta.v3/expected_output/xmlization/Xmlization.java
@@ -13199,8 +13199,8 @@ private static Result<? extends IDataSpecificationContent> tryIDataSpecification
     private static Result<EmbeddedDataSpecification> tryEmbeddedDataSpecificationFromSequence(
       XMLEventReader reader,
       boolean isEmptySequence) {
-      IReference theDataSpecification = null;
       IDataSpecificationContent theDataSpecificationContent = null;
+      IReference theDataSpecification = null;
 
       if (!isEmptySequence) {
         skipWhitespaceAndComments(reader);
@@ -13236,22 +13236,6 @@ private static Result<EmbeddedDataSpecification> tryEmbeddedDataSpecificationFro
           final String elementName = tryElementName.getResult();
 
           switch (tryElementName.getResult()) {
-            case "dataSpecification":
-            {
-              Result<Reference> tryDataSpecification = tryReferenceFromSequence(
-                reader, isEmptyProperty);
-
-              if (tryDataSpecification.isError()) {
-                tryDataSpecification.getError()
-                  .prependSegment(
-                    new Reporting.NameSegment(
-                      "dataSpecification"));
-                return tryDataSpecification.castTo(EmbeddedDataSpecification.class);
-              }
-
-              theDataSpecification = tryDataSpecification.getResult();
-              break;
-            }
             case "dataSpecificationContent":
             {
               if (isEmptyProperty) {
@@ -13305,6 +13289,22 @@ private static Result<EmbeddedDataSpecification> tryEmbeddedDataSpecificationFro
               theDataSpecificationContent = tryDataSpecificationContent.getResult();
               break;
             }
+            case "dataSpecification":
+            {
+              Result<Reference> tryDataSpecification = tryReferenceFromSequence(
+                reader, isEmptyProperty);
+
+              if (tryDataSpecification.isError()) {
+                tryDataSpecification.getError()
+                  .prependSegment(
+                    new Reporting.NameSegment(
+                      "dataSpecification"));
+                return tryDataSpecification.castTo(EmbeddedDataSpecification.class);
+              }
+
+              theDataSpecification = tryDataSpecification.getResult();
+              break;
+            }
             default:
               final Reporting.Error error = new Reporting.Error(
                 "We expected properties of the class EmbeddedDataSpecification, " +
@@ -13325,13 +13325,6 @@ private static Result<EmbeddedDataSpecification> tryEmbeddedDataSpecificationFro
         }
       }
 
-      if (theDataSpecification == null) {
-        final Reporting.Error error = new Reporting.Error(
-          "The required property dataSpecification has not been given " +
-          "in the XML representation of an instance of class EmbeddedDataSpecification");
-        return Result.failure(error);
-      }
-
       if (theDataSpecificationContent == null) {
         final Reporting.Error error = new Reporting.Error(
           "The required property dataSpecificationContent has not been given " +
@@ -13340,8 +13333,8 @@ private static Result<EmbeddedDataSpecification> tryEmbeddedDataSpecificationFro
       }
 
       return Result.success(new EmbeddedDataSpecification(
-        theDataSpecification,
-        theDataSpecificationContent));
+        theDataSpecificationContent,
+        theDataSpecification));
     }
 
     /**
@@ -21716,14 +21709,14 @@ private void embeddedDataSpecificationToSequence(
       XMLStreamWriter writer) {
       try {
         writer.writeStartElement(
-          "dataSpecification");
+          "dataSpecificationContent");
         if (topLevel) {
           writer.writeNamespace("xmlns", AAS_NAME_SPACE);
           topLevel = false;
         }
 
-        this.referenceToSequence(
-          that.getDataSpecification(),
+        this.visit(
+          that.getDataSpecificationContent(),
           writer);
 
         writer.writeEndElement();
@@ -21732,18 +21725,20 @@ private void embeddedDataSpecificationToSequence(
       }
 
       try {
-        writer.writeStartElement(
-          "dataSpecificationContent");
-        if (topLevel) {
-          writer.writeNamespace("xmlns", AAS_NAME_SPACE);
-          topLevel = false;
-        }
+        if (that.getDataSpecification().isPresent()) {
+          writer.writeStartElement(
+            "dataSpecification");
+          if (topLevel) {
+            writer.writeNamespace("xmlns", AAS_NAME_SPACE);
+            topLevel = false;
+          }
 
-        this.visit(
-          that.getDataSpecificationContent(),
-          writer);
+          this.referenceToSequence(
+            that.getDataSpecification().get(),
+            writer);
 
-        writer.writeEndElement();
+          writer.writeEndElement();
+        }
       } catch (XMLStreamException exception) {
         throw new SerializeException("",exception.getMessage());
       }
diff --git a/test_data/jsonld_context/aas_core_meta.v3/output/context.jsonld b/test_data/jsonld_context/aas_core_meta.v3/output/context.jsonld
index 1f7c4fa83..9f228519a 100644
--- a/test_data/jsonld_context/aas_core_meta.v3/output/context.jsonld
+++ b/test_data/jsonld_context/aas_core_meta.v3/output/context.jsonld
@@ -679,6 +679,11 @@
       "@type": "@id",
       "@context": {}
     },
+    "dataSpecificationContent": {
+      "@id": "aas:EmbeddedDataSpecification/dataSpecificationContent",
+      "@type": "@id",
+      "@context": {}
+    },
     "dataSpecification": {
       "@id": "aas:EmbeddedDataSpecification/dataSpecification",
       "@type": "@id",
@@ -692,11 +697,6 @@
         }
       }
     },
-    "dataSpecificationContent": {
-      "@id": "aas:EmbeddedDataSpecification/dataSpecificationContent",
-      "@type": "@id",
-      "@context": {}
-    },
     "nom": {
       "@id": "aas:LevelType/nom"
     },
diff --git a/test_data/jsonschema/test_main/aas_core_meta.v3/expected_output/schema.json b/test_data/jsonschema/test_main/aas_core_meta.v3/expected_output/schema.json
index af25a46c6..a7d10e518 100644
--- a/test_data/jsonschema/test_main/aas_core_meta.v3/expected_output/schema.json
+++ b/test_data/jsonschema/test_main/aas_core_meta.v3/expected_output/schema.json
@@ -505,15 +505,14 @@
     "EmbeddedDataSpecification": {
       "type": "object",
       "properties": {
-        "dataSpecification": {
-          "$ref": "#/definitions/Reference"
-        },
         "dataSpecificationContent": {
           "$ref": "#/definitions/DataSpecificationContent_choice"
+        },
+        "dataSpecification": {
+          "$ref": "#/definitions/Reference"
         }
       },
       "required": [
-        "dataSpecification",
         "dataSpecificationContent"
       ]
     },
diff --git a/test_data/parse/real_meta_models/aas_core_meta.v3/expected_symbol_table.txt b/test_data/parse/real_meta_models/aas_core_meta.v3/expected_symbol_table.txt
index ab6fc61fb..87f5e9770 100644
--- a/test_data/parse/real_meta_models/aas_core_meta.v3/expected_symbol_table.txt
+++ b/test_data/parse/real_meta_models/aas_core_meta.v3/expected_symbol_table.txt
@@ -10833,18 +10833,22 @@ UnverifiedSymbolTable(
       inheritances=[],
       properties=[
         Property(
-          name='data_specification',
+          name='data_specification_content',
           type_annotation=AtomicTypeAnnotation(
-            identifier='Reference',
+            identifier='Data_specification_content',
             node=...),
           description=Description(
             document=...,
             node=...),
           node=...),
         Property(
-          name='data_specification_content',
-          type_annotation=AtomicTypeAnnotation(
-            identifier='Data_specification_content',
+          name='data_specification',
+          type_annotation=SubscriptedTypeAnnotation(
+            identifier='Optional',
+            subscripts=[
+              AtomicTypeAnnotation(
+                identifier='Reference',
+                node=...)],
             node=...),
           description=Description(
             document=...,
@@ -10861,18 +10865,23 @@ UnverifiedSymbolTable(
               default=None,
               node=...),
             Argument(
-              name='data_specification',
+              name='data_specification_content',
               type_annotation=AtomicTypeAnnotation(
-                identifier='Reference',
+                identifier='Data_specification_content',
                 node=...),
               default=None,
               node=...),
             Argument(
-              name='data_specification_content',
-              type_annotation=AtomicTypeAnnotation(
-                identifier='Data_specification_content',
+              name='data_specification',
+              type_annotation=SubscriptedTypeAnnotation(
+                identifier='Optional',
+                subscripts=[
+                  AtomicTypeAnnotation(
+                    identifier='Reference',
+                    node=...)],
+                node=...),
+              default=Default(
                 node=...),
-              default=None,
               node=...)],
           returns=None,
           description=None,
diff --git a/test_data/python/test_main/aas_core_meta.v3/expected_output/jsonization.py b/test_data/python/test_main/aas_core_meta.v3/expected_output/jsonization.py
index 1230b2251..5419f363f 100644
--- a/test_data/python/test_main/aas_core_meta.v3/expected_output/jsonization.py
+++ b/test_data/python/test_main/aas_core_meta.v3/expected_output/jsonization.py
@@ -9137,36 +9137,36 @@ class _SetterForEmbeddedDataSpecification:
 
     def __init__(self) -> None:
         """Initialize with all the properties unset."""
-        self.data_specification: Optional[aas_types.Reference] = None
         self.data_specification_content: Optional[aas_types.DataSpecificationContent] = None
+        self.data_specification: Optional[aas_types.Reference] = None
 
     def ignore(self, jsonable: Jsonable) -> None:
         """Ignore :paramref:`jsonable` and do not set anything."""
         pass
 
-    def set_data_specification_from_jsonable(
+    def set_data_specification_content_from_jsonable(
             self,
             jsonable: Jsonable
     ) -> None:
         """
-        Parse :paramref:`jsonable` as the value of :py:attr:`~data_specification`.
+        Parse :paramref:`jsonable` as the value of :py:attr:`~data_specification_content`.
 
         :param jsonable: input to be parsed
         """
-        self.data_specification = reference_from_jsonable(
+        self.data_specification_content = data_specification_content_from_jsonable(
             jsonable
         )
 
-    def set_data_specification_content_from_jsonable(
+    def set_data_specification_from_jsonable(
             self,
             jsonable: Jsonable
     ) -> None:
         """
-        Parse :paramref:`jsonable` as the value of :py:attr:`~data_specification_content`.
+        Parse :paramref:`jsonable` as the value of :py:attr:`~data_specification`.
 
         :param jsonable: input to be parsed
         """
-        self.data_specification_content = data_specification_content_from_jsonable(
+        self.data_specification = reference_from_jsonable(
             jsonable
         )
 
@@ -9209,19 +9209,14 @@ def embedded_data_specification_from_jsonable(
             )
             raise exception
 
-    if setter.data_specification is None:
-        raise DeserializationException(
-            "The required property 'dataSpecification' is missing"
-        )
-
     if setter.data_specification_content is None:
         raise DeserializationException(
             "The required property 'dataSpecificationContent' is missing"
         )
 
     return aas_types.EmbeddedDataSpecification(
-        setter.data_specification,
-        setter.data_specification_content
+        setter.data_specification_content,
+        setter.data_specification
     )
 
 
@@ -11229,10 +11224,10 @@ def data_specification_iec_61360_from_jsonable(
         None
     ]
 ] = {
-    'dataSpecification':
-        _SetterForEmbeddedDataSpecification.set_data_specification_from_jsonable,
     'dataSpecificationContent':
         _SetterForEmbeddedDataSpecification.set_data_specification_content_from_jsonable,
+    'dataSpecification':
+        _SetterForEmbeddedDataSpecification.set_data_specification_from_jsonable,
     'modelType':
         _SetterForEmbeddedDataSpecification.ignore
 }
@@ -12793,14 +12788,15 @@ def transform_embedded_data_specification(
         """Serialize :paramref:`that` to a JSON-able representation."""
         jsonable: MutableMapping[str, MutableJsonable] = dict()
 
-        jsonable['dataSpecification'] = (
-            self.transform(that.data_specification)
-        )
-
         jsonable['dataSpecificationContent'] = (
             self.transform(that.data_specification_content)
         )
 
+        if that.data_specification is not None:
+            jsonable['dataSpecification'] = (
+                self.transform(that.data_specification)
+            )
+
         return jsonable
 
     # noinspection PyMethodMayBeStatic
diff --git a/test_data/python/test_main/aas_core_meta.v3/expected_output/types.py b/test_data/python/test_main/aas_core_meta.v3/expected_output/types.py
index ad701d461..442b46dfa 100644
--- a/test_data/python/test_main/aas_core_meta.v3/expected_output/types.py
+++ b/test_data/python/test_main/aas_core_meta.v3/expected_output/types.py
@@ -5554,12 +5554,12 @@ class DataSpecificationContent(Class):
 class EmbeddedDataSpecification(Class):
     """Embed the content of a data specification."""
 
-    #: Reference to the data specification
-    data_specification: 'Reference'
-
     #: Actual content of the data specification
     data_specification_content: 'DataSpecificationContent'
 
+    #: Reference to the data specification
+    data_specification: Optional['Reference']
+
     def descend_once(self) -> Iterator[Class]:
         """
         Iterate over the instances referenced from this instance.
@@ -5568,24 +5568,26 @@ def descend_once(self) -> Iterator[Class]:
 
         :yield: instances directly referenced from this instance
         """
-        yield self.data_specification
-
         yield self.data_specification_content
 
+        if self.data_specification is not None:
+            yield self.data_specification
+
     def descend(self) -> Iterator[Class]:
         """
         Iterate recursively over the instances referenced from this one.
 
         :yield: instances recursively referenced from this instance
         """
-        yield self.data_specification
-
-        yield from self.data_specification.descend()
-
         yield self.data_specification_content
 
         yield from self.data_specification_content.descend()
 
+        if self.data_specification is not None:
+            yield self.data_specification
+
+            yield from self.data_specification.descend()
+
     def accept(self, visitor: "AbstractVisitor") -> None:
         """Dispatch the :paramref:`visitor` on this instance."""
         visitor.visit_embedded_data_specification(self)
@@ -5618,12 +5620,12 @@ def transform_with_context(
 
     def __init__(
             self,
-            data_specification: 'Reference',
-            data_specification_content: 'DataSpecificationContent'
+            data_specification_content: 'DataSpecificationContent',
+            data_specification: Optional['Reference'] = None
     ) -> None:
         """Initialize with the given values."""
-        self.data_specification = data_specification
         self.data_specification_content = data_specification_content
+        self.data_specification = data_specification
 
 
 class DataTypeIEC61360(enum.Enum):
diff --git a/test_data/python/test_main/aas_core_meta.v3/expected_output/verification.py b/test_data/python/test_main/aas_core_meta.v3/expected_output/verification.py
index e109f1458..d39534166 100644
--- a/test_data/python/test_main/aas_core_meta.v3/expected_output/verification.py
+++ b/test_data/python/test_main/aas_core_meta.v3/expected_output/verification.py
@@ -7895,15 +7895,6 @@ def transform_embedded_data_specification(
             self,
             that: aas_types.EmbeddedDataSpecification
     ) -> Iterator[Error]:
-        for error in self.transform(that.data_specification):
-            error.path._prepend(
-                PropertySegment(
-                    that,
-                    'data_specification'
-                )
-            )
-            yield error
-
         for error in self.transform(that.data_specification_content):
             error.path._prepend(
                 PropertySegment(
@@ -7913,6 +7904,16 @@ def transform_embedded_data_specification(
             )
             yield error
 
+        if that.data_specification is not None:
+            for error in self.transform(that.data_specification):
+                error.path._prepend(
+                    PropertySegment(
+                        that,
+                        'data_specification'
+                    )
+                )
+                yield error
+
     # noinspection PyMethodMayBeStatic
     def transform_level_type(
             self,
diff --git a/test_data/python/test_main/aas_core_meta.v3/expected_output/xmlization.py b/test_data/python/test_main/aas_core_meta.v3/expected_output/xmlization.py
index 71a9e39bb..6599c161d 100644
--- a/test_data/python/test_main/aas_core_meta.v3/expected_output/xmlization.py
+++ b/test_data/python/test_main/aas_core_meta.v3/expected_output/xmlization.py
@@ -24043,22 +24043,8 @@ class _ReaderAndSetterForEmbeddedDataSpecification:
 
     def __init__(self) -> None:
         """Initialize with all the properties unset."""
-        self.data_specification: Optional[aas_types.Reference] = None
         self.data_specification_content: Optional[aas_types.DataSpecificationContent] = None
-
-    def read_and_set_data_specification(
-        self,
-        element: Element,
-        iterator: Iterator[Tuple[str, Element]]
-    ) -> None:
-        """
-        Read :paramref:`element` as the property
-        :py:attr:`.types.EmbeddedDataSpecification.data_specification` and set it.
-        """
-        self.data_specification = _read_reference_as_sequence(
-            element,
-            iterator
-        )
+        self.data_specification: Optional[aas_types.Reference] = None
 
     def read_and_set_data_specification_content(
         self,
@@ -24097,6 +24083,20 @@ def read_and_set_data_specification_content(
 
         self.data_specification_content = result
 
+    def read_and_set_data_specification(
+        self,
+        element: Element,
+        iterator: Iterator[Tuple[str, Element]]
+    ) -> None:
+        """
+        Read :paramref:`element` as the property
+        :py:attr:`.types.EmbeddedDataSpecification.data_specification` and set it.
+        """
+        self.data_specification = _read_reference_as_sequence(
+            element,
+            iterator
+        )
+
 
 def _read_embedded_data_specification_as_sequence(
         element: Element,
@@ -24176,19 +24176,14 @@ def _read_embedded_data_specification_as_sequence(
             exception.path._prepend(ElementSegment(next_element))
             raise
 
-    if reader_and_setter.data_specification is None:
-        raise DeserializationException(
-            "The required property 'dataSpecification' is missing"
-        )
-
     if reader_and_setter.data_specification_content is None:
         raise DeserializationException(
             "The required property 'dataSpecificationContent' is missing"
         )
 
     return aas_types.EmbeddedDataSpecification(
-        reader_and_setter.data_specification,
-        reader_and_setter.data_specification_content
+        reader_and_setter.data_specification_content,
+        reader_and_setter.data_specification
     )
 
 
@@ -27070,10 +27065,10 @@ def _read_data_specification_iec_61360_as_element(
         None
     ]
 ] = {
-    'dataSpecification':
-        _ReaderAndSetterForEmbeddedDataSpecification.read_and_set_data_specification,
     'dataSpecificationContent':
         _ReaderAndSetterForEmbeddedDataSpecification.read_and_set_data_specification_content,
+    'dataSpecification':
+        _ReaderAndSetterForEmbeddedDataSpecification.read_and_set_data_specification,
 }
 
 
@@ -30473,16 +30468,17 @@ def _write_embedded_data_specification_as_sequence(
 
         :param that: instance to be serialized
         """
-        self._write_start_element('dataSpecification')
-        self._write_reference_as_sequence(
-            that.data_specification
-        )
-        self._write_end_element('dataSpecification')
-
         self._write_start_element('dataSpecificationContent')
         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')
+
     def visit_embedded_data_specification(
         self,
         that: aas_types.EmbeddedDataSpecification
diff --git a/test_data/rdf_shacl/test_main/expected/aas_core_meta.v3/expected_output/shacl-schema.ttl b/test_data/rdf_shacl/test_main/expected/aas_core_meta.v3/expected_output/shacl-schema.ttl
index 0b06da8eb..192eee03b 100644
--- a/test_data/rdf_shacl/test_main/expected/aas_core_meta.v3/expected_output/shacl-schema.ttl
+++ b/test_data/rdf_shacl/test_main/expected/aas_core_meta.v3/expected_output/shacl-schema.ttl
@@ -415,16 +415,16 @@ aas:EmbeddedDataSpecificationShape a sh:NodeShape ;
     sh:targetClass aas:EmbeddedDataSpecification ;
     sh:property [
         a sh:PropertyShape ;
-        sh:path <https://admin-shell.io/aas/3/0/EmbeddedDataSpecification/dataSpecification> ;
-        sh:class aas:Reference ;
+        sh:path <https://admin-shell.io/aas/3/0/EmbeddedDataSpecification/dataSpecificationContent> ;
+        sh:class aas:DataSpecificationContent ;
         sh:minCount 1 ;
         sh:maxCount 1 ;
     ] ;
     sh:property [
         a sh:PropertyShape ;
-        sh:path <https://admin-shell.io/aas/3/0/EmbeddedDataSpecification/dataSpecificationContent> ;
-        sh:class aas:DataSpecificationContent ;
-        sh:minCount 1 ;
+        sh:path <https://admin-shell.io/aas/3/0/EmbeddedDataSpecification/dataSpecification> ;
+        sh:class aas:Reference ;
+        sh:minCount 0 ;
         sh:maxCount 1 ;
     ] ;
 .
diff --git a/test_data/typescript/test_main/aas_core_meta.v3/expected_output/jsonization.ts b/test_data/typescript/test_main/aas_core_meta.v3/expected_output/jsonization.ts
index 961d4b30a..7732e300b 100644
--- a/test_data/typescript/test_main/aas_core_meta.v3/expected_output/jsonization.ts
+++ b/test_data/typescript/test_main/aas_core_meta.v3/expected_output/jsonization.ts
@@ -14132,10 +14132,10 @@ export function dataSpecificationContentFromJsonable(
  * of {@link types!EmbeddedDataSpecification}.
  */
 class SetterForEmbeddedDataSpecification {
-  dataSpecification: AasTypes.Reference | null = null;
-
   dataSpecificationContent: AasTypes.IDataSpecificationContent | null = null;
 
+  dataSpecification: AasTypes.Reference | null = null;
+
   /**
    * Ignore `jsonable` and do not set anything.
    *
@@ -14149,41 +14149,41 @@ class SetterForEmbeddedDataSpecification {
   }
 
   /**
-   * Parse `jsonable` as the value of {@link dataSpecification}.
+   * Parse `jsonable` as the value of {@link dataSpecificationContent}.
    *
    * @param jsonable - to be parsed
    * @returns error, if any
    */
-  setDataSpecificationFromJsonable(
+  setDataSpecificationContentFromJsonable(
     jsonable: JsonValue
   ): DeserializationError | null {
-    const parsedOrError = referenceFromJsonable(
+    const parsedOrError = dataSpecificationContentFromJsonable(
       jsonable
     );
     if (parsedOrError.error !== null) {
       return parsedOrError.error;
     } else {
-      this.dataSpecification = parsedOrError.mustValue();
+      this.dataSpecificationContent = parsedOrError.mustValue();
       return null;
     }
   }
 
   /**
-   * Parse `jsonable` as the value of {@link dataSpecificationContent}.
+   * Parse `jsonable` as the value of {@link dataSpecification}.
    *
    * @param jsonable - to be parsed
    * @returns error, if any
    */
-  setDataSpecificationContentFromJsonable(
+  setDataSpecificationFromJsonable(
     jsonable: JsonValue
   ): DeserializationError | null {
-    const parsedOrError = dataSpecificationContentFromJsonable(
+    const parsedOrError = referenceFromJsonable(
       jsonable
     );
     if (parsedOrError.error !== null) {
       return parsedOrError.error;
     } else {
-      this.dataSpecificationContent = parsedOrError.mustValue();
+      this.dataSpecification = parsedOrError.mustValue();
       return null;
     }
   }
@@ -14249,14 +14249,6 @@ export function embeddedDataSpecificationFromJsonable(
     }
   }
 
-  if (setter.dataSpecification === null) {
-    return newDeserializationError<
-      AasTypes.EmbeddedDataSpecification
-    >(
-      "The required property 'dataSpecification' is missing"
-    );
-  }
-
   if (setter.dataSpecificationContent === null) {
     return newDeserializationError<
       AasTypes.EmbeddedDataSpecification
@@ -14270,8 +14262,8 @@ export function embeddedDataSpecificationFromJsonable(
     DeserializationError
   >(
     new AasTypes.EmbeddedDataSpecification(
-      setter.dataSpecification,
-      setter.dataSpecificationContent
+      setter.dataSpecificationContent,
+      setter.dataSpecification
     ),
     null
   );
@@ -17832,14 +17824,14 @@ const SETTER_MAP_FOR_EMBEDDED_DATA_SPECIFICATION =
     ) => DeserializationError | null
   >(
     [
-      [
-        "dataSpecification",
-        SetterForEmbeddedDataSpecification.prototype.setDataSpecificationFromJsonable
-      ],
       [
         "dataSpecificationContent",
         SetterForEmbeddedDataSpecification.prototype.setDataSpecificationContentFromJsonable
       ],
+      [
+        "dataSpecification",
+        SetterForEmbeddedDataSpecification.prototype.setDataSpecificationFromJsonable
+      ],
       [
         "modelType",
         SetterForEmbeddedDataSpecification.prototype.ignore
@@ -20328,12 +20320,14 @@ class Serializer extends AasTypes.AbstractTransformer<JsonObject> {
   ): JsonObject {
     const jsonable: JsonObject = {};
 
-    jsonable["dataSpecification"] =
-      this.transform(that.dataSpecification);
-
     jsonable["dataSpecificationContent"] =
       this.transform(that.dataSpecificationContent);
 
+    if (that.dataSpecification !== null) {
+      jsonable["dataSpecification"] =
+        this.transform(that.dataSpecification);
+    }
+
     return jsonable;
   }
 
diff --git a/test_data/typescript/test_main/aas_core_meta.v3/expected_output/types.ts b/test_data/typescript/test_main/aas_core_meta.v3/expected_output/types.ts
index 56be620d5..349c6461f 100644
--- a/test_data/typescript/test_main/aas_core_meta.v3/expected_output/types.ts
+++ b/test_data/typescript/test_main/aas_core_meta.v3/expected_output/types.ts
@@ -9934,14 +9934,14 @@ export class EmbeddedDataSpecification extends Class {
   }
 
   /**
-   * Reference to the data specification
+   * Actual content of the data specification
    */
-  dataSpecification: Reference;
+  dataSpecificationContent: IDataSpecificationContent;
 
   /**
-   * Actual content of the data specification
+   * Reference to the data specification
    */
-  dataSpecificationContent: IDataSpecificationContent;
+  dataSpecification: Reference | null;
 
   /**
    * Iterate over the instances referenced from this instance.
@@ -9951,9 +9951,11 @@ export class EmbeddedDataSpecification extends Class {
    * @returns Iterator over the referenced instances
    */
   *descendOnce(): IterableIterator<Class> {
-    yield this.dataSpecification;
-
     yield this.dataSpecificationContent;
+
+    if (this.dataSpecification !== null) {
+      yield this.dataSpecification;
+    }
   }
 
   /**
@@ -9962,13 +9964,15 @@ export class EmbeddedDataSpecification extends Class {
    * @returns Iterator over the referenced instances
    */
   *descend(): IterableIterator<Class> {
-    yield this.dataSpecification;
-
-    yield * this.dataSpecification.descend();
-
     yield this.dataSpecificationContent;
 
     yield * this.dataSpecificationContent.descend();
+
+    if (this.dataSpecification !== null) {
+      yield this.dataSpecification;
+
+      yield * this.dataSpecification.descend();
+    }
   }
 
   /**
@@ -10024,12 +10028,12 @@ export class EmbeddedDataSpecification extends Class {
   }
 
   constructor(
-    dataSpecification: Reference,
-    dataSpecificationContent: IDataSpecificationContent
+    dataSpecificationContent: IDataSpecificationContent,
+    dataSpecification: Reference | null = null
   ) {
     super();
-    this.dataSpecification = dataSpecification;
     this.dataSpecificationContent = dataSpecificationContent;
+    this.dataSpecification = dataSpecification;
   }
 }
 
diff --git a/test_data/typescript/test_main/aas_core_meta.v3/expected_output/verification.ts b/test_data/typescript/test_main/aas_core_meta.v3/expected_output/verification.ts
index 3a7783efc..a40c748f3 100644
--- a/test_data/typescript/test_main/aas_core_meta.v3/expected_output/verification.ts
+++ b/test_data/typescript/test_main/aas_core_meta.v3/expected_output/verification.ts
@@ -9279,18 +9279,6 @@ class Verifier
     context: boolean
   ): IterableIterator<VerificationError> {
     if (context === true) {
-      for (const error of this.transformWithContext(
-          that.dataSpecification, context)
-      ) {
-        error.path.prepend(
-          new PropertySegment(
-            that,
-            "dataSpecification"
-          )
-        );
-        yield error;
-      }
-
       for (const error of this.transformWithContext(
           that.dataSpecificationContent, context)
       ) {
@@ -9302,6 +9290,20 @@ class Verifier
         );
         yield error;
       }
+
+      if (that.dataSpecification !== null) {
+        for (const error of this.transformWithContext(
+            that.dataSpecification, context)
+        ) {
+          error.path.prepend(
+            new PropertySegment(
+              that,
+              "dataSpecification"
+            )
+          );
+          yield error;
+        }
+      }
     }
   }
 
diff --git a/test_data/xsd/test_main/aas_core_meta.v3/expected_output/schema.xsd b/test_data/xsd/test_main/aas_core_meta.v3/expected_output/schema.xsd
index 1669382aa..5a246096f 100644
--- a/test_data/xsd/test_main/aas_core_meta.v3/expected_output/schema.xsd
+++ b/test_data/xsd/test_main/aas_core_meta.v3/expected_output/schema.xsd
@@ -277,7 +277,6 @@
   </xs:group>
   <xs:group name="embeddedDataSpecification">
     <xs:sequence>
-      <xs:element name="dataSpecification" type="reference_t"/>
       <xs:element name="dataSpecificationContent">
         <xs:complexType>
           <xs:sequence>
@@ -285,6 +284,7 @@
           </xs:sequence>
         </xs:complexType>
       </xs:element>
+      <xs:element name="dataSpecification" type="reference_t" minOccurs="0" maxOccurs="1"/>
     </xs:sequence>
   </xs:group>
   <xs:group name="entity">