diff --git a/CDP4JsonSerializer.NetCore.Tests/CDP4JsonSerializer.NetCore.Tests.csproj b/CDP4JsonSerializer.NetCore.Tests/CDP4JsonSerializer.NetCore.Tests.csproj index ceaef1877..f7de3a262 100644 --- a/CDP4JsonSerializer.NetCore.Tests/CDP4JsonSerializer.NetCore.Tests.csproj +++ b/CDP4JsonSerializer.NetCore.Tests/CDP4JsonSerializer.NetCore.Tests.csproj @@ -41,6 +41,12 @@ + + Always + + + Always + Always diff --git a/CDP4JsonSerializer.NetCore.Tests/PostOperation/CreateDerivedQuantityKindPostMessage.json b/CDP4JsonSerializer.NetCore.Tests/PostOperation/CreateDerivedQuantityKindPostMessage.json new file mode 100644 index 000000000..11e51e3de --- /dev/null +++ b/CDP4JsonSerializer.NetCore.Tests/PostOperation/CreateDerivedQuantityKindPostMessage.json @@ -0,0 +1,62 @@ +{ + "_delete": [], + "_create": [ + { + "alias": [], + "category": [], + "classKind": "DerivedQuantityKind", + "defaultScale": "56863161-fa3a-47b8-a3cd-16465f734b27", + "definition": [], + "excludedDomain": [], + "excludedPerson": [], + "hyperLink": [], + "iid": "08c130ca-a270-408f-8069-b7e1d00659f0", + "isDeprecated": false, + "modifiedOn": "2018-08-12T14:10:55.560Z", + "name": "derivedQuantityKind", + "possibleScale": [ "56863161-fa3a-47b8-a3cd-16465f734b27" ], + "quantityDimensionSymbol": "dqk", + "quantityKindFactor": [ + { + "k": -12551680, + "v": "11aa4db6-40ef-4368-92ac-bda8af9b27a9" + }, + { + "k": 77606679, + "v": "125abfbd-f717-42c0-91da-738316159ea5" + } + ], + "revisionNumber": 0, + "shortName": "derivedQuantityKind", + "symbol": "derivedQuantityKind" + }, + { + "classKind": "QuantityKindFactor", + "excludedDomain": [], + "excludedPerson": [], + "exponent": "1", + "iid": "11aa4db6-40ef-4368-92ac-bda8af9b27a9", + "modifiedOn": "2018-08-12T14:10:45.476Z", + "quantityKind": "9513aca9-5397-48a1-8187-1683490bdb4f", + "revisionNumber": 0 + }, + { + "classKind": "QuantityKindFactor", + "excludedDomain": [], + "excludedPerson": [], + "exponent": "2", + "iid": "125abfbd-f717-42c0-91da-738316159ea5", + "modifiedOn": "2018-08-12T14:10:50.681Z", + "quantityKind": "1c53f8f4-024b-4f42-987a-439901a4bcb2", + "revisionNumber": 0 + } + ], + "_update": [ + { + "classKind": "SiteReferenceDataLibrary", + "iid": "bff9f871-3b7f-4e57-ac82-5ab499f9baf5", + "parameterType": [ "08c130ca-a270-408f-8069-b7e1d00659f0" ] + } + ], + "_copy": [] +} \ No newline at end of file diff --git a/CDP4JsonSerializer.NetCore.Tests/PostOperation/JsonSerializerPostOperationTestFixture.cs b/CDP4JsonSerializer.NetCore.Tests/PostOperation/JsonSerializerPostOperationTestFixture.cs new file mode 100644 index 000000000..9833beaf3 --- /dev/null +++ b/CDP4JsonSerializer.NetCore.Tests/PostOperation/JsonSerializerPostOperationTestFixture.cs @@ -0,0 +1,106 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// Copyright (c) 2015-2024 Starion Group S.A. +// +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou +// +// This file is part of CDP4-COMET SDK Community Edition +// +// The CDP4-COMET SDK Community Edition is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// The CDP4-COMET SDK Community Edition is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// -------------------------------------------------------------------------------------------------------------------- + +namespace CDP4JsonSerializer.NetCore.Tests.PostOperation +{ + using System; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Text; + + using CDP4Common.DTO; + using CDP4Common.MetaInfo; + using CDP4Common.Types; + + using CDP4DalCommon.Protocol.Operations; + + using NUnit.Framework; + + /// + /// Suite of tests to verify that PostOperation deserialization works as expected + /// + [TestFixture] + public class JsonSerializerPostOperationTestFixture + { + private IMetaDataProvider metaDataProvider; + + private Version supportedVersion; + + [SetUp] + public void SetUp() + { + this.metaDataProvider = new MetaDataProvider(); + this.supportedVersion = new Version(1,1,0); + } + + [Test] + public void Verify_that_post_message_with_move_keys_can_be_deserialized() + { + var postMessage = System.IO.File.ReadAllText(Path.Combine(TestContext.CurrentContext.TestDirectory, "PostOperation/ReOderFactorsOfDerivedQuantityKindPostMessage.json")); + var byteArray = Encoding.UTF8.GetBytes(postMessage); + var stream = new MemoryStream(byteArray); + + var cdp4JsonSerializer = new Cdp4DalJsonSerializer(this.metaDataProvider, this.supportedVersion, false); + + var cdpPostOperation = cdp4JsonSerializer.Deserialize(stream); + + Assert.That(cdpPostOperation.Create, Is.Empty); + Assert.That(cdpPostOperation.Delete, Is.Empty); + Assert.That(cdpPostOperation.Copy, Is.Empty); + + var classlessDto = cdpPostOperation.Update.First(); + + var orderedItems = classlessDto["QuantityKindFactor"] as IEnumerable; + + var orderedItem_1 = orderedItems.First(); + orderedItem_1.M = 77606679; + + var orderedItem_2 = orderedItems.Last(); + orderedItem_2.M = -12551680; + } + + [Test] + public void Verify_that_post_message_can_be_deserialized() + { + var postMessage = System.IO.File.ReadAllText(Path.Combine(TestContext.CurrentContext.TestDirectory, "PostOperation/CreateDerivedQuantityKindPostMessage.json")); + var byteArray = Encoding.UTF8.GetBytes(postMessage); + var stream = new MemoryStream(byteArray); + + var cdp4JsonSerializer = new Cdp4DalJsonSerializer(this.metaDataProvider, this.supportedVersion, false); + + var cdpPostOperation = cdp4JsonSerializer.Deserialize(stream); + + Assert.That(cdpPostOperation.Delete, Is.Empty); + Assert.That(cdpPostOperation.Copy, Is.Empty); + + var derivedQuantityKind = cdpPostOperation.Create.First() as DerivedQuantityKind; + var qkf_1 = derivedQuantityKind.QuantityKindFactor.Single(x => x.K == -12551680); + + Assert.That(qkf_1.V, Is.Not.Null); + + Assert.That(qkf_1.M, Is.Null); + } + } +} \ No newline at end of file diff --git a/CDP4JsonSerializer.NetCore.Tests/PostOperation/ReOderFactorsOfDerivedQuantityKindPostMessage.json b/CDP4JsonSerializer.NetCore.Tests/PostOperation/ReOderFactorsOfDerivedQuantityKindPostMessage.json new file mode 100644 index 000000000..5b7161c8f --- /dev/null +++ b/CDP4JsonSerializer.NetCore.Tests/PostOperation/ReOderFactorsOfDerivedQuantityKindPostMessage.json @@ -0,0 +1,24 @@ +{ + "_delete": [], + "_create": [], + "_update": [ + { + "classKind": "DerivedQuantityKind", + "iid": "08c130ca-a270-408f-8069-b7e1d00659f0", + "modifiedOn": "2018-08-12T14:11:56.580Z", + "quantityKindFactor": [ + { + "k": -12551680, + "m": 77606679, + "v": "11aa4db6-40ef-4368-92ac-bda8af9b27a9" + }, + { + "k": 77606679, + "m": -12551680, + "v": "125abfbd-f717-42c0-91da-738316159ea5" + } + ] + } + ], + "_copy": [] +} \ No newline at end of file diff --git a/CDP4JsonSerializer.Tests/PostOperation/CdpPostOperation.cs b/CDP4JsonSerializer.Tests/PostOperation/CdpPostOperation.cs deleted file mode 100644 index 15e11a1c8..000000000 --- a/CDP4JsonSerializer.Tests/PostOperation/CdpPostOperation.cs +++ /dev/null @@ -1,50 +0,0 @@ -// -------------------------------------------------------------------------------------------------------------------- -// -// Copyright (c) 2015-2024 Starion Group S.A. -// -// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft -// -// This file is part of CDP4-COMET SDK Community Edition -// -// The CDP4-COMET SDK Community Edition is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// The CDP4-COMET SDK Community Edition is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this program; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// ------------------------------------------------------------------------------------------------------------------------------- - -namespace CDP4JsonSerializer.Tests.Cdp4PostOperation -{ - using System.Collections.Generic; - using System.Text.Json.Serialization; - - using CDP4Common; - using CDP4Common.DTO; - - /// - /// A CdpPostOperation class used for testing purposes - /// - public class CdpPostOperation - { - [JsonPropertyName("_delete")] - public List Delete { get; set; } - - [JsonPropertyName("_create")] - public List Create { get; set; } - - [JsonPropertyName("_update")] - public List Update { get; set; } - - [JsonPropertyName("_copy")] - public List Copy { get; set; } - } -} diff --git a/CDP4JsonSerializer.Tests/PostOperation/JsonSerializerPostOperationTestFixture.cs b/CDP4JsonSerializer.Tests/PostOperation/JsonSerializerPostOperationTestFixture.cs index 8c654209f..96a623eac 100644 --- a/CDP4JsonSerializer.Tests/PostOperation/JsonSerializerPostOperationTestFixture.cs +++ b/CDP4JsonSerializer.Tests/PostOperation/JsonSerializerPostOperationTestFixture.cs @@ -34,7 +34,7 @@ namespace CDP4JsonSerializer.Tests.PostOperation using CDP4Common.MetaInfo; using CDP4Common.Types; - using CDP4JsonSerializer.Tests.Cdp4PostOperation; + using CDP4DalCommon.Protocol.Operations; using NUnit.Framework; @@ -62,9 +62,9 @@ public void Verify_that_post_message_with_move_keys_can_be_deserialized() var byteArray = Encoding.UTF8.GetBytes(postMessage); var stream = new MemoryStream(byteArray); - var cdp4JsonSerializer = new Cdp4JsonSerializer(this.metaDataProvider, this.supportedVersion); + var cdp4JsonSerializer = new Cdp4DalJsonSerializer(this.metaDataProvider, this.supportedVersion, false); - var cdpPostOperation = cdp4JsonSerializer.Deserialize(stream); + var cdpPostOperation = cdp4JsonSerializer.Deserialize(stream); Assert.That(cdpPostOperation.Create, Is.Empty); Assert.That(cdpPostOperation.Delete, Is.Empty); @@ -88,9 +88,9 @@ public void Verify_that_post_message_can_be_deserialized() var byteArray = Encoding.UTF8.GetBytes(postMessage); var stream = new MemoryStream(byteArray); - var cdp4JsonSerializer = new Cdp4JsonSerializer(this.metaDataProvider, this.supportedVersion); + var cdp4JsonSerializer = new Cdp4DalJsonSerializer(this.metaDataProvider, this.supportedVersion, false); - var cdpPostOperation = cdp4JsonSerializer.Deserialize(stream); + var cdpPostOperation = cdp4JsonSerializer.Deserialize(stream); Assert.That(cdpPostOperation.Delete, Is.Empty); Assert.That(cdpPostOperation.Copy, Is.Empty); diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ActionItemSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ActionItemSerializer.cs index 5073e320a..adf25b96a 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ActionItemSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ActionItemSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ActionItemSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ActionItem", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ActionItem."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ActionItem since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ActualFiniteStateListSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ActualFiniteStateListSerializer.cs index 97867f3c5..be6b270da 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ActualFiniteStateListSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ActualFiniteStateListSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ActualFiniteStateListSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ActualFiniteStateList", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ActualFiniteStateList."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ActualFiniteStateList since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ActualFiniteStateSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ActualFiniteStateSerializer.cs index 8b016249e..456920b39 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ActualFiniteStateSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ActualFiniteStateSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ActualFiniteStateSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ActualFiniteState", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ActualFiniteState."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ActualFiniteState since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/AliasSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/AliasSerializer.cs index 47f8e6161..fcd77ae92 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/AliasSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/AliasSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class AliasSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a Alias", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of Alias."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of Alias since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/AndExpressionSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/AndExpressionSerializer.cs index 517095f1a..99a5d4989 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/AndExpressionSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/AndExpressionSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class AndExpressionSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a AndExpression", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of AndExpression."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of AndExpression since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ApprovalSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ApprovalSerializer.cs index 9acb8a5ee..00a6c5a3b 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ApprovalSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ApprovalSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ApprovalSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a Approval", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of Approval."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of Approval since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ArrayParameterTypeSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ArrayParameterTypeSerializer.cs index 2a92a61ce..ebfb29ed4 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ArrayParameterTypeSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ArrayParameterTypeSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ArrayParameterTypeSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ArrayParameterType", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ArrayParameterType."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ArrayParameterType since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/BinaryNoteSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/BinaryNoteSerializer.cs index 903b856bd..53960e843 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/BinaryNoteSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/BinaryNoteSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class BinaryNoteSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a BinaryNote", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of BinaryNote."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of BinaryNote since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/BinaryRelationshipRuleSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/BinaryRelationshipRuleSerializer.cs index 487e2d6cd..ebef7ecd8 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/BinaryRelationshipRuleSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/BinaryRelationshipRuleSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class BinaryRelationshipRuleSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a BinaryRelationshipRule", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of BinaryRelationshipRule."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of BinaryRelationshipRule since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/BinaryRelationshipSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/BinaryRelationshipSerializer.cs index 6518815be..f438c50cd 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/BinaryRelationshipSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/BinaryRelationshipSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class BinaryRelationshipSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a BinaryRelationship", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of BinaryRelationship."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of BinaryRelationship since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/BookSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/BookSerializer.cs index 1d4fdeb0b..74f223206 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/BookSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/BookSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class BookSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a Book", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of Book."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of Book since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/BooleanParameterTypeSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/BooleanParameterTypeSerializer.cs index b26f86244..5c50a5978 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/BooleanParameterTypeSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/BooleanParameterTypeSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class BooleanParameterTypeSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a BooleanParameterType", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of BooleanParameterType."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of BooleanParameterType since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/BoundsSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/BoundsSerializer.cs index 6ee68c045..e2693e974 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/BoundsSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/BoundsSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class BoundsSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a Bounds", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of Bounds."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of Bounds since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/BuiltInRuleVerificationSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/BuiltInRuleVerificationSerializer.cs index ea17a9ada..fe05b68a0 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/BuiltInRuleVerificationSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/BuiltInRuleVerificationSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class BuiltInRuleVerificationSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a BuiltInRuleVerification", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of BuiltInRuleVerification."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of BuiltInRuleVerification since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/CategorySerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/CategorySerializer.cs index e159430a3..cc55acb33 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/CategorySerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/CategorySerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class CategorySerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a Category", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of Category."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of Category since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ChangeProposalSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ChangeProposalSerializer.cs index e54c961e7..1ce320507 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ChangeProposalSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ChangeProposalSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ChangeProposalSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ChangeProposal", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ChangeProposal."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ChangeProposal since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ChangeRequestSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ChangeRequestSerializer.cs index 308bc002c..a6f60e1fc 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ChangeRequestSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ChangeRequestSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ChangeRequestSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ChangeRequest", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ChangeRequest."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ChangeRequest since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/CitationSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/CitationSerializer.cs index 40af0fdb1..9c255fc30 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/CitationSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/CitationSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class CitationSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a Citation", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of Citation."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of Citation since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ColorSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ColorSerializer.cs index 0fe2f658b..a30ee38eb 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ColorSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ColorSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ColorSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a Color", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of Color."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of Color since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/CommonFileStoreSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/CommonFileStoreSerializer.cs index 7104c4942..6bd8f03fb 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/CommonFileStoreSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/CommonFileStoreSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class CommonFileStoreSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a CommonFileStore", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of CommonFileStore."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of CommonFileStore since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/CompoundParameterTypeSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/CompoundParameterTypeSerializer.cs index 7f3dbc595..a21a5318c 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/CompoundParameterTypeSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/CompoundParameterTypeSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class CompoundParameterTypeSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a CompoundParameterType", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of CompoundParameterType."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of CompoundParameterType since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ConstantSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ConstantSerializer.cs index b4425495f..66e881da0 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ConstantSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ConstantSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ConstantSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a Constant", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of Constant."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of Constant since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ContractChangeNoticeSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ContractChangeNoticeSerializer.cs index 6cb9fd11a..1c39b5553 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ContractChangeNoticeSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ContractChangeNoticeSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ContractChangeNoticeSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ContractChangeNotice", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ContractChangeNotice."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ContractChangeNotice since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/CyclicRatioScaleSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/CyclicRatioScaleSerializer.cs index ce4d2cb94..45824187c 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/CyclicRatioScaleSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/CyclicRatioScaleSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class CyclicRatioScaleSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a CyclicRatioScale", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of CyclicRatioScale."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of CyclicRatioScale since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/DateParameterTypeSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/DateParameterTypeSerializer.cs index 760e45790..4310262d9 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/DateParameterTypeSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/DateParameterTypeSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class DateParameterTypeSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a DateParameterType", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of DateParameterType."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of DateParameterType since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/DateTimeParameterTypeSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/DateTimeParameterTypeSerializer.cs index 6a4f2e03e..382ccc97b 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/DateTimeParameterTypeSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/DateTimeParameterTypeSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class DateTimeParameterTypeSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a DateTimeParameterType", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of DateTimeParameterType."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of DateTimeParameterType since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/DecompositionRuleSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/DecompositionRuleSerializer.cs index 15c70da75..e0c22aaf4 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/DecompositionRuleSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/DecompositionRuleSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class DecompositionRuleSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a DecompositionRule", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of DecompositionRule."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of DecompositionRule since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/DefinitionSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/DefinitionSerializer.cs index ca8058d46..fadd0fa6f 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/DefinitionSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/DefinitionSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class DefinitionSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a Definition", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of Definition."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of Definition since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/DependentParameterTypeAssignmentSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/DependentParameterTypeAssignmentSerializer.cs index 8e595bd50..4e97b8ed9 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/DependentParameterTypeAssignmentSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/DependentParameterTypeAssignmentSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class DependentParameterTypeAssignmentSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.2.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a DependentParameterTypeAssignment", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.2.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of DependentParameterTypeAssignment."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of DependentParameterTypeAssignment since Version is below 1.2.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/DerivedQuantityKindSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/DerivedQuantityKindSerializer.cs index 34f843a9e..059c6ed9d 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/DerivedQuantityKindSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/DerivedQuantityKindSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class DerivedQuantityKindSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a DerivedQuantityKind", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of DerivedQuantityKind."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of DerivedQuantityKind since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/DerivedUnitSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/DerivedUnitSerializer.cs index 5b1d7f0c1..c112d9b7f 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/DerivedUnitSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/DerivedUnitSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class DerivedUnitSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a DerivedUnit", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of DerivedUnit."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of DerivedUnit since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/DiagramCanvasSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/DiagramCanvasSerializer.cs index a6cd44377..917889ad2 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/DiagramCanvasSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/DiagramCanvasSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class DiagramCanvasSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a DiagramCanvas", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of DiagramCanvas."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of DiagramCanvas since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/DiagramEdgeSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/DiagramEdgeSerializer.cs index 895eb57d2..8e4d6061f 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/DiagramEdgeSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/DiagramEdgeSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class DiagramEdgeSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a DiagramEdge", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of DiagramEdge."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of DiagramEdge since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/DiagramObjectSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/DiagramObjectSerializer.cs index 8143e6a82..2f0ef799f 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/DiagramObjectSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/DiagramObjectSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class DiagramObjectSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a DiagramObject", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of DiagramObject."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of DiagramObject since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/DomainFileStoreSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/DomainFileStoreSerializer.cs index 5f81ab4f7..5f19382a0 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/DomainFileStoreSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/DomainFileStoreSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class DomainFileStoreSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a DomainFileStore", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of DomainFileStore."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of DomainFileStore since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/DomainOfExpertiseGroupSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/DomainOfExpertiseGroupSerializer.cs index c9667147f..b74c9795a 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/DomainOfExpertiseGroupSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/DomainOfExpertiseGroupSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class DomainOfExpertiseGroupSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a DomainOfExpertiseGroup", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of DomainOfExpertiseGroup."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of DomainOfExpertiseGroup since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/DomainOfExpertiseSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/DomainOfExpertiseSerializer.cs index c41b9dbc3..599285a67 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/DomainOfExpertiseSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/DomainOfExpertiseSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class DomainOfExpertiseSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a DomainOfExpertise", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of DomainOfExpertise."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of DomainOfExpertise since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ElementDefinitionSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ElementDefinitionSerializer.cs index b6961ed99..f59e87469 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ElementDefinitionSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ElementDefinitionSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ElementDefinitionSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ElementDefinition", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ElementDefinition."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ElementDefinition since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ElementUsageSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ElementUsageSerializer.cs index 94f472574..7051b9913 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ElementUsageSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ElementUsageSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ElementUsageSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ElementUsage", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ElementUsage."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ElementUsage since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/EmailAddressSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/EmailAddressSerializer.cs index bd1163b07..f246bea4d 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/EmailAddressSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/EmailAddressSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class EmailAddressSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a EmailAddress", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of EmailAddress."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of EmailAddress since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/EngineeringModelDataDiscussionItemSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/EngineeringModelDataDiscussionItemSerializer.cs index b7a0eb433..f11e6531a 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/EngineeringModelDataDiscussionItemSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/EngineeringModelDataDiscussionItemSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class EngineeringModelDataDiscussionItemSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a EngineeringModelDataDiscussionItem", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of EngineeringModelDataDiscussionItem."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of EngineeringModelDataDiscussionItem since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/EngineeringModelDataNoteSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/EngineeringModelDataNoteSerializer.cs index 154c5b0c1..82da9c1a9 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/EngineeringModelDataNoteSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/EngineeringModelDataNoteSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class EngineeringModelDataNoteSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a EngineeringModelDataNote", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of EngineeringModelDataNote."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of EngineeringModelDataNote since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/EngineeringModelSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/EngineeringModelSerializer.cs index 5acc4b77f..51c02e39a 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/EngineeringModelSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/EngineeringModelSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class EngineeringModelSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a EngineeringModel", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of EngineeringModel."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of EngineeringModel since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/EngineeringModelSetupSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/EngineeringModelSetupSerializer.cs index c25f19b4b..b2744c810 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/EngineeringModelSetupSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/EngineeringModelSetupSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class EngineeringModelSetupSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a EngineeringModelSetup", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of EngineeringModelSetup."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of EngineeringModelSetup since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/EnumerationParameterTypeSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/EnumerationParameterTypeSerializer.cs index 7f530a8b7..baa824208 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/EnumerationParameterTypeSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/EnumerationParameterTypeSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class EnumerationParameterTypeSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a EnumerationParameterType", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of EnumerationParameterType."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of EnumerationParameterType since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/EnumerationValueDefinitionSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/EnumerationValueDefinitionSerializer.cs index 4c23cbca8..d378b0aae 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/EnumerationValueDefinitionSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/EnumerationValueDefinitionSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class EnumerationValueDefinitionSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a EnumerationValueDefinition", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of EnumerationValueDefinition."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of EnumerationValueDefinition since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ExclusiveOrExpressionSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ExclusiveOrExpressionSerializer.cs index d9d3732ab..3bb4ce09a 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ExclusiveOrExpressionSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ExclusiveOrExpressionSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ExclusiveOrExpressionSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ExclusiveOrExpression", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ExclusiveOrExpression."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ExclusiveOrExpression since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ExternalIdentifierMapSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ExternalIdentifierMapSerializer.cs index 6ffeb5fc0..c267b5b5e 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ExternalIdentifierMapSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ExternalIdentifierMapSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ExternalIdentifierMapSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ExternalIdentifierMap", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ExternalIdentifierMap."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ExternalIdentifierMap since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/FileRevisionSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/FileRevisionSerializer.cs index 5c6333c05..d923a98bf 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/FileRevisionSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/FileRevisionSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class FileRevisionSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a FileRevision", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of FileRevision."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of FileRevision since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/FileSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/FileSerializer.cs index 4e77b2aad..bdcdec3eb 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/FileSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/FileSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class FileSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a File", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of File."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of File since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/FileTypeSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/FileTypeSerializer.cs index 91c6feffa..6e7a0c35f 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/FileTypeSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/FileTypeSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class FileTypeSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a FileType", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of FileType."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of FileType since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/FolderSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/FolderSerializer.cs index 7ad26feb4..9adee42ae 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/FolderSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/FolderSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class FolderSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a Folder", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of Folder."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of Folder since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/GlossarySerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/GlossarySerializer.cs index 356b31da8..94db94404 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/GlossarySerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/GlossarySerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class GlossarySerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a Glossary", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of Glossary."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of Glossary since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/GoalSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/GoalSerializer.cs index 5c0edcb97..75cd0cc56 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/GoalSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/GoalSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class GoalSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a Goal", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of Goal."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of Goal since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/HyperLinkSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/HyperLinkSerializer.cs index 7b306e4ba..12ec0a0ab 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/HyperLinkSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/HyperLinkSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class HyperLinkSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a HyperLink", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of HyperLink."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of HyperLink since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/IdCorrespondenceSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/IdCorrespondenceSerializer.cs index cda931b33..facb617b4 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/IdCorrespondenceSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/IdCorrespondenceSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class IdCorrespondenceSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a IdCorrespondence", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of IdCorrespondence."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of IdCorrespondence since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/IndependentParameterTypeAssignmentSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/IndependentParameterTypeAssignmentSerializer.cs index cd10954ea..009036c37 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/IndependentParameterTypeAssignmentSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/IndependentParameterTypeAssignmentSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class IndependentParameterTypeAssignmentSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.2.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a IndependentParameterTypeAssignment", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.2.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of IndependentParameterTypeAssignment."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of IndependentParameterTypeAssignment since Version is below 1.2.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/IntervalScaleSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/IntervalScaleSerializer.cs index b3747c45e..f342628ad 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/IntervalScaleSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/IntervalScaleSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class IntervalScaleSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a IntervalScale", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of IntervalScale."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of IntervalScale since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/IterationSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/IterationSerializer.cs index fc4e243df..04e48b1dd 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/IterationSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/IterationSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class IterationSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a Iteration", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of Iteration."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of Iteration since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/IterationSetupSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/IterationSetupSerializer.cs index 94659870e..dd1b513e5 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/IterationSetupSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/IterationSetupSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class IterationSetupSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a IterationSetup", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of IterationSetup."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of IterationSetup since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/LinearConversionUnitSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/LinearConversionUnitSerializer.cs index 7a02a38ea..9316266a9 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/LinearConversionUnitSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/LinearConversionUnitSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class LinearConversionUnitSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a LinearConversionUnit", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of LinearConversionUnit."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of LinearConversionUnit since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/LogEntryChangelogItemSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/LogEntryChangelogItemSerializer.cs index e7cef7530..aef472fe9 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/LogEntryChangelogItemSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/LogEntryChangelogItemSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class LogEntryChangelogItemSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.2.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a LogEntryChangelogItem", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.2.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of LogEntryChangelogItem."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of LogEntryChangelogItem since Version is below 1.2.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/LogarithmicScaleSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/LogarithmicScaleSerializer.cs index 5c04086d2..1576215be 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/LogarithmicScaleSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/LogarithmicScaleSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class LogarithmicScaleSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a LogarithmicScale", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of LogarithmicScale."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of LogarithmicScale since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/MappingToReferenceScaleSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/MappingToReferenceScaleSerializer.cs index 8aaddf4f7..43f6de80b 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/MappingToReferenceScaleSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/MappingToReferenceScaleSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class MappingToReferenceScaleSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a MappingToReferenceScale", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of MappingToReferenceScale."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of MappingToReferenceScale since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ModelLogEntrySerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ModelLogEntrySerializer.cs index e16d5dd13..05cc1c703 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ModelLogEntrySerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ModelLogEntrySerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ModelLogEntrySerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ModelLogEntry", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ModelLogEntry."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ModelLogEntry since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ModelReferenceDataLibrarySerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ModelReferenceDataLibrarySerializer.cs index 5090210aa..e0c3ae6e4 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ModelReferenceDataLibrarySerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ModelReferenceDataLibrarySerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ModelReferenceDataLibrarySerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ModelReferenceDataLibrary", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ModelReferenceDataLibrary."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ModelReferenceDataLibrary since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ModellingThingReferenceSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ModellingThingReferenceSerializer.cs index 638d266a4..cd8d424a4 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ModellingThingReferenceSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ModellingThingReferenceSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ModellingThingReferenceSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ModellingThingReference", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ModellingThingReference."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ModellingThingReference since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/MultiRelationshipRuleSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/MultiRelationshipRuleSerializer.cs index d521b762d..8cf6cca31 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/MultiRelationshipRuleSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/MultiRelationshipRuleSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class MultiRelationshipRuleSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a MultiRelationshipRule", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of MultiRelationshipRule."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of MultiRelationshipRule since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/MultiRelationshipSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/MultiRelationshipSerializer.cs index 732b37b4c..c3900ad34 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/MultiRelationshipSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/MultiRelationshipSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class MultiRelationshipSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a MultiRelationship", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of MultiRelationship."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of MultiRelationship since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/NaturalLanguageSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/NaturalLanguageSerializer.cs index 97c4f8f18..65c9c7b5c 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/NaturalLanguageSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/NaturalLanguageSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class NaturalLanguageSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a NaturalLanguage", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of NaturalLanguage."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of NaturalLanguage since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/NestedElementSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/NestedElementSerializer.cs index 700477336..84fd12866 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/NestedElementSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/NestedElementSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class NestedElementSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a NestedElement", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of NestedElement."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of NestedElement since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/NestedParameterSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/NestedParameterSerializer.cs index c4ba39bb4..bc44d710e 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/NestedParameterSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/NestedParameterSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class NestedParameterSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a NestedParameter", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of NestedParameter."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of NestedParameter since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/NotExpressionSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/NotExpressionSerializer.cs index ea3fb15eb..02753f1f6 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/NotExpressionSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/NotExpressionSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class NotExpressionSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a NotExpression", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of NotExpression."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of NotExpression since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/OptionSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/OptionSerializer.cs index 462a94291..e7ccabf15 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/OptionSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/OptionSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class OptionSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a Option", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of Option."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of Option since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/OrExpressionSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/OrExpressionSerializer.cs index c53f2c030..b3d2f6768 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/OrExpressionSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/OrExpressionSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class OrExpressionSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a OrExpression", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of OrExpression."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of OrExpression since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/OrdinalScaleSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/OrdinalScaleSerializer.cs index 14c6f5b02..e45f32f7d 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/OrdinalScaleSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/OrdinalScaleSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class OrdinalScaleSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a OrdinalScale", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of OrdinalScale."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of OrdinalScale since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/OrganizationSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/OrganizationSerializer.cs index 2111dc5a6..03e301618 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/OrganizationSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/OrganizationSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class OrganizationSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a Organization", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of Organization."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of Organization since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/OrganizationalParticipantSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/OrganizationalParticipantSerializer.cs index 4cec229c8..41882f887 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/OrganizationalParticipantSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/OrganizationalParticipantSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class OrganizationalParticipantSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.2.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a OrganizationalParticipant", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.2.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of OrganizationalParticipant."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of OrganizationalParticipant since Version is below 1.2.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/OwnedStyleSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/OwnedStyleSerializer.cs index 1c4c03ca2..97065e4ca 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/OwnedStyleSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/OwnedStyleSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class OwnedStyleSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a OwnedStyle", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of OwnedStyle."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of OwnedStyle since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/PageSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/PageSerializer.cs index d537ba163..0145b989b 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/PageSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/PageSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class PageSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a Page", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of Page."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of Page since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterGroupSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterGroupSerializer.cs index aef6bc3f7..1b5766f96 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterGroupSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterGroupSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ParameterGroupSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ParameterGroup", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ParameterGroup."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ParameterGroup since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterOverrideSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterOverrideSerializer.cs index 1aaeb7a16..bd885dd9d 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterOverrideSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterOverrideSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ParameterOverrideSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ParameterOverride", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ParameterOverride."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ParameterOverride since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterOverrideValueSetSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterOverrideValueSetSerializer.cs index 3de5898cf..6df67a5b7 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterOverrideValueSetSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterOverrideValueSetSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ParameterOverrideValueSetSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ParameterOverrideValueSet", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ParameterOverrideValueSet."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ParameterOverrideValueSet since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterSerializer.cs index e0f315673..745cd888d 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ParameterSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a Parameter", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of Parameter."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of Parameter since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterSubscriptionSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterSubscriptionSerializer.cs index 1f6f3b9f2..31843c6c3 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterSubscriptionSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterSubscriptionSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ParameterSubscriptionSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ParameterSubscription", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ParameterSubscription."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ParameterSubscription since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterSubscriptionValueSetSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterSubscriptionValueSetSerializer.cs index 01180b858..702f1096c 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterSubscriptionValueSetSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterSubscriptionValueSetSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ParameterSubscriptionValueSetSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ParameterSubscriptionValueSet", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ParameterSubscriptionValueSet."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ParameterSubscriptionValueSet since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterTypeComponentSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterTypeComponentSerializer.cs index cf56b41e4..af143ec3c 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterTypeComponentSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterTypeComponentSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ParameterTypeComponentSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ParameterTypeComponent", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ParameterTypeComponent."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ParameterTypeComponent since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterValueSetSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterValueSetSerializer.cs index 4f9a06cca..bdf128dfa 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterValueSetSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterValueSetSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ParameterValueSetSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ParameterValueSet", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ParameterValueSet."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ParameterValueSet since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterizedCategoryRuleSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterizedCategoryRuleSerializer.cs index 8eb7102a9..ff1f730c2 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterizedCategoryRuleSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ParameterizedCategoryRuleSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ParameterizedCategoryRuleSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ParameterizedCategoryRule", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ParameterizedCategoryRule."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ParameterizedCategoryRule since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ParametricConstraintSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ParametricConstraintSerializer.cs index 0a34725d8..c9f9a5616 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ParametricConstraintSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ParametricConstraintSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ParametricConstraintSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ParametricConstraint", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ParametricConstraint."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ParametricConstraint since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ParticipantPermissionSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ParticipantPermissionSerializer.cs index 83c426295..8ae023350 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ParticipantPermissionSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ParticipantPermissionSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ParticipantPermissionSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ParticipantPermission", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ParticipantPermission."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ParticipantPermission since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ParticipantRoleSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ParticipantRoleSerializer.cs index f3eca8f1e..20c6912cf 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ParticipantRoleSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ParticipantRoleSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ParticipantRoleSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ParticipantRole", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ParticipantRole."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ParticipantRole since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ParticipantSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ParticipantSerializer.cs index dc27bc41e..e6a1ac2c9 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ParticipantSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ParticipantSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ParticipantSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a Participant", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of Participant."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of Participant since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/PersonPermissionSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/PersonPermissionSerializer.cs index 0de2a6cc1..d9e5e85b8 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/PersonPermissionSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/PersonPermissionSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class PersonPermissionSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a PersonPermission", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of PersonPermission."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of PersonPermission since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/PersonRoleSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/PersonRoleSerializer.cs index 627d79e01..9f95cfae6 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/PersonRoleSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/PersonRoleSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class PersonRoleSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a PersonRole", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of PersonRole."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of PersonRole since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/PersonSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/PersonSerializer.cs index 24d9f7b85..d442f541b 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/PersonSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/PersonSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class PersonSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a Person", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of Person."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of Person since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/PointSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/PointSerializer.cs index 8e0a4f390..b5fa7ed99 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/PointSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/PointSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class PointSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a Point", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of Point."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of Point since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/PossibleFiniteStateListSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/PossibleFiniteStateListSerializer.cs index 7c5b1aa45..b37eb8983 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/PossibleFiniteStateListSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/PossibleFiniteStateListSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class PossibleFiniteStateListSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a PossibleFiniteStateList", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of PossibleFiniteStateList."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of PossibleFiniteStateList since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/PossibleFiniteStateSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/PossibleFiniteStateSerializer.cs index cb8f53322..a420eaaa3 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/PossibleFiniteStateSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/PossibleFiniteStateSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class PossibleFiniteStateSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a PossibleFiniteState", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of PossibleFiniteState."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of PossibleFiniteState since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/PrefixedUnitSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/PrefixedUnitSerializer.cs index dfd6323e3..68d70bb57 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/PrefixedUnitSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/PrefixedUnitSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class PrefixedUnitSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a PrefixedUnit", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of PrefixedUnit."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of PrefixedUnit since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/PublicationSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/PublicationSerializer.cs index b3ba81a33..10c69f263 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/PublicationSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/PublicationSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class PublicationSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a Publication", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of Publication."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of Publication since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/QuantityKindFactorSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/QuantityKindFactorSerializer.cs index 113010aec..2a15e45d8 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/QuantityKindFactorSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/QuantityKindFactorSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class QuantityKindFactorSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a QuantityKindFactor", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of QuantityKindFactor."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of QuantityKindFactor since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/RatioScaleSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/RatioScaleSerializer.cs index 169695b8a..2b09acc5c 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/RatioScaleSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/RatioScaleSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class RatioScaleSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a RatioScale", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of RatioScale."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of RatioScale since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ReferenceSourceSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ReferenceSourceSerializer.cs index 421178168..29ed4961f 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ReferenceSourceSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ReferenceSourceSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ReferenceSourceSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ReferenceSource", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ReferenceSource."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ReferenceSource since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ReferencerRuleSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ReferencerRuleSerializer.cs index a11d1a27f..cc796d870 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ReferencerRuleSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ReferencerRuleSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ReferencerRuleSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ReferencerRule", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ReferencerRule."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ReferencerRule since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/RelationalExpressionSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/RelationalExpressionSerializer.cs index 3c0e5e4f4..091764438 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/RelationalExpressionSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/RelationalExpressionSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class RelationalExpressionSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a RelationalExpression", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of RelationalExpression."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of RelationalExpression since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/RelationshipParameterValueSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/RelationshipParameterValueSerializer.cs index cdb206dde..98d7b841b 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/RelationshipParameterValueSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/RelationshipParameterValueSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class RelationshipParameterValueSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a RelationshipParameterValue", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of RelationshipParameterValue."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of RelationshipParameterValue since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/RequestForDeviationSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/RequestForDeviationSerializer.cs index 099c10c3e..7ea791a3f 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/RequestForDeviationSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/RequestForDeviationSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class RequestForDeviationSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a RequestForDeviation", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of RequestForDeviation."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of RequestForDeviation since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/RequestForWaiverSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/RequestForWaiverSerializer.cs index a78bc243e..129663b11 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/RequestForWaiverSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/RequestForWaiverSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class RequestForWaiverSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a RequestForWaiver", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of RequestForWaiver."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of RequestForWaiver since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/RequirementSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/RequirementSerializer.cs index 30c9ab01b..2b8c1a8e0 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/RequirementSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/RequirementSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class RequirementSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a Requirement", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of Requirement."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of Requirement since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/RequirementsContainerParameterValueSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/RequirementsContainerParameterValueSerializer.cs index 56b76c3a6..cb5df63b2 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/RequirementsContainerParameterValueSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/RequirementsContainerParameterValueSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class RequirementsContainerParameterValueSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a RequirementsContainerParameterValue", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of RequirementsContainerParameterValue."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of RequirementsContainerParameterValue since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/RequirementsGroupSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/RequirementsGroupSerializer.cs index d4581e74d..f32a253ca 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/RequirementsGroupSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/RequirementsGroupSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class RequirementsGroupSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a RequirementsGroup", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of RequirementsGroup."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of RequirementsGroup since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/RequirementsSpecificationSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/RequirementsSpecificationSerializer.cs index ca7ec651d..62cf715f3 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/RequirementsSpecificationSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/RequirementsSpecificationSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class RequirementsSpecificationSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a RequirementsSpecification", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of RequirementsSpecification."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of RequirementsSpecification since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ReviewItemDiscrepancySerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ReviewItemDiscrepancySerializer.cs index 9f2eb119b..12711c378 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ReviewItemDiscrepancySerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ReviewItemDiscrepancySerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ReviewItemDiscrepancySerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ReviewItemDiscrepancy", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ReviewItemDiscrepancy."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ReviewItemDiscrepancy since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/RuleVerificationListSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/RuleVerificationListSerializer.cs index edc4da66a..fba32f31b 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/RuleVerificationListSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/RuleVerificationListSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class RuleVerificationListSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a RuleVerificationList", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of RuleVerificationList."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of RuleVerificationList since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/RuleViolationSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/RuleViolationSerializer.cs index 88351483d..a598e3763 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/RuleViolationSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/RuleViolationSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class RuleViolationSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a RuleViolation", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of RuleViolation."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of RuleViolation since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/SampledFunctionParameterTypeSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/SampledFunctionParameterTypeSerializer.cs index b28caf532..2e08bba00 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/SampledFunctionParameterTypeSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/SampledFunctionParameterTypeSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class SampledFunctionParameterTypeSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.2.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a SampledFunctionParameterType", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.2.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of SampledFunctionParameterType."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of SampledFunctionParameterType since Version is below 1.2.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ScaleReferenceQuantityValueSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ScaleReferenceQuantityValueSerializer.cs index 07f15a290..2cc11f6a2 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ScaleReferenceQuantityValueSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ScaleReferenceQuantityValueSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ScaleReferenceQuantityValueSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ScaleReferenceQuantityValue", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ScaleReferenceQuantityValue."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ScaleReferenceQuantityValue since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ScaleValueDefinitionSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ScaleValueDefinitionSerializer.cs index 73f923029..dd161dafb 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ScaleValueDefinitionSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ScaleValueDefinitionSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ScaleValueDefinitionSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ScaleValueDefinition", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ScaleValueDefinition."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ScaleValueDefinition since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/SectionSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/SectionSerializer.cs index 6b927fe51..2037b6b5b 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/SectionSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/SectionSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class SectionSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a Section", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of Section."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of Section since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/SharedStyleSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/SharedStyleSerializer.cs index e143670a2..ee765f6d4 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/SharedStyleSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/SharedStyleSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class SharedStyleSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a SharedStyle", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of SharedStyle."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of SharedStyle since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/SimpleParameterValueSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/SimpleParameterValueSerializer.cs index 2bbac1977..116186b66 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/SimpleParameterValueSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/SimpleParameterValueSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class SimpleParameterValueSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a SimpleParameterValue", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of SimpleParameterValue."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of SimpleParameterValue since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/SimpleQuantityKindSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/SimpleQuantityKindSerializer.cs index 55a0dc9bf..d5da8cfc2 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/SimpleQuantityKindSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/SimpleQuantityKindSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class SimpleQuantityKindSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a SimpleQuantityKind", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of SimpleQuantityKind."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of SimpleQuantityKind since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/SimpleUnitSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/SimpleUnitSerializer.cs index f38ff1df9..33fc3b205 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/SimpleUnitSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/SimpleUnitSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class SimpleUnitSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a SimpleUnit", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of SimpleUnit."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of SimpleUnit since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/SiteDirectoryDataAnnotationSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/SiteDirectoryDataAnnotationSerializer.cs index 10fdeb21c..f725f429b 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/SiteDirectoryDataAnnotationSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/SiteDirectoryDataAnnotationSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class SiteDirectoryDataAnnotationSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a SiteDirectoryDataAnnotation", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of SiteDirectoryDataAnnotation."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of SiteDirectoryDataAnnotation since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/SiteDirectoryDataDiscussionItemSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/SiteDirectoryDataDiscussionItemSerializer.cs index 712ba3443..abe659e53 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/SiteDirectoryDataDiscussionItemSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/SiteDirectoryDataDiscussionItemSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class SiteDirectoryDataDiscussionItemSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a SiteDirectoryDataDiscussionItem", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of SiteDirectoryDataDiscussionItem."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of SiteDirectoryDataDiscussionItem since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/SiteDirectorySerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/SiteDirectorySerializer.cs index 882e37d3f..a8e87fb3d 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/SiteDirectorySerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/SiteDirectorySerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class SiteDirectorySerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a SiteDirectory", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of SiteDirectory."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of SiteDirectory since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/SiteDirectoryThingReferenceSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/SiteDirectoryThingReferenceSerializer.cs index 9cbdbe6a3..7a6992584 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/SiteDirectoryThingReferenceSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/SiteDirectoryThingReferenceSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class SiteDirectoryThingReferenceSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a SiteDirectoryThingReference", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of SiteDirectoryThingReference."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of SiteDirectoryThingReference since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/SiteLogEntrySerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/SiteLogEntrySerializer.cs index 1b4bec2ef..3bea41e37 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/SiteLogEntrySerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/SiteLogEntrySerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class SiteLogEntrySerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a SiteLogEntry", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of SiteLogEntry."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of SiteLogEntry since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/SiteReferenceDataLibrarySerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/SiteReferenceDataLibrarySerializer.cs index c0ebc3cec..a2f153e66 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/SiteReferenceDataLibrarySerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/SiteReferenceDataLibrarySerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class SiteReferenceDataLibrarySerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a SiteReferenceDataLibrary", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of SiteReferenceDataLibrary."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of SiteReferenceDataLibrary since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/SolutionSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/SolutionSerializer.cs index 2e9e8cca7..211260c1a 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/SolutionSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/SolutionSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class SolutionSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a Solution", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of Solution."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of Solution since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/SpecializedQuantityKindSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/SpecializedQuantityKindSerializer.cs index b5862170f..3a100859b 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/SpecializedQuantityKindSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/SpecializedQuantityKindSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class SpecializedQuantityKindSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a SpecializedQuantityKind", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of SpecializedQuantityKind."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of SpecializedQuantityKind since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/StakeHolderValueMapSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/StakeHolderValueMapSerializer.cs index da44522c3..a129ffbc1 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/StakeHolderValueMapSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/StakeHolderValueMapSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class StakeHolderValueMapSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a StakeHolderValueMap", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of StakeHolderValueMap."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of StakeHolderValueMap since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/StakeHolderValueMapSettingsSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/StakeHolderValueMapSettingsSerializer.cs index 234b07918..2210e26f9 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/StakeHolderValueMapSettingsSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/StakeHolderValueMapSettingsSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class StakeHolderValueMapSettingsSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a StakeHolderValueMapSettings", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of StakeHolderValueMapSettings."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of StakeHolderValueMapSettings since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/StakeholderSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/StakeholderSerializer.cs index c3c201067..906ba8d0d 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/StakeholderSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/StakeholderSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class StakeholderSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a Stakeholder", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of Stakeholder."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of Stakeholder since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/StakeholderValueSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/StakeholderValueSerializer.cs index 3a1feeee1..87a1b966a 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/StakeholderValueSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/StakeholderValueSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class StakeholderValueSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a StakeholderValue", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of StakeholderValue."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of StakeholderValue since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/TelephoneNumberSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/TelephoneNumberSerializer.cs index 4aade4864..099bba9d3 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/TelephoneNumberSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/TelephoneNumberSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class TelephoneNumberSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a TelephoneNumber", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of TelephoneNumber."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of TelephoneNumber since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/TermSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/TermSerializer.cs index 42e15fc06..8211cb823 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/TermSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/TermSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class TermSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a Term", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of Term."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of Term since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/TextParameterTypeSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/TextParameterTypeSerializer.cs index a19cafc60..7d47a3e64 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/TextParameterTypeSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/TextParameterTypeSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class TextParameterTypeSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a TextParameterType", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of TextParameterType."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of TextParameterType since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/TextualNoteSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/TextualNoteSerializer.cs index aa7032dc6..78f665b94 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/TextualNoteSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/TextualNoteSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class TextualNoteSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a TextualNote", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of TextualNote."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of TextualNote since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/TimeOfDayParameterTypeSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/TimeOfDayParameterTypeSerializer.cs index 2af70a333..c66f62fe3 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/TimeOfDayParameterTypeSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/TimeOfDayParameterTypeSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class TimeOfDayParameterTypeSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a TimeOfDayParameterType", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of TimeOfDayParameterType."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of TimeOfDayParameterType since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/UnitFactorSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/UnitFactorSerializer.cs index 4d93a402c..63ae81ea9 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/UnitFactorSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/UnitFactorSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class UnitFactorSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a UnitFactor", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of UnitFactor."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of UnitFactor since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/UnitPrefixSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/UnitPrefixSerializer.cs index 0b840ce1a..5a48c7584 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/UnitPrefixSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/UnitPrefixSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class UnitPrefixSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a UnitPrefix", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of UnitPrefix."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of UnitPrefix since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/UserPreferenceSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/UserPreferenceSerializer.cs index 74bfe286c..600843cfa 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/UserPreferenceSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/UserPreferenceSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class UserPreferenceSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a UserPreference", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of UserPreference."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of UserPreference since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/UserRuleVerificationSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/UserRuleVerificationSerializer.cs index 45b9ab8c0..78fbfa20b 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/UserRuleVerificationSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/UserRuleVerificationSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class UserRuleVerificationSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.0.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a UserRuleVerification", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.0.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of UserRuleVerification."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of UserRuleVerification since Version is below 1.0.0"); return; diff --git a/CDP4JsonSerializer/AutoGenDtoSerializer/ValueGroupSerializer.cs b/CDP4JsonSerializer/AutoGenDtoSerializer/ValueGroupSerializer.cs index 57507be25..24dfcbd78 100644 --- a/CDP4JsonSerializer/AutoGenDtoSerializer/ValueGroupSerializer.cs +++ b/CDP4JsonSerializer/AutoGenDtoSerializer/ValueGroupSerializer.cs @@ -1,5 +1,4 @@ -// ------------------------------------------------------------------------------------------------------------------------------- -// +// -------------------------------------------------------------------------------------------------------------------------------// // Copyright (c) 2015-2024 Starion Group S.A. // // Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar @@ -50,6 +49,19 @@ namespace CDP4JsonSerializer /// public class ValueGroupSerializer : BaseThingSerializer, IThingSerializer { + /// + /// The minimal that is allowed for serialization of a . + /// An error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version minimalAllowedDataModelVersion = Version.Parse("1.0.0"); + + /// + /// The minimal that is allowed for serialization of a . + /// When a Requested Data Model version for Serialization is lower than this, the object will not be Serialized, just ignored. + /// NO error will be thrown when a Requested Data Model version for Serialization is lower than this. + /// + private static Version thingMinimalAllowedDataModelVersion = Version.Parse("1.1.0"); + /// /// Serializes a into an /// @@ -65,7 +77,12 @@ public void Serialize(Thing thing, Utf8JsonWriter writer, Version requestedDataM throw new ArgumentException("The thing shall be a ValueGroup", nameof(thing)); } - if (requestedDataModelVersion < Version.Parse("1.1.0")) + if (requestedDataModelVersion < minimalAllowedDataModelVersion) + { + throw new NotSupportedException($"The provided version {requestedDataModelVersion.ToString(3)} is not supported for serialization of ValueGroup."); + } + + if (requestedDataModelVersion < thingMinimalAllowedDataModelVersion) { Logger.Log(LogLevel.Info, "Skipping serialization of ValueGroup since Version is below 1.1.0"); return; diff --git a/CDP4JsonSerializer/CDP4JsonSerializer.csproj b/CDP4JsonSerializer/CDP4JsonSerializer.csproj index 739c5a4ef..02ac76dde 100644 --- a/CDP4JsonSerializer/CDP4JsonSerializer.csproj +++ b/CDP4JsonSerializer/CDP4JsonSerializer.csproj @@ -28,7 +28,6 @@ -