diff --git a/.editorconfig b/.editorconfig
index 952c68855..bdcd41aff 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -100,14 +100,14 @@ csharp_style_prefer_extended_property_pattern = true:warning
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
csharp_style_prefer_static_local_function = true:suggestion
-csharp_style_expression_bodied_methods = when_on_single_line:suggestion
-csharp_style_expression_bodied_properties = when_on_single_line:suggestion
-csharp_style_expression_bodied_indexers = when_on_single_line:suggestion
-csharp_style_expression_bodied_accessors = when_on_single_line:suggestion
-csharp_style_expression_bodied_operators = when_on_single_line:suggestion
+csharp_style_expression_bodied_methods = false:none
+csharp_style_expression_bodied_properties = false:none
+csharp_style_expression_bodied_indexers = false:none
+csharp_style_expression_bodied_accessors = false:none
+csharp_style_expression_bodied_operators = false:none
csharp_style_expression_bodied_lambdas = when_on_single_line:suggestion
-csharp_style_expression_bodied_local_functions = when_on_single_line:suggestion
-csharp_style_expression_bodied_constructors = false:suggestion
+csharp_style_expression_bodied_local_functions = false:none
+csharp_style_expression_bodied_constructors = false:none
csharp_style_prefer_primary_constructors = false:none
#### 8. XML documentation formatting — Rider: XmlDocFormatter
diff --git a/SySML2.NET.REST/RestClient.cs b/SySML2.NET.REST/RestClient.cs
index 0e62aa321..db8d8c3df 100644
--- a/SySML2.NET.REST/RestClient.cs
+++ b/SySML2.NET.REST/RestClient.cs
@@ -1,4 +1,4 @@
-// -------------------------------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
//
//
// Copyright 2022-2026 Starion Group S.A.
@@ -396,7 +396,10 @@ public async Task> RequestRootElements(Guid project, Guid
///
private async Task> RequestData(Uri requestUri, CancellationToken cancellationToken)
{
- this.logger.LogDebug("request data from: {0}", requestUri);
+ if (this.logger.IsEnabled(LogLevel.Debug))
+ {
+ this.logger.LogDebug("request data from: {0}", requestUri);
+ }
var requestMessage = new HttpRequestMessage()
{
diff --git a/SySML2.NET.REST/SySML2.NET.REST.csproj b/SySML2.NET.REST/SySML2.NET.REST.csproj
index d0872cc6f..337efde82 100644
--- a/SySML2.NET.REST/SySML2.NET.REST.csproj
+++ b/SySML2.NET.REST/SySML2.NET.REST.csproj
@@ -1,35 +1,35 @@
-
-
-
- netstandard2.1;net10.0
- 12.0
- 0.23.0
- A .NET implementation of the OMG SysML v2 REST/HTTP PSM Client
- SysML2.NET.REST
- Starion Group S.A.
- Copyright © Starion Group S.A.
- Apache-2.0
- https://github.com/STARIONGROUP/SysML2.NET.git
- Git
- Sam Gerené
- true
-
- [Update] Aligned with SysML2.NET 0.23.0 - no functional change
-
- cdp4-icon.png
- README.md
- true
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ netstandard2.1;net10.0
+ 14.0
+ 0.23.0
+ A .NET implementation of the OMG SysML v2 REST/HTTP PSM Client
+ SysML2.NET.REST
+ Starion Group S.A.
+ Copyright © Starion Group S.A.
+ Apache-2.0
+ https://github.com/STARIONGROUP/SysML2.NET.git
+ Git
+ Sam Gerené
+ true
+
+ [Update] Aligned with SysML2.NET 0.23.0 - no functional change
+
+ cdp4-icon.png
+ README.md
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenDeSerializer/BranchDeSerializer.cs b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenDeSerializer/BranchDeSerializer.cs
new file mode 100644
index 000000000..28553cf75
--- /dev/null
+++ b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenDeSerializer/BranchDeSerializer.cs
@@ -0,0 +1,296 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class BranchDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static Branch DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("BranchDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var branch = new Branch();
+
+ var idSeen = false;
+ var aliasSeen = false;
+ var createdSeen = false;
+ var deletedSeen = false;
+ var descriptionSeen = false;
+ var headSeen = false;
+ var nameSeen = false;
+ var owningProjectSeen = false;
+ var referencedCommitSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the Branch json object.");
+ }
+
+ if (reader.ValueTextEquals("@id"u8))
+ {
+ idSeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ throw new JsonException("The @id property is null, the Branch cannot be deserialized");
+ }
+
+ branch.Id = Utf8JsonReaderHelper.ReadGuid(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("alias"u8))
+ {
+ aliasSeen = true;
+ reader.Read();
+
+ branch.Alias = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ branch.Alias.Add(reader.GetString());
+ }
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("created"u8))
+ {
+ createdSeen = true;
+ reader.Read();
+
+ branch.Created = Utf8JsonReaderHelper.ReadDateTimeIso8601(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("deleted"u8))
+ {
+ deletedSeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ branch.Deleted = null;
+ }
+ else
+ {
+ branch.Deleted = Utf8JsonReaderHelper.ReadDateTimeIso8601(ref reader);
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("description"u8))
+ {
+ descriptionSeen = true;
+ reader.Read();
+
+ branch.Description = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("head"u8))
+ {
+ headSeen = true;
+ reader.Read();
+
+ if (Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var headValue))
+ {
+ branch.Head = headValue;
+ }
+ else
+ {
+ branch.Head = null;
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("name"u8))
+ {
+ nameSeen = true;
+ reader.Read();
+
+ branch.Name = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("owningProject"u8))
+ {
+ owningProjectSeen = true;
+ reader.Read();
+
+ if (Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var owningProjectValue))
+ {
+ branch.OwningProject = owningProjectValue;
+ }
+ else if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the Branch.owningProject reference is null, the value is left at Guid.Empty");
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("referencedCommit"u8))
+ {
+ referencedCommitSeen = true;
+ reader.Read();
+
+ if (Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var referencedCommitValue))
+ {
+ branch.ReferencedCommit = referencedCommitValue;
+ }
+ else if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the Branch.referencedCommit reference is null, the value is left at Guid.Empty");
+ }
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!idSeen)
+ {
+ logger.LogDebug("the @id Json property was not found in the Branch");
+ }
+
+ if (!aliasSeen)
+ {
+ logger.LogDebug("the alias Json property was not found in the Branch");
+ }
+
+ if (!createdSeen)
+ {
+ logger.LogDebug("the created Json property was not found in the Branch");
+ }
+
+ if (!deletedSeen)
+ {
+ logger.LogDebug("the deleted Json property was not found in the Branch");
+ }
+
+ if (!descriptionSeen)
+ {
+ logger.LogDebug("the description Json property was not found in the Branch");
+ }
+
+ if (!headSeen)
+ {
+ logger.LogDebug("the head Json property was not found in the Branch");
+ }
+
+ if (!nameSeen)
+ {
+ logger.LogDebug("the name Json property was not found in the Branch");
+ }
+
+ if (!owningProjectSeen)
+ {
+ logger.LogDebug("the owningProject Json property was not found in the Branch");
+ }
+
+ if (!referencedCommitSeen)
+ {
+ logger.LogDebug("the referencedCommit Json property was not found in the Branch");
+ }
+
+ }
+
+ return branch;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenDeSerializer/CommitDeSerializer.cs b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenDeSerializer/CommitDeSerializer.cs
new file mode 100644
index 000000000..addc83be8
--- /dev/null
+++ b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenDeSerializer/CommitDeSerializer.cs
@@ -0,0 +1,256 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class CommitDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static Commit DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("CommitDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var commit = new Commit();
+
+ var idSeen = false;
+ var aliasSeen = false;
+ var createdSeen = false;
+ var descriptionSeen = false;
+ var nameSeen = false;
+ var owningProjectSeen = false;
+ var previousCommitSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the Commit json object.");
+ }
+
+ if (reader.ValueTextEquals("@id"u8))
+ {
+ idSeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ throw new JsonException("The @id property is null, the Commit cannot be deserialized");
+ }
+
+ commit.Id = Utf8JsonReaderHelper.ReadGuid(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("alias"u8))
+ {
+ aliasSeen = true;
+ reader.Read();
+
+ commit.Alias = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ commit.Alias.Add(reader.GetString());
+ }
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("created"u8))
+ {
+ createdSeen = true;
+ reader.Read();
+
+ commit.Created = Utf8JsonReaderHelper.ReadDateTimeIso8601(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("description"u8))
+ {
+ descriptionSeen = true;
+ reader.Read();
+
+ commit.Description = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("name"u8))
+ {
+ nameSeen = true;
+ reader.Read();
+
+ commit.Name = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("owningProject"u8))
+ {
+ owningProjectSeen = true;
+ reader.Read();
+
+ if (Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var owningProjectValue))
+ {
+ commit.OwningProject = owningProjectValue;
+ }
+ else if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the Commit.owningProject reference is null, the value is left at Guid.Empty");
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("previousCommit"u8))
+ {
+ previousCommitSeen = true;
+ reader.Read();
+
+ commit.PreviousCommit = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ if (Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var previousCommitItem))
+ {
+ commit.PreviousCommit.Add(previousCommitItem);
+ }
+ }
+ }
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!idSeen)
+ {
+ logger.LogDebug("the @id Json property was not found in the Commit");
+ }
+
+ if (!aliasSeen)
+ {
+ logger.LogDebug("the alias Json property was not found in the Commit");
+ }
+
+ if (!createdSeen)
+ {
+ logger.LogDebug("the created Json property was not found in the Commit");
+ }
+
+ if (!descriptionSeen)
+ {
+ logger.LogDebug("the description Json property was not found in the Commit");
+ }
+
+ if (!nameSeen)
+ {
+ logger.LogDebug("the name Json property was not found in the Commit");
+ }
+
+ if (!owningProjectSeen)
+ {
+ logger.LogDebug("the owningProject Json property was not found in the Commit");
+ }
+
+ if (!previousCommitSeen)
+ {
+ logger.LogDebug("the previousCommit Json property was not found in the Commit");
+ }
+
+ }
+
+ return commit;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenDeSerializer/CommitRequestDeSerializer.cs b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenDeSerializer/CommitRequestDeSerializer.cs
new file mode 100644
index 000000000..873b2d5cd
--- /dev/null
+++ b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenDeSerializer/CommitRequestDeSerializer.cs
@@ -0,0 +1,193 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class CommitRequestDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static CommitRequest DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("CommitRequestDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var commitRequest = new CommitRequest();
+
+ var aliasSeen = false;
+ var changeSeen = false;
+ var descriptionSeen = false;
+ var nameSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the CommitRequest json object.");
+ }
+
+ if (reader.ValueTextEquals("alias"u8))
+ {
+ aliasSeen = true;
+ reader.Read();
+
+ commitRequest.Alias = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ commitRequest.Alias.Add(reader.GetString());
+ }
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("change"u8))
+ {
+ changeSeen = true;
+ reader.Read();
+
+ commitRequest.Change = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ commitRequest.Change.Add(DataVersionRequestDeSerializer.DeSerialize(ref reader, serializationModeKind, deserializeDerivedProperties, loggerFactory));
+ }
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("description"u8))
+ {
+ descriptionSeen = true;
+ reader.Read();
+
+ commitRequest.Description = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("name"u8))
+ {
+ nameSeen = true;
+ reader.Read();
+
+ commitRequest.Name = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!aliasSeen)
+ {
+ logger.LogDebug("the alias Json property was not found in the CommitRequest");
+ }
+
+ if (!changeSeen)
+ {
+ logger.LogDebug("the change Json property was not found in the CommitRequest");
+ }
+
+ if (!descriptionSeen)
+ {
+ logger.LogDebug("the description Json property was not found in the CommitRequest");
+ }
+
+ if (!nameSeen)
+ {
+ logger.LogDebug("the name Json property was not found in the CommitRequest");
+ }
+
+ }
+
+ return commitRequest;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenDeSerializer/CompositeConstraintDeSerializer.cs b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenDeSerializer/CompositeConstraintDeSerializer.cs
new file mode 100644
index 000000000..78fbfbab0
--- /dev/null
+++ b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenDeSerializer/CompositeConstraintDeSerializer.cs
@@ -0,0 +1,151 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class CompositeConstraintDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static CompositeConstraint DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("CompositeConstraintDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var compositeConstraint = new CompositeConstraint();
+
+ var constraintSeen = false;
+ var operatorSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the CompositeConstraint json object.");
+ }
+
+ if (reader.ValueTextEquals("constraint"u8))
+ {
+ constraintSeen = true;
+ reader.Read();
+
+ compositeConstraint.Constraint = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ compositeConstraint.Constraint.Add((IConstraint)PsmDeSerializationDispatcher.ReadResponse(ref reader, serializationModeKind, deserializeDerivedProperties, loggerFactory));
+ }
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("operator"u8))
+ {
+ operatorSeen = true;
+ reader.Read();
+
+ compositeConstraint.Operator = CompositeConstraintOperatorProvider.Parse(Utf8JsonReaderHelper.ReadStringOrNull(ref reader).AsSpan());
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!constraintSeen)
+ {
+ logger.LogDebug("the constraint Json property was not found in the CompositeConstraint");
+ }
+
+ if (!operatorSeen)
+ {
+ logger.LogDebug("the operator Json property was not found in the CompositeConstraint");
+ }
+
+ }
+
+ return compositeConstraint;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenDeSerializer/DataVersionDeSerializer.cs b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenDeSerializer/DataVersionDeSerializer.cs
new file mode 100644
index 000000000..76cd3228d
--- /dev/null
+++ b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenDeSerializer/DataVersionDeSerializer.cs
@@ -0,0 +1,234 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class DataVersionDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static DataVersion DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("DataVersionDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var dataVersion = new DataVersion();
+
+ var idSeen = false;
+ var aliasSeen = false;
+ var descriptionSeen = false;
+ var identitySeen = false;
+ var nameSeen = false;
+ var payloadSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the DataVersion json object.");
+ }
+
+ if (reader.ValueTextEquals("@id"u8))
+ {
+ idSeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ throw new JsonException("The @id property is null, the DataVersion cannot be deserialized");
+ }
+
+ dataVersion.Id = Utf8JsonReaderHelper.ReadGuid(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("alias"u8))
+ {
+ aliasSeen = true;
+ reader.Read();
+
+ dataVersion.Alias = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ dataVersion.Alias.Add(reader.GetString());
+ }
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("description"u8))
+ {
+ descriptionSeen = true;
+ reader.Read();
+
+ dataVersion.Description = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("identity"u8))
+ {
+ identitySeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ dataVersion.Identity = null;
+ }
+ else
+ {
+ dataVersion.Identity = DataIdentityDeSerializer.DeSerialize(ref reader, serializationModeKind, deserializeDerivedProperties, loggerFactory);
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("name"u8))
+ {
+ nameSeen = true;
+ reader.Read();
+
+ dataVersion.Name = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("payload"u8))
+ {
+ payloadSeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ dataVersion.Payload = null;
+ }
+ else
+ {
+ dataVersion.Payload = PsmDeSerializationDispatcher.ReadData(ref reader, serializationModeKind, deserializeDerivedProperties, loggerFactory);
+ }
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!idSeen)
+ {
+ logger.LogDebug("the @id Json property was not found in the DataVersion");
+ }
+
+ if (!aliasSeen)
+ {
+ logger.LogDebug("the alias Json property was not found in the DataVersion");
+ }
+
+ if (!descriptionSeen)
+ {
+ logger.LogDebug("the description Json property was not found in the DataVersion");
+ }
+
+ if (!identitySeen)
+ {
+ logger.LogDebug("the identity Json property was not found in the DataVersion");
+ }
+
+ if (!nameSeen)
+ {
+ logger.LogDebug("the name Json property was not found in the DataVersion");
+ }
+
+ if (!payloadSeen)
+ {
+ logger.LogDebug("the payload Json property was not found in the DataVersion");
+ }
+
+ }
+
+ return dataVersion;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenDeSerializer/ExternalDataDeSerializer.cs b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenDeSerializer/ExternalDataDeSerializer.cs
new file mode 100644
index 000000000..065994cbd
--- /dev/null
+++ b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenDeSerializer/ExternalDataDeSerializer.cs
@@ -0,0 +1,146 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class ExternalDataDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static ExternalData DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("ExternalDataDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var externalData = new ExternalData();
+
+ var idSeen = false;
+ var resourceIdentifierSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the ExternalData json object.");
+ }
+
+ if (reader.ValueTextEquals("@id"u8))
+ {
+ idSeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ throw new JsonException("The @id property is null, the ExternalData cannot be deserialized");
+ }
+
+ externalData.Id = Utf8JsonReaderHelper.ReadGuid(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("resourceIdentifier"u8))
+ {
+ resourceIdentifierSeen = true;
+ reader.Read();
+
+ externalData.ResourceIdentifier = Utf8JsonReaderHelper.ReadUriOrNull(ref reader);
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!idSeen)
+ {
+ logger.LogDebug("the @id Json property was not found in the ExternalData");
+ }
+
+ if (!resourceIdentifierSeen)
+ {
+ logger.LogDebug("the resourceIdentifier Json property was not found in the ExternalData");
+ }
+
+ }
+
+ return externalData;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenDeSerializer/PrimitiveConstraintDeSerializer.cs b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenDeSerializer/PrimitiveConstraintDeSerializer.cs
new file mode 100644
index 000000000..34089fb25
--- /dev/null
+++ b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenDeSerializer/PrimitiveConstraintDeSerializer.cs
@@ -0,0 +1,183 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class PrimitiveConstraintDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static PrimitiveConstraint DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("PrimitiveConstraintDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var primitiveConstraint = new PrimitiveConstraint();
+
+ var inverseSeen = false;
+ var operatorSeen = false;
+ var propertySeen = false;
+ var valueSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the PrimitiveConstraint json object.");
+ }
+
+ if (reader.ValueTextEquals("inverse"u8))
+ {
+ inverseSeen = true;
+ reader.Read();
+
+ primitiveConstraint.Inverse = Utf8JsonReaderHelper.ReadBoolOrNull(ref reader) ?? false;
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("operator"u8))
+ {
+ operatorSeen = true;
+ reader.Read();
+
+ primitiveConstraint.Operator = PrimitiveConstraintOperatorProvider.Parse(Utf8JsonReaderHelper.ReadStringOrNull(ref reader).AsSpan());
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("property"u8))
+ {
+ propertySeen = true;
+ reader.Read();
+
+ primitiveConstraint.Property = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("value"u8))
+ {
+ valueSeen = true;
+ reader.Read();
+
+ primitiveConstraint.Value = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ primitiveConstraint.Value.Add(ConstraintValueReader.Read(ref reader));
+ }
+ }
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!inverseSeen)
+ {
+ logger.LogDebug("the inverse Json property was not found in the PrimitiveConstraint");
+ }
+
+ if (!operatorSeen)
+ {
+ logger.LogDebug("the operator Json property was not found in the PrimitiveConstraint");
+ }
+
+ if (!propertySeen)
+ {
+ logger.LogDebug("the property Json property was not found in the PrimitiveConstraint");
+ }
+
+ if (!valueSeen)
+ {
+ logger.LogDebug("the value Json property was not found in the PrimitiveConstraint");
+ }
+
+ }
+
+ return primitiveConstraint;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenDeSerializer/PrimitiveConstraintRequestDeSerializer.cs b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenDeSerializer/PrimitiveConstraintRequestDeSerializer.cs
new file mode 100644
index 000000000..f53c950a3
--- /dev/null
+++ b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenDeSerializer/PrimitiveConstraintRequestDeSerializer.cs
@@ -0,0 +1,183 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class PrimitiveConstraintRequestDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static PrimitiveConstraintRequest DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("PrimitiveConstraintRequestDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var primitiveConstraintRequest = new PrimitiveConstraintRequest();
+
+ var inverseSeen = false;
+ var operatorSeen = false;
+ var propertySeen = false;
+ var valueSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the PrimitiveConstraintRequest json object.");
+ }
+
+ if (reader.ValueTextEquals("inverse"u8))
+ {
+ inverseSeen = true;
+ reader.Read();
+
+ primitiveConstraintRequest.Inverse = Utf8JsonReaderHelper.ReadBoolOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("operator"u8))
+ {
+ operatorSeen = true;
+ reader.Read();
+
+ primitiveConstraintRequest.Operator = PrimitiveConstraintRequestOperatorProvider.Parse(Utf8JsonReaderHelper.ReadStringOrNull(ref reader).AsSpan());
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("property"u8))
+ {
+ propertySeen = true;
+ reader.Read();
+
+ primitiveConstraintRequest.Property = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("value"u8))
+ {
+ valueSeen = true;
+ reader.Read();
+
+ primitiveConstraintRequest.Value = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ primitiveConstraintRequest.Value.Add(ConstraintValueReader.Read(ref reader));
+ }
+ }
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!inverseSeen)
+ {
+ logger.LogDebug("the inverse Json property was not found in the PrimitiveConstraintRequest");
+ }
+
+ if (!operatorSeen)
+ {
+ logger.LogDebug("the operator Json property was not found in the PrimitiveConstraintRequest");
+ }
+
+ if (!propertySeen)
+ {
+ logger.LogDebug("the property Json property was not found in the PrimitiveConstraintRequest");
+ }
+
+ if (!valueSeen)
+ {
+ logger.LogDebug("the value Json property was not found in the PrimitiveConstraintRequest");
+ }
+
+ }
+
+ return primitiveConstraintRequest;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenEnumProvider/CompositeConstraintOperatorProvider.cs b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenEnumProvider/CompositeConstraintOperatorProvider.cs
new file mode 100644
index 000000000..c51ad7763
--- /dev/null
+++ b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenEnumProvider/CompositeConstraintOperatorProvider.cs
@@ -0,0 +1,151 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Extensions.PSM
+{
+ using System;
+ using System.Buffers;
+ using System.Text;
+
+ using SysML2.NET.PSM.Enumerations;
+
+ ///
+ /// The purpose of the is to convert a
+ /// to and from its representation in the Systems Modeling API and Services
+ ///
+ public static class CompositeConstraintOperatorProvider
+ {
+ ///
+ /// The length in bytes of the longest CompositeConstraintOperator representation
+ ///
+ private const int LongestValueByteLength = 3;
+
+ ///
+ /// Parses the to a
+ ///
+ /// The that is to be parsed.
+ /// A enumeration literal.
+ /// Thrown when the value denotes no literal.
+ public static CompositeConstraintOperator Parse(ReadOnlySpan value)
+ {
+ if (TryParse(value, out var result))
+ {
+ return result;
+ }
+
+ throw new ArgumentException($"'{new string(value)}' is not a valid CompositeConstraintOperator", nameof(value));
+ }
+
+ ///
+ /// Tries to parse the to a
+ ///
+ /// The that is to be parsed.
+ /// The parsed literal, or default when the value denotes none.
+ /// True when the value was parsed.
+ public static bool TryParse(ReadOnlySpan value, out CompositeConstraintOperator result)
+ {
+ if (value.Length == 3 && value.Equals("and".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = CompositeConstraintOperator.and;
+ return true;
+ }
+
+ if (value.Length == 2 && value.Equals("or".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = CompositeConstraintOperator.or;
+ return true;
+ }
+
+ result = default;
+ return false;
+ }
+
+ ///
+ /// Parses the UTF-8 encoded to a
+ ///
+ /// The that is to be parsed.
+ /// A enumeration literal.
+ /// Thrown when the value denotes no literal.
+ public static CompositeConstraintOperator Parse(ReadOnlySpan value)
+ {
+ if (value.Length <= LongestValueByteLength)
+ {
+ Span characters = stackalloc char[LongestValueByteLength];
+
+ var characterCount = Encoding.UTF8.GetChars(value, characters);
+
+ if (TryParse(characters[..characterCount], out var result))
+ {
+ return result;
+ }
+ }
+
+ throw new ArgumentException($"'{Encoding.UTF8.GetString(value)}' is not a valid CompositeConstraintOperator", nameof(value));
+ }
+
+ ///
+ /// Parses the UTF-8 encoded to a
+ ///
+ /// The that is to be parsed.
+ /// A enumeration literal.
+ /// Thrown when the value denotes no literal.
+ public static CompositeConstraintOperator Parse(in ReadOnlySequence value)
+ {
+ if (value.IsSingleSegment)
+ {
+ return Parse(value.FirstSpan);
+ }
+
+ if (value.Length > LongestValueByteLength)
+ {
+ throw new ArgumentException($"a CompositeConstraintOperator is at most {LongestValueByteLength} bytes long", nameof(value));
+ }
+
+ Span buffer = stackalloc byte[LongestValueByteLength];
+ value.CopyTo(buffer);
+
+ return Parse(buffer[..(int)value.Length]);
+ }
+
+ ///
+ /// Converts a to its UTF-8 encoded representation on the wire
+ ///
+ /// The that is to be converted.
+ /// A backed by static UTF-8 data.
+ /// Thrown when the literal is not known.
+ public static ReadOnlySpan ToUtf8Bytes(CompositeConstraintOperator value)
+ {
+ return value switch
+ {
+ CompositeConstraintOperator.and => "and"u8,
+ CompositeConstraintOperator.or => "or"u8,
+ _ => throw new ArgumentOutOfRangeException(nameof(value))
+ };
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenEnumProvider/CompositeConstraintRequestOperatorProvider.cs b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenEnumProvider/CompositeConstraintRequestOperatorProvider.cs
new file mode 100644
index 000000000..ec4259178
--- /dev/null
+++ b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenEnumProvider/CompositeConstraintRequestOperatorProvider.cs
@@ -0,0 +1,151 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Extensions.PSM
+{
+ using System;
+ using System.Buffers;
+ using System.Text;
+
+ using SysML2.NET.PSM.Enumerations;
+
+ ///
+ /// The purpose of the is to convert a
+ /// to and from its representation in the Systems Modeling API and Services
+ ///
+ public static class CompositeConstraintRequestOperatorProvider
+ {
+ ///
+ /// The length in bytes of the longest CompositeConstraintRequestOperator representation
+ ///
+ private const int LongestValueByteLength = 3;
+
+ ///
+ /// Parses the to a
+ ///
+ /// The that is to be parsed.
+ /// A enumeration literal.
+ /// Thrown when the value denotes no literal.
+ public static CompositeConstraintRequestOperator Parse(ReadOnlySpan value)
+ {
+ if (TryParse(value, out var result))
+ {
+ return result;
+ }
+
+ throw new ArgumentException($"'{new string(value)}' is not a valid CompositeConstraintRequestOperator", nameof(value));
+ }
+
+ ///
+ /// Tries to parse the to a
+ ///
+ /// The that is to be parsed.
+ /// The parsed literal, or default when the value denotes none.
+ /// True when the value was parsed.
+ public static bool TryParse(ReadOnlySpan value, out CompositeConstraintRequestOperator result)
+ {
+ if (value.Length == 3 && value.Equals("and".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = CompositeConstraintRequestOperator.and;
+ return true;
+ }
+
+ if (value.Length == 2 && value.Equals("or".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = CompositeConstraintRequestOperator.or;
+ return true;
+ }
+
+ result = default;
+ return false;
+ }
+
+ ///
+ /// Parses the UTF-8 encoded to a
+ ///
+ /// The that is to be parsed.
+ /// A enumeration literal.
+ /// Thrown when the value denotes no literal.
+ public static CompositeConstraintRequestOperator Parse(ReadOnlySpan value)
+ {
+ if (value.Length <= LongestValueByteLength)
+ {
+ Span characters = stackalloc char[LongestValueByteLength];
+
+ var characterCount = Encoding.UTF8.GetChars(value, characters);
+
+ if (TryParse(characters[..characterCount], out var result))
+ {
+ return result;
+ }
+ }
+
+ throw new ArgumentException($"'{Encoding.UTF8.GetString(value)}' is not a valid CompositeConstraintRequestOperator", nameof(value));
+ }
+
+ ///
+ /// Parses the UTF-8 encoded to a
+ ///
+ /// The that is to be parsed.
+ /// A enumeration literal.
+ /// Thrown when the value denotes no literal.
+ public static CompositeConstraintRequestOperator Parse(in ReadOnlySequence value)
+ {
+ if (value.IsSingleSegment)
+ {
+ return Parse(value.FirstSpan);
+ }
+
+ if (value.Length > LongestValueByteLength)
+ {
+ throw new ArgumentException($"a CompositeConstraintRequestOperator is at most {LongestValueByteLength} bytes long", nameof(value));
+ }
+
+ Span buffer = stackalloc byte[LongestValueByteLength];
+ value.CopyTo(buffer);
+
+ return Parse(buffer[..(int)value.Length]);
+ }
+
+ ///
+ /// Converts a to its UTF-8 encoded representation on the wire
+ ///
+ /// The that is to be converted.
+ /// A backed by static UTF-8 data.
+ /// Thrown when the literal is not known.
+ public static ReadOnlySpan ToUtf8Bytes(CompositeConstraintRequestOperator value)
+ {
+ return value switch
+ {
+ CompositeConstraintRequestOperator.and => "and"u8,
+ CompositeConstraintRequestOperator.or => "or"u8,
+ _ => throw new ArgumentOutOfRangeException(nameof(value))
+ };
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenEnumProvider/PrimitiveConstraintOperatorProvider.cs b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenEnumProvider/PrimitiveConstraintOperatorProvider.cs
new file mode 100644
index 000000000..5aaecf3c1
--- /dev/null
+++ b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenEnumProvider/PrimitiveConstraintOperatorProvider.cs
@@ -0,0 +1,186 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Extensions.PSM
+{
+ using System;
+ using System.Buffers;
+ using System.Text;
+
+ using SysML2.NET.PSM.Enumerations;
+
+ ///
+ /// The purpose of the is to convert a
+ /// to and from its representation in the Systems Modeling API and Services
+ ///
+ public static class PrimitiveConstraintOperatorProvider
+ {
+ ///
+ /// The length in bytes of the longest PrimitiveConstraintOperator representation
+ ///
+ private const int LongestValueByteLength = 10;
+
+ ///
+ /// Parses the to a
+ ///
+ /// The that is to be parsed.
+ /// A enumeration literal.
+ /// Thrown when the value denotes no literal.
+ public static PrimitiveConstraintOperator Parse(ReadOnlySpan value)
+ {
+ if (TryParse(value, out var result))
+ {
+ return result;
+ }
+
+ throw new ArgumentException($"'{new string(value)}' is not a valid PrimitiveConstraintOperator", nameof(value));
+ }
+
+ ///
+ /// Tries to parse the to a
+ ///
+ /// The that is to be parsed.
+ /// The parsed literal, or default when the value denotes none.
+ /// True when the value was parsed.
+ public static bool TryParse(ReadOnlySpan value, out PrimitiveConstraintOperator result)
+ {
+ if (value.Length == 1 && value.Equals("<".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = PrimitiveConstraintOperator.lessthan;
+ return true;
+ }
+
+ if (value.Length == 2 && value.Equals("<=".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = PrimitiveConstraintOperator.lessthanorequalto;
+ return true;
+ }
+
+ if (value.Length == 1 && value.Equals("=".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = PrimitiveConstraintOperator.equalto;
+ return true;
+ }
+
+ if (value.Length == 1 && value.Equals(">".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = PrimitiveConstraintOperator.greaterthan;
+ return true;
+ }
+
+ if (value.Length == 2 && value.Equals(">=".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = PrimitiveConstraintOperator.greaterthanorequalto;
+ return true;
+ }
+
+ if (value.Length == 2 && value.Equals("in".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = PrimitiveConstraintOperator.@in;
+ return true;
+ }
+
+ if (value.Length == 10 && value.Equals("instanceOf".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = PrimitiveConstraintOperator.instanceOf;
+ return true;
+ }
+
+ result = default;
+ return false;
+ }
+
+ ///
+ /// Parses the UTF-8 encoded to a
+ ///
+ /// The that is to be parsed.
+ /// A enumeration literal.
+ /// Thrown when the value denotes no literal.
+ public static PrimitiveConstraintOperator Parse(ReadOnlySpan value)
+ {
+ if (value.Length <= LongestValueByteLength)
+ {
+ Span characters = stackalloc char[LongestValueByteLength];
+
+ var characterCount = Encoding.UTF8.GetChars(value, characters);
+
+ if (TryParse(characters[..characterCount], out var result))
+ {
+ return result;
+ }
+ }
+
+ throw new ArgumentException($"'{Encoding.UTF8.GetString(value)}' is not a valid PrimitiveConstraintOperator", nameof(value));
+ }
+
+ ///
+ /// Parses the UTF-8 encoded to a
+ ///
+ /// The that is to be parsed.
+ /// A enumeration literal.
+ /// Thrown when the value denotes no literal.
+ public static PrimitiveConstraintOperator Parse(in ReadOnlySequence value)
+ {
+ if (value.IsSingleSegment)
+ {
+ return Parse(value.FirstSpan);
+ }
+
+ if (value.Length > LongestValueByteLength)
+ {
+ throw new ArgumentException($"a PrimitiveConstraintOperator is at most {LongestValueByteLength} bytes long", nameof(value));
+ }
+
+ Span buffer = stackalloc byte[LongestValueByteLength];
+ value.CopyTo(buffer);
+
+ return Parse(buffer[..(int)value.Length]);
+ }
+
+ ///
+ /// Converts a to its UTF-8 encoded representation on the wire
+ ///
+ /// The that is to be converted.
+ /// A backed by static UTF-8 data.
+ /// Thrown when the literal is not known.
+ public static ReadOnlySpan ToUtf8Bytes(PrimitiveConstraintOperator value)
+ {
+ return value switch
+ {
+ PrimitiveConstraintOperator.lessthan => "<"u8,
+ PrimitiveConstraintOperator.lessthanorequalto => "<="u8,
+ PrimitiveConstraintOperator.equalto => "="u8,
+ PrimitiveConstraintOperator.greaterthan => ">"u8,
+ PrimitiveConstraintOperator.greaterthanorequalto => ">="u8,
+ PrimitiveConstraintOperator.@in => "in"u8,
+ PrimitiveConstraintOperator.instanceOf => "instanceOf"u8,
+ _ => throw new ArgumentOutOfRangeException(nameof(value))
+ };
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenEnumProvider/PrimitiveConstraintRequestOperatorProvider.cs b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenEnumProvider/PrimitiveConstraintRequestOperatorProvider.cs
new file mode 100644
index 000000000..43daa6570
--- /dev/null
+++ b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenEnumProvider/PrimitiveConstraintRequestOperatorProvider.cs
@@ -0,0 +1,186 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Extensions.PSM
+{
+ using System;
+ using System.Buffers;
+ using System.Text;
+
+ using SysML2.NET.PSM.Enumerations;
+
+ ///
+ /// The purpose of the is to convert a
+ /// to and from its representation in the Systems Modeling API and Services
+ ///
+ public static class PrimitiveConstraintRequestOperatorProvider
+ {
+ ///
+ /// The length in bytes of the longest PrimitiveConstraintRequestOperator representation
+ ///
+ private const int LongestValueByteLength = 10;
+
+ ///
+ /// Parses the to a
+ ///
+ /// The that is to be parsed.
+ /// A enumeration literal.
+ /// Thrown when the value denotes no literal.
+ public static PrimitiveConstraintRequestOperator Parse(ReadOnlySpan value)
+ {
+ if (TryParse(value, out var result))
+ {
+ return result;
+ }
+
+ throw new ArgumentException($"'{new string(value)}' is not a valid PrimitiveConstraintRequestOperator", nameof(value));
+ }
+
+ ///
+ /// Tries to parse the to a
+ ///
+ /// The that is to be parsed.
+ /// The parsed literal, or default when the value denotes none.
+ /// True when the value was parsed.
+ public static bool TryParse(ReadOnlySpan value, out PrimitiveConstraintRequestOperator result)
+ {
+ if (value.Length == 1 && value.Equals("<".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = PrimitiveConstraintRequestOperator.lessthan;
+ return true;
+ }
+
+ if (value.Length == 2 && value.Equals("<=".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = PrimitiveConstraintRequestOperator.lessthanorequalto;
+ return true;
+ }
+
+ if (value.Length == 1 && value.Equals("=".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = PrimitiveConstraintRequestOperator.equalto;
+ return true;
+ }
+
+ if (value.Length == 1 && value.Equals(">".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = PrimitiveConstraintRequestOperator.greaterthan;
+ return true;
+ }
+
+ if (value.Length == 2 && value.Equals(">=".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = PrimitiveConstraintRequestOperator.greaterthanorequalto;
+ return true;
+ }
+
+ if (value.Length == 2 && value.Equals("in".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = PrimitiveConstraintRequestOperator.@in;
+ return true;
+ }
+
+ if (value.Length == 10 && value.Equals("instanceOf".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = PrimitiveConstraintRequestOperator.instanceOf;
+ return true;
+ }
+
+ result = default;
+ return false;
+ }
+
+ ///
+ /// Parses the UTF-8 encoded to a
+ ///
+ /// The that is to be parsed.
+ /// A enumeration literal.
+ /// Thrown when the value denotes no literal.
+ public static PrimitiveConstraintRequestOperator Parse(ReadOnlySpan value)
+ {
+ if (value.Length <= LongestValueByteLength)
+ {
+ Span characters = stackalloc char[LongestValueByteLength];
+
+ var characterCount = Encoding.UTF8.GetChars(value, characters);
+
+ if (TryParse(characters[..characterCount], out var result))
+ {
+ return result;
+ }
+ }
+
+ throw new ArgumentException($"'{Encoding.UTF8.GetString(value)}' is not a valid PrimitiveConstraintRequestOperator", nameof(value));
+ }
+
+ ///
+ /// Parses the UTF-8 encoded to a
+ ///
+ /// The that is to be parsed.
+ /// A enumeration literal.
+ /// Thrown when the value denotes no literal.
+ public static PrimitiveConstraintRequestOperator Parse(in ReadOnlySequence value)
+ {
+ if (value.IsSingleSegment)
+ {
+ return Parse(value.FirstSpan);
+ }
+
+ if (value.Length > LongestValueByteLength)
+ {
+ throw new ArgumentException($"a PrimitiveConstraintRequestOperator is at most {LongestValueByteLength} bytes long", nameof(value));
+ }
+
+ Span buffer = stackalloc byte[LongestValueByteLength];
+ value.CopyTo(buffer);
+
+ return Parse(buffer[..(int)value.Length]);
+ }
+
+ ///
+ /// Converts a to its UTF-8 encoded representation on the wire
+ ///
+ /// The that is to be converted.
+ /// A backed by static UTF-8 data.
+ /// Thrown when the literal is not known.
+ public static ReadOnlySpan ToUtf8Bytes(PrimitiveConstraintRequestOperator value)
+ {
+ return value switch
+ {
+ PrimitiveConstraintRequestOperator.lessthan => "<"u8,
+ PrimitiveConstraintRequestOperator.lessthanorequalto => "<="u8,
+ PrimitiveConstraintRequestOperator.equalto => "="u8,
+ PrimitiveConstraintRequestOperator.greaterthan => ">"u8,
+ PrimitiveConstraintRequestOperator.greaterthanorequalto => ">="u8,
+ PrimitiveConstraintRequestOperator.@in => "in"u8,
+ PrimitiveConstraintRequestOperator.instanceOf => "instanceOf"u8,
+ _ => throw new ArgumentOutOfRangeException(nameof(value))
+ };
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenMessagePackFormatter/BranchMessagePackFormatter.cs b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenMessagePackFormatter/BranchMessagePackFormatter.cs
new file mode 100644
index 000000000..fde774bf5
--- /dev/null
+++ b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenMessagePackFormatter/BranchMessagePackFormatter.cs
@@ -0,0 +1,217 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.MessagePack.PSM
+{
+ using System;
+ using System.Collections.Generic;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.Serializer.MessagePack.Core;
+
+ using global::MessagePack;
+ using global::MessagePack.Formatters;
+
+ ///
+ /// The purpose of the is to provide
+ /// the contract for MessagePack serialization of the type
+ ///
+ public class BranchMessagePackFormatter : MessagePackFormatterBase, IMessagePackFormatter
+ {
+ ///
+ /// Serializes a DTO.
+ ///
+ ///
+ /// The to use when serializing the value.
+ ///
+ ///
+ /// The that is to be serialized.
+ ///
+ ///
+ /// The serialization settings to use.
+ ///
+ ///
+ /// Thrown when the DTO is null
+ ///
+ public void Serialize(ref MessagePackWriter writer, Branch branch, MessagePackSerializerOptions options)
+ {
+ if (branch == null)
+ {
+ throw new ArgumentNullException(nameof(branch), "The Branch may not be null");
+ }
+
+ writer.WriteArrayHeader(9);
+
+ WriteGuidBin16(ref writer, branch.Id);
+
+ if (branch.Alias == null)
+ {
+ writer.WriteArrayHeader(0);
+ }
+ else
+ {
+ writer.WriteArrayHeader(branch.Alias.Count);
+
+ foreach (var item in branch.Alias)
+ {
+ writer.Write(item);
+ }
+ }
+
+ writer.Write(branch.Created);
+
+ if (branch.Deleted.HasValue)
+ {
+ writer.Write(branch.Deleted.Value);
+ }
+ else
+ {
+ writer.WriteNil();
+ }
+
+ writer.Write(branch.Description);
+
+ if (branch.Head.HasValue)
+ {
+ WriteGuidBin16(ref writer, branch.Head.Value);
+ }
+ else
+ {
+ writer.WriteNil();
+ }
+
+ writer.Write(branch.Name);
+
+ WriteGuidBin16(ref writer, branch.OwningProject);
+
+ WriteGuidBin16(ref writer, branch.ReferencedCommit);
+
+ writer.Flush();
+ }
+
+ ///
+ /// Deserializes a DTO.
+ ///
+ ///
+ /// The to deserialize the from.
+ ///
+ ///
+ /// The serialization settings to use.
+ ///
+ ///
+ /// The deserialized .
+ ///
+ public Branch Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
+ {
+ if (reader.TryReadNil())
+ {
+ return null;
+ }
+
+ options.Security.DepthStep(ref reader);
+
+ var branch = new Branch();
+
+ var propertyCounter = reader.ReadArrayHeader();
+
+ for (var i = 0; i < propertyCounter; i++)
+ {
+ switch (i)
+ {
+ case 0:
+ branch.Id = ReadGuidBin16(ref reader);
+ break;
+
+ case 1:
+ var aliasLength = reader.ReadArrayHeader();
+ branch.Alias = new List(aliasLength);
+
+ for (var valueCounter = 0; valueCounter < aliasLength; valueCounter++)
+ {
+ branch.Alias.Add(reader.ReadString());
+ }
+
+ break;
+
+ case 2:
+ branch.Created = reader.ReadDateTime();
+ break;
+
+ case 3:
+ if (reader.TryReadNil())
+ {
+ branch.Deleted = null;
+ }
+ else
+ {
+ branch.Deleted = reader.ReadDateTime();
+ }
+
+ break;
+
+ case 4:
+ branch.Description = reader.ReadString();
+ break;
+
+ case 5:
+ if (reader.TryReadNil())
+ {
+ branch.Head = null;
+ }
+ else
+ {
+ branch.Head = ReadGuidBin16(ref reader);
+ }
+
+ break;
+
+ case 6:
+ branch.Name = reader.ReadString();
+ break;
+
+ case 7:
+ branch.OwningProject = ReadGuidBin16(ref reader);
+ break;
+
+ case 8:
+ branch.ReferencedCommit = ReadGuidBin16(ref reader);
+ break;
+
+ default:
+ reader.Skip();
+ break;
+ }
+ }
+
+ reader.Depth--;
+
+ return branch;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenMessagePackFormatter/CommitMessagePackFormatter.cs b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenMessagePackFormatter/CommitMessagePackFormatter.cs
new file mode 100644
index 000000000..7e515feb5
--- /dev/null
+++ b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenMessagePackFormatter/CommitMessagePackFormatter.cs
@@ -0,0 +1,194 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.MessagePack.PSM
+{
+ using System;
+ using System.Collections.Generic;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.Serializer.MessagePack.Core;
+
+ using global::MessagePack;
+ using global::MessagePack.Formatters;
+
+ ///
+ /// The purpose of the is to provide
+ /// the contract for MessagePack serialization of the type
+ ///
+ public class CommitMessagePackFormatter : MessagePackFormatterBase, IMessagePackFormatter
+ {
+ ///
+ /// Serializes a DTO.
+ ///
+ ///
+ /// The to use when serializing the value.
+ ///
+ ///
+ /// The that is to be serialized.
+ ///
+ ///
+ /// The serialization settings to use.
+ ///
+ ///
+ /// Thrown when the DTO is null
+ ///
+ public void Serialize(ref MessagePackWriter writer, Commit commit, MessagePackSerializerOptions options)
+ {
+ if (commit == null)
+ {
+ throw new ArgumentNullException(nameof(commit), "The Commit may not be null");
+ }
+
+ writer.WriteArrayHeader(7);
+
+ WriteGuidBin16(ref writer, commit.Id);
+
+ if (commit.Alias == null)
+ {
+ writer.WriteArrayHeader(0);
+ }
+ else
+ {
+ writer.WriteArrayHeader(commit.Alias.Count);
+
+ foreach (var item in commit.Alias)
+ {
+ writer.Write(item);
+ }
+ }
+
+ writer.Write(commit.Created);
+
+ writer.Write(commit.Description);
+
+ writer.Write(commit.Name);
+
+ WriteGuidBin16(ref writer, commit.OwningProject);
+
+ if (commit.PreviousCommit == null)
+ {
+ writer.WriteArrayHeader(0);
+ }
+ else
+ {
+ writer.WriteArrayHeader(commit.PreviousCommit.Count);
+
+ foreach (var item in commit.PreviousCommit)
+ {
+ WriteGuidBin16(ref writer, item);
+ }
+ }
+
+ writer.Flush();
+ }
+
+ ///
+ /// Deserializes a DTO.
+ ///
+ ///
+ /// The to deserialize the from.
+ ///
+ ///
+ /// The serialization settings to use.
+ ///
+ ///
+ /// The deserialized .
+ ///
+ public Commit Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
+ {
+ if (reader.TryReadNil())
+ {
+ return null;
+ }
+
+ options.Security.DepthStep(ref reader);
+
+ var commit = new Commit();
+
+ var propertyCounter = reader.ReadArrayHeader();
+
+ for (var i = 0; i < propertyCounter; i++)
+ {
+ switch (i)
+ {
+ case 0:
+ commit.Id = ReadGuidBin16(ref reader);
+ break;
+
+ case 1:
+ var aliasLength = reader.ReadArrayHeader();
+ commit.Alias = new List(aliasLength);
+
+ for (var valueCounter = 0; valueCounter < aliasLength; valueCounter++)
+ {
+ commit.Alias.Add(reader.ReadString());
+ }
+
+ break;
+
+ case 2:
+ commit.Created = reader.ReadDateTime();
+ break;
+
+ case 3:
+ commit.Description = reader.ReadString();
+ break;
+
+ case 4:
+ commit.Name = reader.ReadString();
+ break;
+
+ case 5:
+ commit.OwningProject = ReadGuidBin16(ref reader);
+ break;
+
+ case 6:
+ var previousCommitLength = reader.ReadArrayHeader();
+ commit.PreviousCommit = new List(previousCommitLength);
+
+ for (var valueCounter = 0; valueCounter < previousCommitLength; valueCounter++)
+ {
+ commit.PreviousCommit.Add(ReadGuidBin16(ref reader));
+ }
+
+ break;
+
+ default:
+ reader.Skip();
+ break;
+ }
+ }
+
+ reader.Depth--;
+
+ return commit;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenMessagePackFormatter/CommitRequestMessagePackFormatter.cs b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenMessagePackFormatter/CommitRequestMessagePackFormatter.cs
new file mode 100644
index 000000000..fa5da68ef
--- /dev/null
+++ b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenMessagePackFormatter/CommitRequestMessagePackFormatter.cs
@@ -0,0 +1,176 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.MessagePack.PSM
+{
+ using System;
+ using System.Collections.Generic;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.Serializer.MessagePack.Core;
+
+ using global::MessagePack;
+ using global::MessagePack.Formatters;
+
+ ///
+ /// The purpose of the is to provide
+ /// the contract for MessagePack serialization of the type
+ ///
+ public class CommitRequestMessagePackFormatter : MessagePackFormatterBase, IMessagePackFormatter
+ {
+ ///
+ /// Serializes a DTO.
+ ///
+ ///
+ /// The to use when serializing the value.
+ ///
+ ///
+ /// The that is to be serialized.
+ ///
+ ///
+ /// The serialization settings to use.
+ ///
+ ///
+ /// Thrown when the DTO is null
+ ///
+ public void Serialize(ref MessagePackWriter writer, CommitRequest commitRequest, MessagePackSerializerOptions options)
+ {
+ if (commitRequest == null)
+ {
+ throw new ArgumentNullException(nameof(commitRequest), "The CommitRequest may not be null");
+ }
+
+ writer.WriteArrayHeader(4);
+
+ if (commitRequest.Alias == null)
+ {
+ writer.WriteArrayHeader(0);
+ }
+ else
+ {
+ writer.WriteArrayHeader(commitRequest.Alias.Count);
+
+ foreach (var item in commitRequest.Alias)
+ {
+ writer.Write(item);
+ }
+ }
+
+ if (commitRequest.Change == null)
+ {
+ writer.WriteArrayHeader(0);
+ }
+ else
+ {
+ writer.WriteArrayHeader(commitRequest.Change.Count);
+
+ foreach (var item in commitRequest.Change)
+ {
+ options.Resolver.GetFormatterWithVerify().Serialize(ref writer, item, options);
+ }
+ }
+
+ writer.Write(commitRequest.Description);
+
+ writer.Write(commitRequest.Name);
+
+ writer.Flush();
+ }
+
+ ///
+ /// Deserializes a DTO.
+ ///
+ ///
+ /// The to deserialize the from.
+ ///
+ ///
+ /// The serialization settings to use.
+ ///
+ ///
+ /// The deserialized .
+ ///
+ public CommitRequest Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
+ {
+ if (reader.TryReadNil())
+ {
+ return null;
+ }
+
+ options.Security.DepthStep(ref reader);
+
+ var commitRequest = new CommitRequest();
+
+ var propertyCounter = reader.ReadArrayHeader();
+
+ for (var i = 0; i < propertyCounter; i++)
+ {
+ switch (i)
+ {
+ case 0:
+ var aliasLength = reader.ReadArrayHeader();
+ commitRequest.Alias = new List(aliasLength);
+
+ for (var valueCounter = 0; valueCounter < aliasLength; valueCounter++)
+ {
+ commitRequest.Alias.Add(reader.ReadString());
+ }
+
+ break;
+
+ case 1:
+ var changeLength = reader.ReadArrayHeader();
+ commitRequest.Change = new List(changeLength);
+
+ for (var valueCounter = 0; valueCounter < changeLength; valueCounter++)
+ {
+ commitRequest.Change.Add(options.Resolver.GetFormatterWithVerify().Deserialize(ref reader, options));
+ }
+
+ break;
+
+ case 2:
+ commitRequest.Description = reader.ReadString();
+ break;
+
+ case 3:
+ commitRequest.Name = reader.ReadString();
+ break;
+
+ default:
+ reader.Skip();
+ break;
+ }
+ }
+
+ reader.Depth--;
+
+ return commitRequest;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenMessagePackFormatter/CompositeConstraintMessagePackFormatter.cs b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenMessagePackFormatter/CompositeConstraintMessagePackFormatter.cs
new file mode 100644
index 000000000..aa828ae4f
--- /dev/null
+++ b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenMessagePackFormatter/CompositeConstraintMessagePackFormatter.cs
@@ -0,0 +1,145 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.MessagePack.PSM
+{
+ using System;
+ using System.Collections.Generic;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.Serializer.MessagePack.Core;
+
+ using global::MessagePack;
+ using global::MessagePack.Formatters;
+
+ ///
+ /// The purpose of the is to provide
+ /// the contract for MessagePack serialization of the type
+ ///
+ public class CompositeConstraintMessagePackFormatter : MessagePackFormatterBase, IMessagePackFormatter
+ {
+ ///
+ /// Serializes a DTO.
+ ///
+ ///
+ /// The to use when serializing the value.
+ ///
+ ///
+ /// The that is to be serialized.
+ ///
+ ///
+ /// The serialization settings to use.
+ ///
+ ///
+ /// Thrown when the DTO is null
+ ///
+ public void Serialize(ref MessagePackWriter writer, CompositeConstraint compositeConstraint, MessagePackSerializerOptions options)
+ {
+ if (compositeConstraint == null)
+ {
+ throw new ArgumentNullException(nameof(compositeConstraint), "The CompositeConstraint may not be null");
+ }
+
+ writer.WriteArrayHeader(2);
+
+ if (compositeConstraint.Constraint == null)
+ {
+ writer.WriteArrayHeader(0);
+ }
+ else
+ {
+ writer.WriteArrayHeader(compositeConstraint.Constraint.Count);
+
+ foreach (var item in compositeConstraint.Constraint)
+ {
+ PsmMessagePackDispatcher.Write(ref writer, item, options);
+ }
+ }
+
+ writer.WriteString(CompositeConstraintOperatorProvider.ToUtf8Bytes(compositeConstraint.Operator));
+
+ writer.Flush();
+ }
+
+ ///
+ /// Deserializes a DTO.
+ ///
+ ///
+ /// The to deserialize the from.
+ ///
+ ///
+ /// The serialization settings to use.
+ ///
+ ///
+ /// The deserialized .
+ ///
+ public CompositeConstraint Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
+ {
+ if (reader.TryReadNil())
+ {
+ return null;
+ }
+
+ options.Security.DepthStep(ref reader);
+
+ var compositeConstraint = new CompositeConstraint();
+
+ var propertyCounter = reader.ReadArrayHeader();
+
+ for (var i = 0; i < propertyCounter; i++)
+ {
+ switch (i)
+ {
+ case 0:
+ var constraintLength = reader.ReadArrayHeader();
+ compositeConstraint.Constraint = new List(constraintLength);
+
+ for (var valueCounter = 0; valueCounter < constraintLength; valueCounter++)
+ {
+ compositeConstraint.Constraint.Add((IConstraint)PsmMessagePackDispatcher.Read(ref reader, options));
+ }
+
+ break;
+
+ case 1:
+ compositeConstraint.Operator = CompositeConstraintOperatorProvider.Parse(reader.ReadStringSequence().Value);
+ break;
+
+ default:
+ reader.Skip();
+ break;
+ }
+ }
+
+ reader.Depth--;
+
+ return compositeConstraint;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenMessagePackFormatter/DataVersionMessagePackFormatter.cs b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenMessagePackFormatter/DataVersionMessagePackFormatter.cs
new file mode 100644
index 000000000..1d45b6ad5
--- /dev/null
+++ b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenMessagePackFormatter/DataVersionMessagePackFormatter.cs
@@ -0,0 +1,176 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.MessagePack.PSM
+{
+ using System;
+ using System.Collections.Generic;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.Serializer.MessagePack.Core;
+
+ using global::MessagePack;
+ using global::MessagePack.Formatters;
+
+ ///
+ /// The purpose of the is to provide
+ /// the contract for MessagePack serialization of the type
+ ///
+ public class DataVersionMessagePackFormatter : MessagePackFormatterBase, IMessagePackFormatter
+ {
+ ///
+ /// Serializes a DTO.
+ ///
+ ///
+ /// The to use when serializing the value.
+ ///
+ ///
+ /// The that is to be serialized.
+ ///
+ ///
+ /// The serialization settings to use.
+ ///
+ ///
+ /// Thrown when the DTO is null
+ ///
+ public void Serialize(ref MessagePackWriter writer, DataVersion dataVersion, MessagePackSerializerOptions options)
+ {
+ if (dataVersion == null)
+ {
+ throw new ArgumentNullException(nameof(dataVersion), "The DataVersion may not be null");
+ }
+
+ writer.WriteArrayHeader(6);
+
+ WriteGuidBin16(ref writer, dataVersion.Id);
+
+ if (dataVersion.Alias == null)
+ {
+ writer.WriteArrayHeader(0);
+ }
+ else
+ {
+ writer.WriteArrayHeader(dataVersion.Alias.Count);
+
+ foreach (var item in dataVersion.Alias)
+ {
+ writer.Write(item);
+ }
+ }
+
+ writer.Write(dataVersion.Description);
+
+ if (dataVersion.Identity == null)
+ {
+ writer.WriteNil();
+ }
+ else
+ {
+ options.Resolver.GetFormatterWithVerify().Serialize(ref writer, dataVersion.Identity, options);
+ }
+
+ writer.Write(dataVersion.Name);
+
+ PsmMessagePackDispatcher.Write(ref writer, dataVersion.Payload, options);
+
+ writer.Flush();
+ }
+
+ ///
+ /// Deserializes a DTO.
+ ///
+ ///
+ /// The to deserialize the from.
+ ///
+ ///
+ /// The serialization settings to use.
+ ///
+ ///
+ /// The deserialized .
+ ///
+ public DataVersion Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
+ {
+ if (reader.TryReadNil())
+ {
+ return null;
+ }
+
+ options.Security.DepthStep(ref reader);
+
+ var dataVersion = new DataVersion();
+
+ var propertyCounter = reader.ReadArrayHeader();
+
+ for (var i = 0; i < propertyCounter; i++)
+ {
+ switch (i)
+ {
+ case 0:
+ dataVersion.Id = ReadGuidBin16(ref reader);
+ break;
+
+ case 1:
+ var aliasLength = reader.ReadArrayHeader();
+ dataVersion.Alias = new List(aliasLength);
+
+ for (var valueCounter = 0; valueCounter < aliasLength; valueCounter++)
+ {
+ dataVersion.Alias.Add(reader.ReadString());
+ }
+
+ break;
+
+ case 2:
+ dataVersion.Description = reader.ReadString();
+ break;
+
+ case 3:
+ dataVersion.Identity = options.Resolver.GetFormatterWithVerify().Deserialize(ref reader, options);
+ break;
+
+ case 4:
+ dataVersion.Name = reader.ReadString();
+ break;
+
+ case 5:
+ dataVersion.Payload = (SysML2.NET.Common.IData)PsmMessagePackDispatcher.Read(ref reader, options);
+ break;
+
+ default:
+ reader.Skip();
+ break;
+ }
+ }
+
+ reader.Depth--;
+
+ return dataVersion;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenMessagePackFormatter/ExternalDataMessagePackFormatter.cs b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenMessagePackFormatter/ExternalDataMessagePackFormatter.cs
new file mode 100644
index 000000000..8a0813827
--- /dev/null
+++ b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenMessagePackFormatter/ExternalDataMessagePackFormatter.cs
@@ -0,0 +1,126 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.MessagePack.PSM
+{
+ using System;
+ using System.Collections.Generic;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.Serializer.MessagePack.Core;
+
+ using global::MessagePack;
+ using global::MessagePack.Formatters;
+
+ ///
+ /// The purpose of the is to provide
+ /// the contract for MessagePack serialization of the type
+ ///
+ public class ExternalDataMessagePackFormatter : MessagePackFormatterBase, IMessagePackFormatter
+ {
+ ///
+ /// Serializes a DTO.
+ ///
+ ///
+ /// The to use when serializing the value.
+ ///
+ ///
+ /// The that is to be serialized.
+ ///
+ ///
+ /// The serialization settings to use.
+ ///
+ ///
+ /// Thrown when the DTO is null
+ ///
+ public void Serialize(ref MessagePackWriter writer, ExternalData externalData, MessagePackSerializerOptions options)
+ {
+ if (externalData == null)
+ {
+ throw new ArgumentNullException(nameof(externalData), "The ExternalData may not be null");
+ }
+
+ writer.WriteArrayHeader(2);
+
+ WriteGuidBin16(ref writer, externalData.Id);
+
+ writer.Write(externalData.ResourceIdentifier?.ToString());
+
+ writer.Flush();
+ }
+
+ ///
+ /// Deserializes a DTO.
+ ///
+ ///
+ /// The to deserialize the from.
+ ///
+ ///
+ /// The serialization settings to use.
+ ///
+ ///
+ /// The deserialized .
+ ///
+ public ExternalData Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
+ {
+ if (reader.TryReadNil())
+ {
+ return null;
+ }
+
+ options.Security.DepthStep(ref reader);
+
+ var externalData = new ExternalData();
+
+ var propertyCounter = reader.ReadArrayHeader();
+
+ for (var i = 0; i < propertyCounter; i++)
+ {
+ switch (i)
+ {
+ case 0:
+ externalData.Id = ReadGuidBin16(ref reader);
+ break;
+
+ case 1:
+ externalData.ResourceIdentifier = ReadUriOrNull(ref reader);
+ break;
+
+ default:
+ reader.Skip();
+ break;
+ }
+ }
+
+ reader.Depth--;
+
+ return externalData;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenMessagePackFormatter/PrimitiveConstraintMessagePackFormatter.cs b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenMessagePackFormatter/PrimitiveConstraintMessagePackFormatter.cs
new file mode 100644
index 000000000..f19bc5e8e
--- /dev/null
+++ b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenMessagePackFormatter/PrimitiveConstraintMessagePackFormatter.cs
@@ -0,0 +1,157 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.MessagePack.PSM
+{
+ using System;
+ using System.Collections.Generic;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.Serializer.MessagePack.Core;
+
+ using global::MessagePack;
+ using global::MessagePack.Formatters;
+
+ ///
+ /// The purpose of the is to provide
+ /// the contract for MessagePack serialization of the type
+ ///
+ public class PrimitiveConstraintMessagePackFormatter : MessagePackFormatterBase, IMessagePackFormatter
+ {
+ ///
+ /// Serializes a DTO.
+ ///
+ ///
+ /// The to use when serializing the value.
+ ///
+ ///
+ /// The that is to be serialized.
+ ///
+ ///
+ /// The serialization settings to use.
+ ///
+ ///
+ /// Thrown when the DTO is null
+ ///
+ public void Serialize(ref MessagePackWriter writer, PrimitiveConstraint primitiveConstraint, MessagePackSerializerOptions options)
+ {
+ if (primitiveConstraint == null)
+ {
+ throw new ArgumentNullException(nameof(primitiveConstraint), "The PrimitiveConstraint may not be null");
+ }
+
+ writer.WriteArrayHeader(4);
+
+ writer.Write(primitiveConstraint.Inverse);
+
+ writer.WriteString(PrimitiveConstraintOperatorProvider.ToUtf8Bytes(primitiveConstraint.Operator));
+
+ writer.Write(primitiveConstraint.Property);
+
+ if (primitiveConstraint.Value == null)
+ {
+ writer.WriteArrayHeader(0);
+ }
+ else
+ {
+ writer.WriteArrayHeader(primitiveConstraint.Value.Count);
+
+ foreach (var item in primitiveConstraint.Value)
+ {
+ ConstraintValueMessagePackWriter.Write(ref writer, item);
+ }
+ }
+
+ writer.Flush();
+ }
+
+ ///
+ /// Deserializes a DTO.
+ ///
+ ///
+ /// The to deserialize the from.
+ ///
+ ///
+ /// The serialization settings to use.
+ ///
+ ///
+ /// The deserialized .
+ ///
+ public PrimitiveConstraint Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
+ {
+ if (reader.TryReadNil())
+ {
+ return null;
+ }
+
+ options.Security.DepthStep(ref reader);
+
+ var primitiveConstraint = new PrimitiveConstraint();
+
+ var propertyCounter = reader.ReadArrayHeader();
+
+ for (var i = 0; i < propertyCounter; i++)
+ {
+ switch (i)
+ {
+ case 0:
+ primitiveConstraint.Inverse = reader.ReadBoolean();
+ break;
+
+ case 1:
+ primitiveConstraint.Operator = PrimitiveConstraintOperatorProvider.Parse(reader.ReadStringSequence().Value);
+ break;
+
+ case 2:
+ primitiveConstraint.Property = reader.ReadString();
+ break;
+
+ case 3:
+ var valueLength = reader.ReadArrayHeader();
+ primitiveConstraint.Value = new List(valueLength);
+
+ for (var valueCounter = 0; valueCounter < valueLength; valueCounter++)
+ {
+ primitiveConstraint.Value.Add(ConstraintValueMessagePackReader.Read(ref reader));
+ }
+
+ break;
+
+ default:
+ reader.Skip();
+ break;
+ }
+ }
+
+ reader.Depth--;
+
+ return primitiveConstraint;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenMessagePackFormatter/PrimitiveConstraintRequestMessagePackFormatter.cs b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenMessagePackFormatter/PrimitiveConstraintRequestMessagePackFormatter.cs
new file mode 100644
index 000000000..5760b1d35
--- /dev/null
+++ b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenMessagePackFormatter/PrimitiveConstraintRequestMessagePackFormatter.cs
@@ -0,0 +1,172 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.MessagePack.PSM
+{
+ using System;
+ using System.Collections.Generic;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.Serializer.MessagePack.Core;
+
+ using global::MessagePack;
+ using global::MessagePack.Formatters;
+
+ ///
+ /// The purpose of the is to provide
+ /// the contract for MessagePack serialization of the type
+ ///
+ public class PrimitiveConstraintRequestMessagePackFormatter : MessagePackFormatterBase, IMessagePackFormatter
+ {
+ ///
+ /// Serializes a DTO.
+ ///
+ ///
+ /// The to use when serializing the value.
+ ///
+ ///
+ /// The that is to be serialized.
+ ///
+ ///
+ /// The serialization settings to use.
+ ///
+ ///
+ /// Thrown when the DTO is null
+ ///
+ public void Serialize(ref MessagePackWriter writer, PrimitiveConstraintRequest primitiveConstraintRequest, MessagePackSerializerOptions options)
+ {
+ if (primitiveConstraintRequest == null)
+ {
+ throw new ArgumentNullException(nameof(primitiveConstraintRequest), "The PrimitiveConstraintRequest may not be null");
+ }
+
+ writer.WriteArrayHeader(4);
+
+ if (primitiveConstraintRequest.Inverse.HasValue)
+ {
+ writer.Write(primitiveConstraintRequest.Inverse.Value);
+ }
+ else
+ {
+ writer.WriteNil();
+ }
+
+ writer.WriteString(PrimitiveConstraintRequestOperatorProvider.ToUtf8Bytes(primitiveConstraintRequest.Operator));
+
+ writer.Write(primitiveConstraintRequest.Property);
+
+ if (primitiveConstraintRequest.Value == null)
+ {
+ writer.WriteArrayHeader(0);
+ }
+ else
+ {
+ writer.WriteArrayHeader(primitiveConstraintRequest.Value.Count);
+
+ foreach (var item in primitiveConstraintRequest.Value)
+ {
+ ConstraintValueMessagePackWriter.Write(ref writer, item);
+ }
+ }
+
+ writer.Flush();
+ }
+
+ ///
+ /// Deserializes a DTO.
+ ///
+ ///
+ /// The to deserialize the from.
+ ///
+ ///
+ /// The serialization settings to use.
+ ///
+ ///
+ /// The deserialized .
+ ///
+ public PrimitiveConstraintRequest Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
+ {
+ if (reader.TryReadNil())
+ {
+ return null;
+ }
+
+ options.Security.DepthStep(ref reader);
+
+ var primitiveConstraintRequest = new PrimitiveConstraintRequest();
+
+ var propertyCounter = reader.ReadArrayHeader();
+
+ for (var i = 0; i < propertyCounter; i++)
+ {
+ switch (i)
+ {
+ case 0:
+ if (reader.TryReadNil())
+ {
+ primitiveConstraintRequest.Inverse = null;
+ }
+ else
+ {
+ primitiveConstraintRequest.Inverse = reader.ReadBoolean();
+ }
+
+ break;
+
+ case 1:
+ primitiveConstraintRequest.Operator = PrimitiveConstraintRequestOperatorProvider.Parse(reader.ReadStringSequence().Value);
+ break;
+
+ case 2:
+ primitiveConstraintRequest.Property = reader.ReadString();
+ break;
+
+ case 3:
+ var valueLength = reader.ReadArrayHeader();
+ primitiveConstraintRequest.Value = new List(valueLength);
+
+ for (var valueCounter = 0; valueCounter < valueLength; valueCounter++)
+ {
+ primitiveConstraintRequest.Value.Add(ConstraintValueMessagePackReader.Read(ref reader));
+ }
+
+ break;
+
+ default:
+ reader.Skip();
+ break;
+ }
+ }
+
+ reader.Depth--;
+
+ return primitiveConstraintRequest;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/BranchSerializer.cs b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/BranchSerializer.cs
index 704b4d2e3..373ab81d4 100644
--- a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/BranchSerializer.cs
+++ b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/BranchSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
diff --git a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/CommitRequestSerializer.cs b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/CommitRequestSerializer.cs
index 844f0fa99..c8dcba9d2 100644
--- a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/CommitRequestSerializer.cs
+++ b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/CommitRequestSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
diff --git a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/CommitSerializer.cs b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/CommitSerializer.cs
index 7a1246f76..87843fbb5 100644
--- a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/CommitSerializer.cs
+++ b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/CommitSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
diff --git a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/CompositeConstraintSerializer.cs b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/CompositeConstraintSerializer.cs
index 324e9a164..7cfd84c6a 100644
--- a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/CompositeConstraintSerializer.cs
+++ b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/CompositeConstraintSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
@@ -86,7 +87,7 @@ internal static void Serialize(object obj, Utf8JsonWriter writer, SerializationM
writer.WriteEndArray();
- writer.WriteString("operator"u8, compositeConstraint.Operator.ToWireValue());
+ writer.WriteString("operator"u8, CompositeConstraintOperatorProvider.ToUtf8Bytes(compositeConstraint.Operator));
writer.WriteEndObject();
}
diff --git a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/DataVersionSerializer.cs b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/DataVersionSerializer.cs
index d6626e911..2b4ed8cba 100644
--- a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/DataVersionSerializer.cs
+++ b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/DataVersionSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
diff --git a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/ExternalDataSerializer.cs b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/ExternalDataSerializer.cs
index f08509d33..f49e2e0ed 100644
--- a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/ExternalDataSerializer.cs
+++ b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/ExternalDataSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
diff --git a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/PrimitiveConstraintRequestSerializer.cs b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/PrimitiveConstraintRequestSerializer.cs
index 527ae31bc..f11cd182f 100644
--- a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/PrimitiveConstraintRequestSerializer.cs
+++ b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/PrimitiveConstraintRequestSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
@@ -83,7 +84,7 @@ internal static void Serialize(object obj, Utf8JsonWriter writer, SerializationM
writer.WriteNull("inverse"u8);
}
- writer.WriteString("operator"u8, primitiveConstraintRequest.Operator.ToWireValue());
+ writer.WriteString("operator"u8, PrimitiveConstraintRequestOperatorProvider.ToUtf8Bytes(primitiveConstraintRequest.Operator));
writer.WriteString("property"u8, primitiveConstraintRequest.Property);
diff --git a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/PrimitiveConstraintSerializer.cs b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/PrimitiveConstraintSerializer.cs
index 951412f28..e1f67b556 100644
--- a/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/PrimitiveConstraintSerializer.cs
+++ b/SysML2.NET.CodeGenerator.Tests/Expected/OpenAPI/PSM/AutoGenSerializer/PrimitiveConstraintSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
@@ -76,7 +77,7 @@ internal static void Serialize(object obj, Utf8JsonWriter writer, SerializationM
writer.WriteBoolean("inverse"u8, primitiveConstraint.Inverse);
- writer.WriteString("operator"u8, primitiveConstraint.Operator.ToWireValue());
+ writer.WriteString("operator"u8, PrimitiveConstraintOperatorProvider.ToUtf8Bytes(primitiveConstraint.Operator));
writer.WriteString("property"u8, primitiveConstraint.Property);
diff --git a/SysML2.NET.CodeGenerator.Tests/Generators/OpenApiHandleBarsGenerators/OpenApiEnumProviderGeneratorTestFixture.cs b/SysML2.NET.CodeGenerator.Tests/Generators/OpenApiHandleBarsGenerators/OpenApiEnumProviderGeneratorTestFixture.cs
new file mode 100644
index 000000000..8afaa5228
--- /dev/null
+++ b/SysML2.NET.CodeGenerator.Tests/Generators/OpenApiHandleBarsGenerators/OpenApiEnumProviderGeneratorTestFixture.cs
@@ -0,0 +1,82 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.CodeGenerator.Tests.Generators.OpenApiHandleBarsGenerators
+{
+ using System;
+ using System.IO;
+ using System.Threading.Tasks;
+
+ using Microsoft.OpenApi;
+
+ using NUnit.Framework;
+
+ using SysML2.NET.CodeGenerator.Generators.OpenApiHandleBarsGenerators;
+
+ [TestFixture]
+ public class OpenApiEnumProviderGeneratorTestFixture
+ {
+ private OpenApiDocument openApiDocument;
+ private DirectoryInfo outputDirectory;
+ private OpenApiEnumProviderGenerator openApiEnumProviderGenerator;
+
+ [OneTimeSetUp]
+ public async Task SetUp()
+ {
+ this.openApiDocument = await OpenApiDocumentLoader.LoadAsync();
+
+ var directoryInfo = new DirectoryInfo(TestContext.CurrentContext.TestDirectory);
+
+ this.outputDirectory = directoryInfo.CreateSubdirectory(Path.Combine("OpenAPI", "_SysML2.NET.PSM.AutoGenEnumProvider"));
+ this.openApiEnumProviderGenerator = new OpenApiEnumProviderGenerator();
+ }
+
+ [Test]
+ public async Task VerifyGenerateAsync()
+ {
+ Assert.That(() => this.openApiEnumProviderGenerator.GenerateAsync(null, this.outputDirectory), Throws.TypeOf());
+ Assert.That(() => this.openApiEnumProviderGenerator.GenerateAsync(this.openApiDocument, null), Throws.TypeOf());
+
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(() => this.openApiEnumProviderGenerator.GenerateEnumerationProviderAsync(null, this.outputDirectory, "CompositeConstraintOperator"), Throws.TypeOf());
+ Assert.That(() => this.openApiEnumProviderGenerator.GenerateEnumerationProviderAsync(this.openApiDocument, null, "CompositeConstraintOperator"), Throws.TypeOf());
+ Assert.That(() => this.openApiEnumProviderGenerator.GenerateEnumerationProviderAsync(this.openApiDocument, this.outputDirectory, " "), Throws.TypeOf());
+ }
+
+ await Assert.ThatAsync(() => this.openApiEnumProviderGenerator.GenerateAsync(this.openApiDocument, this.outputDirectory), Throws.Nothing);
+
+ Assert.That(this.outputDirectory.GetFiles("*Provider.cs"), Has.Length.EqualTo(4));
+ }
+
+ [Test]
+ [Category("Expected")]
+ public async Task VerifyGenerateEnumerationProviderAsync([Values("CompositeConstraintOperator", "CompositeConstraintRequestOperator",
+ "PrimitiveConstraintOperator", "PrimitiveConstraintRequestOperator")] string enumerationName)
+ {
+ var generatedCode = await this.openApiEnumProviderGenerator.GenerateEnumerationProviderAsync(this.openApiDocument, this.outputDirectory, enumerationName);
+
+ var expected = await File.ReadAllTextAsync(Path.Combine(TestContext.CurrentContext.TestDirectory,
+ $"Expected/OpenAPI/PSM/AutoGenEnumProvider/{enumerationName}Provider.cs"));
+
+ Assert.That(generatedCode, Is.EqualTo(expected));
+ }
+ }
+}
diff --git a/SysML2.NET.CodeGenerator.Tests/Generators/OpenApiHandleBarsGenerators/OpenApiJsonDeSerializerGeneratorTestFixture.cs b/SysML2.NET.CodeGenerator.Tests/Generators/OpenApiHandleBarsGenerators/OpenApiJsonDeSerializerGeneratorTestFixture.cs
new file mode 100644
index 000000000..62ed78282
--- /dev/null
+++ b/SysML2.NET.CodeGenerator.Tests/Generators/OpenApiHandleBarsGenerators/OpenApiJsonDeSerializerGeneratorTestFixture.cs
@@ -0,0 +1,99 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.CodeGenerator.Tests.Generators.OpenApiHandleBarsGenerators
+{
+ using System;
+ using System.Collections.Generic;
+ using System.IO;
+ using System.Linq;
+ using System.Threading.Tasks;
+
+ using Microsoft.OpenApi;
+
+ using NUnit.Framework;
+
+ using SysML2.NET.CodeGenerator.Extensions;
+ using SysML2.NET.CodeGenerator.Generators.OpenApiHandleBarsGenerators;
+
+ [TestFixture]
+ public class OpenApiJsonDeSerializerGeneratorTestFixture
+ {
+ private OpenApiDocument openApiDocument;
+ private DirectoryInfo outputDirectory;
+ private OpenApiJsonDeSerializerGenerator openApiJsonDeSerializerGenerator;
+
+ [OneTimeSetUp]
+ public async Task SetUp()
+ {
+ this.openApiDocument = await OpenApiDocumentLoader.LoadAsync();
+
+ var directoryInfo = new DirectoryInfo(TestContext.CurrentContext.TestDirectory);
+
+ this.outputDirectory = directoryInfo.CreateSubdirectory(Path.Combine("OpenAPI", "_SysML2.NET.PSM.AutoGenDeSerializer"));
+ this.openApiJsonDeSerializerGenerator = new OpenApiJsonDeSerializerGenerator();
+ }
+
+ private static IEnumerable InterestingSchemas()
+ {
+ var openApiDocument = OpenApiDocumentLoader.LoadAsync().GetAwaiter().GetResult();
+
+ var deSerializableSchemas = OpenApiJsonDeSerializerGenerator.QueryDeSerializableSchemas(openApiDocument)
+ .Select(schema => schema.Key)
+ .ToHashSet(StringComparer.Ordinal);
+
+ return OpenApiSchemaInspector.QueryInterestingSchemas(OpenApiHandleBarsGenerator.QuerySchemas(openApiDocument))
+ .Where(deSerializableSchemas.Contains);
+ }
+
+ [Test]
+ public async Task VerifyGenerateAsync()
+ {
+ await Assert.ThatAsync(() => this.openApiJsonDeSerializerGenerator.GenerateAsync(null, this.outputDirectory), Throws.TypeOf());
+ await Assert.ThatAsync(() => this.openApiJsonDeSerializerGenerator.GenerateAsync(this.openApiDocument, null), Throws.TypeOf());
+ Assert.That(() => OpenApiJsonDeSerializerGenerator.QueryDeSerializableSchemas(null), Throws.TypeOf());
+
+ await Assert.ThatAsync(() => this.openApiJsonDeSerializerGenerator.GenerateAsync(this.openApiDocument, this.outputDirectory), Throws.Nothing);
+
+ var deSerializableSchemas = OpenApiJsonDeSerializerGenerator.QueryDeSerializableSchemas(this.openApiDocument);
+
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(deSerializableSchemas.Select(schema => schema.Key), Does.Not.Contain("Data"));
+ Assert.That(deSerializableSchemas.Select(schema => schema.Key), Does.Contain("PrimitiveConstraint"));
+ Assert.That(this.outputDirectory.GetFiles("RequestDeSerializationProvider.cs"), Has.Length.EqualTo(1));
+ Assert.That(this.outputDirectory.GetFiles("ResponseDeSerializationProvider.cs"), Has.Length.EqualTo(1));
+ }
+ }
+
+ [Test]
+ [TestCaseSource(nameof(InterestingSchemas))]
+ [Category("Expected")]
+ public async Task VerifyGenerateDeSerializerAsync(string schemaName)
+ {
+ var generatedCode = await this.openApiJsonDeSerializerGenerator.GenerateDeSerializerAsync(this.openApiDocument, this.outputDirectory, schemaName);
+
+ var expected = await File.ReadAllTextAsync(Path.Combine(TestContext.CurrentContext.TestDirectory,
+ $"Expected/OpenAPI/PSM/AutoGenDeSerializer/{schemaName}DeSerializer.cs"));
+
+ Assert.That(generatedCode, Is.EqualTo(expected));
+ }
+ }
+}
diff --git a/SysML2.NET.CodeGenerator.Tests/Generators/OpenApiHandleBarsGenerators/OpenApiMessagePackFormatterGeneratorTestFixture.cs b/SysML2.NET.CodeGenerator.Tests/Generators/OpenApiHandleBarsGenerators/OpenApiMessagePackFormatterGeneratorTestFixture.cs
new file mode 100644
index 000000000..a1a89b74e
--- /dev/null
+++ b/SysML2.NET.CodeGenerator.Tests/Generators/OpenApiHandleBarsGenerators/OpenApiMessagePackFormatterGeneratorTestFixture.cs
@@ -0,0 +1,100 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.CodeGenerator.Tests.Generators.OpenApiHandleBarsGenerators
+{
+ using System;
+ using System.Collections.Generic;
+ using System.IO;
+ using System.Linq;
+ using System.Threading.Tasks;
+
+ using Microsoft.OpenApi;
+
+ using NUnit.Framework;
+
+ using SysML2.NET.CodeGenerator.Extensions;
+ using SysML2.NET.CodeGenerator.Generators.OpenApiHandleBarsGenerators;
+
+ [TestFixture]
+ public class OpenApiMessagePackFormatterGeneratorTestFixture
+ {
+ private OpenApiDocument openApiDocument;
+ private DirectoryInfo outputDirectory;
+ private OpenApiMessagePackFormatterGenerator openApiMessagePackFormatterGenerator;
+
+ [OneTimeSetUp]
+ public async Task SetUp()
+ {
+ this.openApiDocument = await OpenApiDocumentLoader.LoadAsync();
+
+ var directoryInfo = new DirectoryInfo(TestContext.CurrentContext.TestDirectory);
+
+ this.outputDirectory = directoryInfo.CreateSubdirectory(Path.Combine("OpenAPI", "_SysML2.NET.PSM.AutoGenMessagePackFormatter"));
+ this.openApiMessagePackFormatterGenerator = new OpenApiMessagePackFormatterGenerator();
+ }
+
+ private static IEnumerable InterestingSchemas()
+ {
+ var openApiDocument = OpenApiDocumentLoader.LoadAsync().GetAwaiter().GetResult();
+
+ var formattableSchemas = OpenApiMessagePackFormatterGenerator.QueryFormattableSchemas(openApiDocument)
+ .Select(schema => schema.Key)
+ .ToHashSet(StringComparer.Ordinal);
+
+ return OpenApiSchemaInspector.QueryInterestingSchemas(OpenApiHandleBarsGenerator.QuerySchemas(openApiDocument))
+ .Where(formattableSchemas.Contains);
+ }
+
+ [Test]
+ public async Task VerifyGenerateAsync()
+ {
+ await Assert.ThatAsync(() => this.openApiMessagePackFormatterGenerator.GenerateAsync(null, this.outputDirectory), Throws.TypeOf());
+ await Assert.ThatAsync(() => this.openApiMessagePackFormatterGenerator.GenerateAsync(this.openApiDocument, null), Throws.TypeOf());
+ Assert.That(() => OpenApiMessagePackFormatterGenerator.QueryFormattableSchemas(null), Throws.TypeOf());
+
+ await Assert.ThatAsync(() => this.openApiMessagePackFormatterGenerator.GenerateAsync(this.openApiDocument, this.outputDirectory), Throws.Nothing);
+
+ var formattableSchemas = OpenApiMessagePackFormatterGenerator.QueryFormattableSchemas(this.openApiDocument);
+
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(formattableSchemas.Select(schema => schema.Key), Does.Not.Contain("Data"));
+ Assert.That(formattableSchemas.Select(schema => schema.Key), Does.Contain("PrimitiveConstraint"));
+ Assert.That(this.outputDirectory.GetFiles("RequestPayload.cs"), Has.Length.EqualTo(1));
+ Assert.That(this.outputDirectory.GetFiles("ResponsePayload.cs"), Has.Length.EqualTo(1));
+ Assert.That(this.outputDirectory.GetFiles("PsmDataResolverGetFormatterHelper.cs"), Has.Length.EqualTo(1));
+ }
+ }
+
+ [Test]
+ [TestCaseSource(nameof(InterestingSchemas))]
+ [Category("Expected")]
+ public async Task VerifyGenerateFormatterAsync(string schemaName)
+ {
+ var generatedCode = await this.openApiMessagePackFormatterGenerator.GenerateFormatterAsync(this.openApiDocument, this.outputDirectory, schemaName);
+
+ var expected = await File.ReadAllTextAsync(Path.Combine(TestContext.CurrentContext.TestDirectory,
+ $"Expected/OpenAPI/PSM/AutoGenMessagePackFormatter/{schemaName}MessagePackFormatter.cs"));
+
+ Assert.That(generatedCode, Is.EqualTo(expected));
+ }
+ }
+}
diff --git a/SysML2.NET.CodeGenerator/Extensions/OpenApiSchemaExtensions.cs b/SysML2.NET.CodeGenerator/Extensions/OpenApiSchemaExtensions.cs
index 480a3f097..a646b45ab 100644
--- a/SysML2.NET.CodeGenerator/Extensions/OpenApiSchemaExtensions.cs
+++ b/SysML2.NET.CodeGenerator/Extensions/OpenApiSchemaExtensions.cs
@@ -23,6 +23,7 @@ namespace SysML2.NET.CodeGenerator.Extensions
using System;
using System.Collections.Generic;
using System.Linq;
+ using System.Text;
using Microsoft.OpenApi;
@@ -221,6 +222,32 @@ public static IReadOnlyList QueryEnumerationValues(this IOpenApiSchema s
: schema.Enum.Select(value => value.GetValue()).ToList();
}
+ ///
+ /// Queries the length in UTF-8 bytes of the longest allowed value declared by the schema
+ ///
+ /// The subject .
+ /// The length of the longest allowed value, or zero when the schema declares none.
+ public static int QueryLongestEnumerationValueByteLength(this IOpenApiSchema schema)
+ {
+ ArgumentNullException.ThrowIfNull(schema);
+
+ var byteLengths = schema.QueryEnumerationValues().Select(QueryEnumerationValueByteLength).ToList();
+
+ return byteLengths.Count == 0 ? 0 : byteLengths.Max();
+ }
+
+ ///
+ /// Queries the length in UTF-8 bytes of an allowed value
+ ///
+ /// The allowed value as it appears in the schema.
+ /// The length in UTF-8 bytes.
+ public static int QueryEnumerationValueByteLength(string enumerationValue)
+ {
+ ArgumentException.ThrowIfNullOrWhiteSpace(enumerationValue);
+
+ return Encoding.UTF8.GetByteCount(enumerationValue);
+ }
+
///
/// Queries whether the schema can be expressed as a C# type
///
diff --git a/SysML2.NET.CodeGenerator/Generators/OpenApiHandleBarsGenerators/OpenApiDtoGenerator.cs b/SysML2.NET.CodeGenerator/Generators/OpenApiHandleBarsGenerators/OpenApiDtoGenerator.cs
index fadab6074..e4a530cb1 100644
--- a/SysML2.NET.CodeGenerator/Generators/OpenApiHandleBarsGenerators/OpenApiDtoGenerator.cs
+++ b/SysML2.NET.CodeGenerator/Generators/OpenApiHandleBarsGenerators/OpenApiDtoGenerator.cs
@@ -280,12 +280,7 @@ private static IEnumerable QueryFamilyInterfaces(string schemaName, IOpe
///
private string QueryPropertyTypeOverride(string className, string propertyName)
{
- if (PropertyTypeOverrides.TryGetValue((className, propertyName), out var typeName))
- {
- return typeName;
- }
-
- return this.unionPropertyTypes.TryGetValue((className, propertyName), out var unionTypeName) ? unionTypeName : null;
+ return PropertyTypeOverrides.TryGetValue((className, propertyName), out var typeName) ? typeName : this.unionPropertyTypes.GetValueOrDefault((className, propertyName));
}
///
diff --git a/SysML2.NET.CodeGenerator/Generators/OpenApiHandleBarsGenerators/OpenApiEnumGenerator.cs b/SysML2.NET.CodeGenerator/Generators/OpenApiHandleBarsGenerators/OpenApiEnumGenerator.cs
index a0c7866a3..cc569b96e 100644
--- a/SysML2.NET.CodeGenerator/Generators/OpenApiHandleBarsGenerators/OpenApiEnumGenerator.cs
+++ b/SysML2.NET.CodeGenerator/Generators/OpenApiHandleBarsGenerators/OpenApiEnumGenerator.cs
@@ -41,11 +41,6 @@ public class OpenApiEnumGenerator : OpenApiHandleBarsGenerator
///
private const string EnumerationTemplateName = "psm-enumeration-openapi-template";
- ///
- /// The name of the template that generates the extension methods of an enumeration
- ///
- private const string EnumerationExtensionsTemplateName = "psm-enumeration-extensions-openapi-template";
-
///
/// Generates the enumerations declared inline by the schemas of the OpenAPI document
///
@@ -124,7 +119,6 @@ protected override void RegisterHelpers()
protected override void RegisterTemplates()
{
this.RegisterTemplate(EnumerationTemplateName);
- this.RegisterTemplate(EnumerationExtensionsTemplateName);
}
///
@@ -187,10 +181,6 @@ private async Task WriteEnumerationAsync(KeyValuePair
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.CodeGenerator.Generators.OpenApiHandleBarsGenerators
+{
+ using System;
+ using System.Collections.Generic;
+ using System.IO;
+ using System.Linq;
+ using System.Threading.Tasks;
+
+ using Microsoft.OpenApi;
+
+ using SysML2.NET.CodeGenerator.OpenApiHandleBarHelpers;
+
+ ///
+ /// OpenAPI based handlebars generator for the providers that convert enumerations to and from the wire
+ ///
+ public class OpenApiEnumProviderGenerator : OpenApiHandleBarsGenerator
+ {
+ ///
+ /// The name of the template that generates the provider of an enumeration
+ ///
+ private const string EnumerationProviderTemplateName = "psm-enumprovider-openapi-template";
+
+ ///
+ /// Generates the providers of the enumerations declared inline by the schemas of the OpenAPI document
+ ///
+ ///
+ /// the that contains the OpenAPI model to generate from
+ ///
+ ///
+ /// The target
+ ///
+ ///
+ /// an awaitable
+ ///
+ public override Task GenerateAsync(OpenApiDocument openApiDocument, DirectoryInfo outputDirectory)
+ {
+ ArgumentNullException.ThrowIfNull(openApiDocument);
+ ArgumentNullException.ThrowIfNull(outputDirectory);
+
+ return this.GenerateInternalAsync(openApiDocument, outputDirectory);
+ }
+
+ ///
+ /// Generates the provider of the enumeration with the specified name
+ ///
+ ///
+ /// the that contains the OpenAPI model to generate from
+ ///
+ ///
+ /// The target
+ ///
+ ///
+ /// The name of the enumeration whose provider is to be generated
+ ///
+ ///
+ /// The generated code
+ ///
+ public Task GenerateEnumerationProviderAsync(OpenApiDocument openApiDocument, DirectoryInfo outputDirectory, string name)
+ {
+ ArgumentNullException.ThrowIfNull(openApiDocument);
+ ArgumentNullException.ThrowIfNull(outputDirectory);
+ ArgumentException.ThrowIfNullOrWhiteSpace(name);
+
+ return this.GenerateEnumerationProviderInternalAsync(openApiDocument, outputDirectory, name);
+ }
+
+ ///
+ /// Register the custom helpers
+ ///
+ protected override void RegisterHelpers()
+ {
+ this.Handlebars.RegisterEnumerationHelper();
+ }
+
+ ///
+ /// Register the code templates
+ ///
+ protected override void RegisterTemplates()
+ {
+ this.RegisterTemplate(EnumerationProviderTemplateName);
+ }
+
+ ///
+ /// Generates the providers of the enumerations declared inline by the schemas of the OpenAPI document
+ ///
+ ///
+ /// the that contains the OpenAPI model to generate from
+ ///
+ ///
+ /// The target
+ ///
+ ///
+ /// an awaitable
+ ///
+ private async Task GenerateInternalAsync(OpenApiDocument openApiDocument, DirectoryInfo outputDirectory)
+ {
+ foreach (var enumeration in OpenApiEnumGenerator.QueryEnumerations(openApiDocument))
+ {
+ await this.WriteEnumerationProviderAsync(enumeration, outputDirectory);
+ }
+ }
+
+ ///
+ /// Generates the provider of the enumeration with the specified name
+ ///
+ ///
+ /// the that contains the OpenAPI model to generate from
+ ///
+ ///
+ /// The target
+ ///
+ ///
+ /// The name of the enumeration whose provider is to be generated
+ ///
+ ///
+ /// The generated code
+ ///
+ private async Task GenerateEnumerationProviderInternalAsync(OpenApiDocument openApiDocument, DirectoryInfo outputDirectory, string name)
+ {
+ var enumeration = OpenApiEnumGenerator.QueryEnumerations(openApiDocument).Single(candidate => candidate.Key == name);
+
+ return await this.WriteEnumerationProviderAsync(enumeration, outputDirectory);
+ }
+
+ ///
+ /// Applies the provider template to the property schema and writes the result to disk
+ ///
+ ///
+ /// The generated enumeration name paired with the property schema that declares it
+ ///
+ ///
+ /// The target
+ ///
+ ///
+ /// The generated code
+ ///
+ private async Task WriteEnumerationProviderAsync(KeyValuePair enumeration, DirectoryInfo outputDirectory)
+ {
+ var generatedCode = this.CodeCleanup(this.Templates[EnumerationProviderTemplateName](enumeration));
+
+ await WriteAsync(generatedCode, outputDirectory, $"{enumeration.Key}Provider.cs");
+
+ return generatedCode;
+ }
+ }
+}
diff --git a/SysML2.NET.CodeGenerator/Generators/OpenApiHandleBarsGenerators/OpenApiJsonDeSerializerGenerator.cs b/SysML2.NET.CodeGenerator/Generators/OpenApiHandleBarsGenerators/OpenApiJsonDeSerializerGenerator.cs
new file mode 100644
index 000000000..67d593411
--- /dev/null
+++ b/SysML2.NET.CodeGenerator/Generators/OpenApiHandleBarsGenerators/OpenApiJsonDeSerializerGenerator.cs
@@ -0,0 +1,312 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.CodeGenerator.Generators.OpenApiHandleBarsGenerators
+{
+ using System;
+ using System.Collections.Generic;
+ using System.IO;
+ using System.Linq;
+ using System.Threading.Tasks;
+
+ using Microsoft.OpenApi;
+
+ using SysML2.NET.CodeGenerator.Extensions;
+ using SysML2.NET.CodeGenerator.OpenApiHandleBarHelpers;
+
+ ///
+ /// OpenAPI based handlebars generator for the JSON deserializers
+ ///
+ public class OpenApiJsonDeSerializerGenerator : OpenApiHandleBarsGenerator
+ {
+ ///
+ /// The name of the template that generates the deserializer of a class
+ ///
+ private const string DeSerializerTemplateName = "psm-json-deserializer-openapi-template";
+
+ ///
+ /// The name of the template that generates a deserialization provider
+ ///
+ private const string ProviderTemplateName = "psm-json-deserialization-provider-openapi-template";
+
+ ///
+ /// The suffix that marks a schema as belonging to the request family
+ ///
+ private const string RequestSchemaNameSuffix = "Request";
+
+ ///
+ /// The readers that read the items of the properties whose schema has no C# equivalent, paired with the
+ /// C# type of those items
+ ///
+ private static readonly Dictionary<(string ClassName, string PropertyName), (string Reader, string ElementType)> ElementReaderOverrides =
+ new()
+ {
+ [("PrimitiveConstraint", "value")] = ("ConstraintValueReader.Read", "ConstraintValue"),
+ [("PrimitiveConstraintRequest", "value")] = ("ConstraintValueReader.Read", "ConstraintValue")
+ };
+
+ ///
+ /// The dispatcher methods that read the unions that admit types declared outside the OpenAPI document
+ ///
+ private static readonly Dictionary DispatchedUnionReaders =
+ new(StringComparer.Ordinal)
+ {
+ ["Data"] = "PsmDeSerializationDispatcher.ReadData",
+ ["DataRequest"] = "PsmDeSerializationDispatcher.ReadDataRequest"
+ };
+
+ ///
+ /// Generates the JSON deserializers of the schemas of the OpenAPI document
+ ///
+ ///
+ /// the that contains the OpenAPI model to generate from
+ ///
+ ///
+ /// The target
+ ///
+ ///
+ /// an awaitable
+ ///
+ public override Task GenerateAsync(OpenApiDocument openApiDocument, DirectoryInfo outputDirectory)
+ {
+ ArgumentNullException.ThrowIfNull(openApiDocument);
+ ArgumentNullException.ThrowIfNull(outputDirectory);
+
+ return this.GenerateInternalAsync(openApiDocument, outputDirectory);
+ }
+
+ ///
+ /// Generates the JSON deserializer of the specified schema
+ ///
+ ///
+ /// the that contains the OpenAPI model to generate from
+ ///
+ ///
+ /// The target
+ ///
+ ///
+ /// The name of the schema to generate the deserializer for
+ ///
+ ///
+ /// The generated code
+ ///
+ public Task GenerateDeSerializerAsync(OpenApiDocument openApiDocument, DirectoryInfo outputDirectory, string name)
+ {
+ ArgumentNullException.ThrowIfNull(openApiDocument);
+ ArgumentNullException.ThrowIfNull(outputDirectory);
+ ArgumentException.ThrowIfNullOrWhiteSpace(name);
+
+ return this.GenerateDeSerializerInternalAsync(openApiDocument, outputDirectory, name);
+ }
+
+ ///
+ /// Queries the schemas that a deserializer is generated for
+ ///
+ ///
+ /// the that contains the OpenAPI model to generate from
+ ///
+ ///
+ /// The in-scope schemas that are not unions, ordered by name
+ ///
+ public static IReadOnlyList> QueryDeSerializableSchemas(OpenApiDocument openApiDocument)
+ {
+ ArgumentNullException.ThrowIfNull(openApiDocument);
+
+ return QuerySchemas(openApiDocument).Where(schema => !schema.Value.QueryIsUnion()).ToList();
+ }
+
+ ///
+ /// Register the custom helpers
+ ///
+ protected override void RegisterHelpers()
+ {
+ this.Handlebars.RegisterSchemaHelper(
+ _ => [],
+ QueryElementReaderOverride);
+ this.Handlebars.RegisterJsonSerializerHelper(QueryElementReaderOverride);
+ this.Handlebars.RegisterJsonDeSerializerHelper(QueryElementReaderOverride, QueryElementTypeOverride, QueryDispatchedUnionReader);
+ }
+
+ ///
+ /// Register the code templates
+ ///
+ protected override void RegisterTemplates()
+ {
+ this.RegisterTemplate(DeSerializerTemplateName);
+ this.RegisterTemplate(ProviderTemplateName);
+ }
+
+ ///
+ /// Queries the reader that reads the items of a property whose schema has no C# equivalent
+ ///
+ ///
+ /// The name of the class that declares the property
+ ///
+ ///
+ /// The name of the property as it appears in the schema
+ ///
+ ///
+ /// The reader, or null when the property is deserialized from its schema
+ ///
+ private static string QueryElementReaderOverride(string className, string propertyName)
+ {
+ return ElementReaderOverrides.TryGetValue((className, propertyName), out var over) ? over.Reader : null;
+ }
+
+ ///
+ /// Queries the C# type of the items of a property whose schema has no C# equivalent
+ ///
+ ///
+ /// The name of the class that declares the property
+ ///
+ ///
+ /// The name of the property as it appears in the schema
+ ///
+ ///
+ /// The C# type, or null when the property is deserialized from its schema
+ ///
+ private static string QueryElementTypeOverride(string className, string propertyName)
+ {
+ return ElementReaderOverrides.TryGetValue((className, propertyName), out var over) ? over.ElementType : null;
+ }
+
+ ///
+ /// Queries the dispatcher method that reads a union that admits types declared outside the OpenAPI document
+ ///
+ ///
+ /// The name of the union schema
+ ///
+ ///
+ /// The dispatcher method, or null when every alternative is declared by the document
+ ///
+ private static string QueryDispatchedUnionReader(string unionSchemaName)
+ {
+ return unionSchemaName != null && DispatchedUnionReaders.TryGetValue(unionSchemaName, out var reader) ? reader : null;
+ }
+
+ ///
+ /// Generates the JSON deserializers of the schemas of the OpenAPI document
+ ///
+ ///
+ /// the that contains the OpenAPI model to generate from
+ ///
+ ///
+ /// The target
+ ///
+ ///
+ /// an awaitable
+ ///
+ private async Task GenerateInternalAsync(OpenApiDocument openApiDocument, DirectoryInfo outputDirectory)
+ {
+ var schemas = QueryDeSerializableSchemas(openApiDocument);
+
+ foreach (var schema in schemas)
+ {
+ await this.WriteDeSerializerAsync(schema, outputDirectory);
+ }
+
+ await this.WriteProviderAsync(schemas, outputDirectory, true);
+ await this.WriteProviderAsync(schemas, outputDirectory, false);
+ }
+
+ ///
+ /// Generates the JSON deserializer of the specified schema
+ ///
+ ///
+ /// the that contains the OpenAPI model to generate from
+ ///
+ ///
+ /// The target
+ ///
+ ///
+ /// The name of the schema to generate the deserializer for
+ ///
+ ///
+ /// The generated code
+ ///
+ private async Task GenerateDeSerializerInternalAsync(OpenApiDocument openApiDocument, DirectoryInfo outputDirectory, string name)
+ {
+ var schema = QueryDeSerializableSchemas(openApiDocument).Single(candidate => candidate.Key == name);
+
+ return await this.WriteDeSerializerAsync(schema, outputDirectory);
+ }
+
+ ///
+ /// Applies the deserializer template to the schema and writes the result to disk
+ ///
+ ///
+ /// The schema to generate the deserializer for
+ ///
+ ///
+ /// The target
+ ///
+ ///
+ /// The generated code
+ ///
+ private async Task WriteDeSerializerAsync(KeyValuePair schema, DirectoryInfo outputDirectory)
+ {
+ var generatedCode = this.CodeCleanup(this.Templates[DeSerializerTemplateName](schema));
+
+ await WriteAsync(generatedCode, outputDirectory, $"{schema.Key}DeSerializer.cs");
+
+ return generatedCode;
+ }
+
+ ///
+ /// Applies the provider template to the schemas of one family and writes the result to disk
+ ///
+ ///
+ /// The schemas that a deserializer is generated for
+ ///
+ ///
+ /// The target
+ ///
+ ///
+ /// Asserts that the provider resolves the request family rather than the response family
+ ///
+ ///
+ /// an awaitable
+ ///
+ private async Task WriteProviderAsync(IReadOnlyList> schemas, DirectoryInfo outputDirectory, bool isRequestFamily)
+ {
+ var providerName = isRequestFamily ? "RequestDeSerializationProvider" : "ResponseDeSerializationProvider";
+
+ var model = new Dictionary
+ {
+ ["ProviderName"] = providerName,
+ ["DelegateName"] = isRequestFamily ? "DeSerializeRequestDelegate" : "DeSerializeResponseDelegate",
+ ["MarkerInterface"] = isRequestFamily ? "IRequest" : "IResponse",
+ ["Family"] = isRequestFamily ? "request" : "response",
+ ["Entries"] = schemas
+ .Where(schema => schema.Key.EndsWith(RequestSchemaNameSuffix, StringComparison.Ordinal) == isRequestFamily)
+ .Select(schema => new Dictionary
+ {
+ ["SchemaName"] = schema.Key,
+ ["TypeDiscriminator"] = schema.Value.QueryTypeDiscriminator() ?? schema.Key
+ })
+ .ToList()
+ };
+
+ var generatedProvider = this.CodeCleanup(this.Templates[ProviderTemplateName](model));
+
+ await WriteAsync(generatedProvider, outputDirectory, $"{providerName}.cs");
+ }
+ }
+}
diff --git a/SysML2.NET.CodeGenerator/Generators/OpenApiHandleBarsGenerators/OpenApiMessagePackFormatterGenerator.cs b/SysML2.NET.CodeGenerator/Generators/OpenApiHandleBarsGenerators/OpenApiMessagePackFormatterGenerator.cs
new file mode 100644
index 000000000..5e7450c36
--- /dev/null
+++ b/SysML2.NET.CodeGenerator/Generators/OpenApiHandleBarsGenerators/OpenApiMessagePackFormatterGenerator.cs
@@ -0,0 +1,410 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.CodeGenerator.Generators.OpenApiHandleBarsGenerators
+{
+ using System;
+ using System.Collections.Generic;
+ using System.IO;
+ using System.Linq;
+ using System.Threading.Tasks;
+
+ using Microsoft.OpenApi;
+
+ using SysML2.NET.CodeGenerator.Extensions;
+ using SysML2.NET.CodeGenerator.OpenApiHandleBarHelpers;
+
+ ///
+ /// OpenAPI based handlebars generator for the MessagePack formatters
+ ///
+ public class OpenApiMessagePackFormatterGenerator : OpenApiHandleBarsGenerator
+ {
+ ///
+ /// The name of the template that generates the formatter of a class
+ ///
+ private const string FormatterTemplateName = "psm-messagepack-formatter-openapi-template";
+
+ ///
+ /// The name of the template that generates a payload envelope
+ ///
+ private const string PayloadTemplateName = "psm-messagepack-payload-openapi-template";
+
+ ///
+ /// The name of the template that generates the factory of a payload envelope
+ ///
+ private const string PayloadFactoryTemplateName = "psm-messagepack-payloadfactory-openapi-template";
+
+ ///
+ /// The name of the template that generates the formatter of a payload envelope
+ ///
+ private const string PayloadFormatterTemplateName = "psm-messagepack-payloadformatter-openapi-template";
+
+ ///
+ /// The name of the template that generates the formatter resolution helper
+ ///
+ private const string FormatterHelperTemplateName = "psm-messagepack-formatterhelper-openapi-template";
+
+ ///
+ /// The suffix that marks a schema as belonging to the request family
+ ///
+ private const string RequestSchemaNameSuffix = "Request";
+
+ ///
+ /// The C# types of the properties whose schema has no C# equivalent
+ ///
+ private static readonly Dictionary<(string ClassName, string PropertyName), string> PropertyTypeOverrides =
+ new()
+ {
+ [("PrimitiveConstraint", "value")] = "List",
+ [("PrimitiveConstraintRequest", "value")] = "List"
+ };
+
+ ///
+ /// The writers that emit the items of the properties whose schema has no C# equivalent
+ ///
+ private static readonly Dictionary<(string ClassName, string PropertyName), string> ElementWriterOverrides =
+ new()
+ {
+ [("PrimitiveConstraint", "value")] = "ConstraintValueMessagePackWriter.Write",
+ [("PrimitiveConstraintRequest", "value")] = "ConstraintValueMessagePackWriter.Write"
+ };
+
+ ///
+ /// The readers that read the items of the properties whose schema has no C# equivalent
+ ///
+ private static readonly Dictionary<(string ClassName, string PropertyName), string> ElementReaderOverrides =
+ new()
+ {
+ [("PrimitiveConstraint", "value")] = "ConstraintValueMessagePackReader.Read",
+ [("PrimitiveConstraintRequest", "value")] = "ConstraintValueMessagePackReader.Read"
+ };
+
+ ///
+ /// The C# types of the items of the properties whose schema has no C# equivalent
+ ///
+ private static readonly Dictionary<(string ClassName, string PropertyName), string> ElementTypeOverrides =
+ new()
+ {
+ [("PrimitiveConstraint", "value")] = "ConstraintValue",
+ [("PrimitiveConstraintRequest", "value")] = "ConstraintValue"
+ };
+
+ ///
+ /// The C# types that the union schemas resolve to, where the union admits types declared outside the document
+ ///
+ private static readonly Dictionary UnionTypeOverrides =
+ new(StringComparer.Ordinal)
+ {
+ ["Data"] = "SysML2.NET.Common.IData",
+ ["DataRequest"] = "SysML2.NET.Common.IDataRequest"
+ };
+
+ ///
+ /// Generates the MessagePack formatters of the schemas of the OpenAPI document
+ ///
+ ///
+ /// the that contains the OpenAPI model to generate from
+ ///
+ ///
+ /// The target
+ ///
+ ///
+ /// an awaitable
+ ///
+ public override Task GenerateAsync(OpenApiDocument openApiDocument, DirectoryInfo outputDirectory)
+ {
+ ArgumentNullException.ThrowIfNull(openApiDocument);
+ ArgumentNullException.ThrowIfNull(outputDirectory);
+
+ return this.GenerateInternalAsync(openApiDocument, outputDirectory);
+ }
+
+ ///
+ /// Generates the MessagePack formatter of the specified schema
+ ///
+ ///
+ /// the that contains the OpenAPI model to generate from
+ ///
+ ///
+ /// The target
+ ///
+ ///
+ /// The name of the schema to generate the formatter for
+ ///
+ ///
+ /// The generated code
+ ///
+ public Task GenerateFormatterAsync(OpenApiDocument openApiDocument, DirectoryInfo outputDirectory, string name)
+ {
+ ArgumentNullException.ThrowIfNull(openApiDocument);
+ ArgumentNullException.ThrowIfNull(outputDirectory);
+ ArgumentException.ThrowIfNullOrWhiteSpace(name);
+
+ return this.GenerateFormatterInternalAsync(openApiDocument, outputDirectory, name);
+ }
+
+ ///
+ /// Queries the schemas that a formatter is generated for
+ ///
+ ///
+ /// the that contains the OpenAPI model to generate from
+ ///
+ ///
+ /// The in-scope schemas that are not unions, ordered by name
+ ///
+ public static IReadOnlyList> QueryFormattableSchemas(OpenApiDocument openApiDocument)
+ {
+ ArgumentNullException.ThrowIfNull(openApiDocument);
+
+ return QuerySchemas(openApiDocument).Where(schema => !schema.Value.QueryIsUnion()).ToList();
+ }
+
+ ///
+ /// Register the custom helpers
+ ///
+ protected override void RegisterHelpers()
+ {
+ this.Handlebars.RegisterSchemaHelper(
+ _ => [],
+ QueryPropertyTypeOverride);
+ this.Handlebars.RegisterJsonSerializerHelper(QueryElementWriterOverride);
+ this.Handlebars.RegisterMessagePackFormatterHelper(QueryPropertyTypeOverride, QueryUnionType, QueryElementReaderOverride, QueryElementTypeOverride);
+ }
+
+ ///
+ /// Register the code templates
+ ///
+ protected override void RegisterTemplates()
+ {
+ this.RegisterTemplate(FormatterTemplateName);
+ this.RegisterTemplate(PayloadTemplateName);
+ this.RegisterTemplate(PayloadFactoryTemplateName);
+ this.RegisterTemplate(PayloadFormatterTemplateName);
+ this.RegisterTemplate(FormatterHelperTemplateName);
+ }
+
+ ///
+ /// Queries the C# type of a property whose schema has no C# equivalent
+ ///
+ ///
+ /// The name of the class that declares the property
+ ///
+ ///
+ /// The name of the property as it appears in the schema
+ ///
+ ///
+ /// The C# type, or null when the property is resolved from its schema
+ ///
+ private static string QueryPropertyTypeOverride(string className, string propertyName)
+ {
+ return PropertyTypeOverrides.TryGetValue((className, propertyName), out var typeName) ? typeName : null;
+ }
+
+ ///
+ /// Queries the writer that emits the items of a property whose schema has no C# equivalent
+ ///
+ ///
+ /// The name of the class that declares the property
+ ///
+ ///
+ /// The name of the property as it appears in the schema
+ ///
+ ///
+ /// The writer, or null when the property is serialized from its schema
+ ///
+ private static string QueryElementWriterOverride(string className, string propertyName)
+ {
+ return ElementWriterOverrides.TryGetValue((className, propertyName), out var writerName) ? writerName : null;
+ }
+
+ ///
+ /// Queries the reader that reads the items of a property whose schema has no C# equivalent
+ ///
+ ///
+ /// The name of the class that declares the property
+ ///
+ ///
+ /// The name of the property as it appears in the schema
+ ///
+ ///
+ /// The reader, or null when the property is deserialized from its schema
+ ///
+ private static string QueryElementReaderOverride(string className, string propertyName)
+ {
+ return ElementReaderOverrides.TryGetValue((className, propertyName), out var readerName) ? readerName : null;
+ }
+
+ ///
+ /// Queries the C# type of the items of a property whose schema has no C# equivalent
+ ///
+ ///
+ /// The name of the class that declares the property
+ ///
+ ///
+ /// The name of the property as it appears in the schema
+ ///
+ ///
+ /// The C# type, or null when the property is resolved from its schema
+ ///
+ private static string QueryElementTypeOverride(string className, string propertyName)
+ {
+ return ElementTypeOverrides.TryGetValue((className, propertyName), out var typeName) ? typeName : null;
+ }
+
+ ///
+ /// Queries the C# type that a union schema resolves to
+ ///
+ ///
+ /// The name of the union schema
+ ///
+ ///
+ /// The C# type
+ ///
+ private static string QueryUnionType(string unionSchemaName)
+ {
+ return UnionTypeOverrides.TryGetValue(unionSchemaName, out var typeName)
+ ? typeName
+ : OpenApiSchemaExtensions.QueryInterfaceName(unionSchemaName);
+ }
+
+ ///
+ /// Generates the MessagePack formatters of the schemas of the OpenAPI document
+ ///
+ ///
+ /// the that contains the OpenAPI model to generate from
+ ///
+ ///
+ /// The target
+ ///
+ ///
+ /// an awaitable
+ ///
+ private async Task GenerateInternalAsync(OpenApiDocument openApiDocument, DirectoryInfo outputDirectory)
+ {
+ var schemas = QueryFormattableSchemas(openApiDocument);
+
+ foreach (var schema in schemas)
+ {
+ await this.WriteFormatterAsync(schema, outputDirectory);
+ }
+
+ await this.WritePayloadAsync(schemas, outputDirectory, true);
+ await this.WritePayloadAsync(schemas, outputDirectory, false);
+
+ var generatedHelper = this.CodeCleanup(this.Templates[FormatterHelperTemplateName](schemas.Select(schema => schema.Key).ToList()));
+
+ await WriteAsync(generatedHelper, outputDirectory, "PsmDataResolverGetFormatterHelper.cs");
+ }
+
+ ///
+ /// Generates the MessagePack formatter of the specified schema
+ ///
+ ///
+ /// the that contains the OpenAPI model to generate from
+ ///
+ ///
+ /// The target
+ ///
+ ///
+ /// The name of the schema to generate the formatter for
+ ///
+ ///
+ /// The generated code
+ ///
+ private async Task GenerateFormatterInternalAsync(OpenApiDocument openApiDocument, DirectoryInfo outputDirectory, string name)
+ {
+ var schema = QueryFormattableSchemas(openApiDocument).Single(candidate => candidate.Key == name);
+
+ return await this.WriteFormatterAsync(schema, outputDirectory);
+ }
+
+ ///
+ /// Applies the formatter template to the schema and writes the result to disk
+ ///
+ ///
+ /// The schema to generate the formatter for
+ ///
+ ///
+ /// The target
+ ///
+ ///
+ /// The generated code
+ ///
+ private async Task WriteFormatterAsync(KeyValuePair schema, DirectoryInfo outputDirectory)
+ {
+ var generatedCode = this.CodeCleanup(this.Templates[FormatterTemplateName](schema));
+
+ await WriteAsync(generatedCode, outputDirectory, $"{schema.Key}MessagePackFormatter.cs");
+
+ return generatedCode;
+ }
+
+ ///
+ /// Applies the payload templates to the schemas of one family and writes the results to disk
+ ///
+ ///
+ /// The schemas that a formatter is generated for
+ ///
+ ///
+ /// The target
+ ///
+ ///
+ /// Asserts that the envelope carries the request family rather than the response family
+ ///
+ ///
+ /// an awaitable
+ ///
+ private async Task WritePayloadAsync(IReadOnlyList> schemas, DirectoryInfo outputDirectory, bool isRequestFamily)
+ {
+ var payloadName = isRequestFamily ? "RequestPayload" : "ResponsePayload";
+
+ var entries = schemas
+ .Where(schema => schema.Key.EndsWith(RequestSchemaNameSuffix, StringComparison.Ordinal) == isRequestFamily)
+ .Select((schema, index) => new Dictionary
+ {
+ ["SchemaName"] = schema.Key,
+ ["InstanceName"] = char.ToLowerInvariant(schema.Key[0]) + schema.Key[1..],
+ ["SlotIndex"] = index + 1
+ })
+ .ToList();
+
+ var model = new Dictionary
+ {
+ ["PayloadName"] = payloadName,
+ ["MarkerInterface"] = isRequestFamily ? "IRequest" : "IResponse",
+ ["Family"] = isRequestFamily ? "request" : "response",
+ ["SlotCount"] = entries.Count + 1,
+ ["Entries"] = entries
+ };
+
+ var generatedPayload = this.CodeCleanup(this.Templates[PayloadTemplateName](model));
+
+ await WriteAsync(generatedPayload, outputDirectory, $"{payloadName}.cs");
+
+ var generatedFactory = this.CodeCleanup(this.Templates[PayloadFactoryTemplateName](model));
+
+ await WriteAsync(generatedFactory, outputDirectory, $"{payloadName}Factory.cs");
+
+ var generatedFormatter = this.CodeCleanup(this.Templates[PayloadFormatterTemplateName](model));
+
+ await WriteAsync(generatedFormatter, outputDirectory, $"{payloadName}MessagePackFormatter.cs");
+ }
+ }
+}
diff --git a/SysML2.NET.CodeGenerator/OpenApiHandleBarHelpers/EnumerationHelper.cs b/SysML2.NET.CodeGenerator/OpenApiHandleBarHelpers/EnumerationHelper.cs
index d35d329ed..9bebd6af2 100644
--- a/SysML2.NET.CodeGenerator/OpenApiHandleBarHelpers/EnumerationHelper.cs
+++ b/SysML2.NET.CodeGenerator/OpenApiHandleBarHelpers/EnumerationHelper.cs
@@ -21,6 +21,7 @@
namespace SysML2.NET.CodeGenerator.OpenApiHandleBarHelpers
{
using System;
+ using System.Globalization;
using HandlebarsDotNet;
@@ -66,6 +67,42 @@ public static void RegisterEnumerationHelper(this IHandlebars handlebars)
writer.WriteSafeString(OpenApiSchemaExtensions.QueryEnumerationLiteralName(enumerationValue));
});
+
+ handlebars.RegisterHelper("Enumeration.WriteValueLength", (writer, _, arguments) =>
+ {
+ if (arguments.Length != 1)
+ {
+ throw new HandlebarsException("{{#Enumeration.WriteValueLength}} helper must have exactly one argument");
+ }
+
+ var enumerationValue = arguments[0] as string ?? throw new ArgumentException("supposed to be an enumeration value");
+
+ writer.WriteSafeString(enumerationValue.Length.ToString(CultureInfo.InvariantCulture));
+ });
+
+ handlebars.RegisterHelper("Enumeration.WriteValueByteLength", (writer, _, arguments) =>
+ {
+ if (arguments.Length != 1)
+ {
+ throw new HandlebarsException("{{#Enumeration.WriteValueByteLength}} helper must have exactly one argument");
+ }
+
+ var enumerationValue = arguments[0] as string ?? throw new ArgumentException("supposed to be an enumeration value");
+
+ writer.WriteSafeString(OpenApiSchemaExtensions.QueryEnumerationValueByteLength(enumerationValue).ToString(CultureInfo.InvariantCulture));
+ });
+
+ handlebars.RegisterHelper("Enumeration.WriteLongestValueByteLength", (writer, _, arguments) =>
+ {
+ if (arguments.Length != 1)
+ {
+ throw new HandlebarsException("{{#Enumeration.WriteLongestValueByteLength}} helper must have exactly one argument");
+ }
+
+ var schema = arguments[0] as IOpenApiSchema ?? throw new ArgumentException("supposed to be IOpenApiSchema");
+
+ writer.WriteSafeString(schema.QueryLongestEnumerationValueByteLength().ToString(CultureInfo.InvariantCulture));
+ });
}
}
}
diff --git a/SysML2.NET.CodeGenerator/OpenApiHandleBarHelpers/HandleBarArguments.cs b/SysML2.NET.CodeGenerator/OpenApiHandleBarHelpers/HandleBarArguments.cs
new file mode 100644
index 000000000..a82c18df3
--- /dev/null
+++ b/SysML2.NET.CodeGenerator/OpenApiHandleBarHelpers/HandleBarArguments.cs
@@ -0,0 +1,119 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.CodeGenerator.OpenApiHandleBarHelpers
+{
+ using System;
+
+ using HandlebarsDotNet;
+
+ using Microsoft.OpenApi;
+
+ using SysML2.NET.CodeGenerator.Extensions;
+
+ ///
+ /// Resolves the schema constructs that the property helpers are invoked with
+ ///
+ ///
+ /// The property helpers are invoked with the property name, the class name and the class schema, in that order.
+ ///
+ internal static class HandleBarArguments
+ {
+ /// The helper arguments.
+ extension(Arguments arguments)
+ {
+ ///
+ /// Queries a name from the helper arguments
+ ///
+ /// The index of the argument.
+ /// The name.
+ internal string QuerySchemaName(int index)
+ {
+ if (arguments.Length < index + 1)
+ {
+ throw new HandlebarsException("the helper is missing arguments");
+ }
+
+ return arguments[index] as string ?? throw new ArgumentException("supposed to be a name");
+ }
+
+ ///
+ /// Queries the schema of the class that the helper arguments identify
+ ///
+ /// The of the class.
+ internal IOpenApiSchema QueryClassSchema()
+ {
+ if (arguments.Length != 3)
+ {
+ throw new HandlebarsException("the helper must have exactly three arguments");
+ }
+
+ return arguments[2] as IOpenApiSchema ?? throw new ArgumentException("supposed to be IOpenApiSchema");
+ }
+
+ ///
+ /// Queries the schema of the property that the helper arguments identify
+ ///
+ /// The of the property.
+ internal IOpenApiSchema QueryPropertySchema()
+ {
+ return arguments.QueryClassSchema().Properties[arguments.QuerySchemaName(0)];
+ }
+
+ ///
+ /// Queries the C# type of the property that the helper arguments identify
+ ///
+ /// The C# type without its list wrapper or nullable annotation.
+ internal string QueryCoreTypeName()
+ {
+ return arguments.QueryPropertySchema().QueryCoreTypeName(arguments.QuerySchemaName(1), arguments.QuerySchemaName(0));
+ }
+
+ ///
+ /// Queries whether the class lists the property that the helper arguments identify as required
+ ///
+ /// True when the property is required.
+ internal bool QueryIsRequired()
+ {
+ return arguments.QueryClassSchema().Required?.Contains(arguments.QuerySchemaName(0)) == true;
+ }
+ }
+
+ ///
+ /// Queries the name of the local variable that holds an instance of the class
+ ///
+ /// The name of the class.
+ /// The name of the local variable.
+ internal static string QueryInstanceName(string className)
+ {
+ return char.ToLowerInvariant(className[0]) + className[1..];
+ }
+
+ ///
+ /// Queries the name of the local variable that holds the value of a property
+ ///
+ /// The name of the property as it appears in the schema.
+ /// The name of the local variable.
+ internal static string QueryLocalName(string propertyName)
+ {
+ return QueryInstanceName(OpenApiSchemaExtensions.QueryPropertyName(propertyName));
+ }
+ }
+}
diff --git a/SysML2.NET.CodeGenerator/OpenApiHandleBarHelpers/JsonDeSerializerHelper.cs b/SysML2.NET.CodeGenerator/OpenApiHandleBarHelpers/JsonDeSerializerHelper.cs
new file mode 100644
index 000000000..277121639
--- /dev/null
+++ b/SysML2.NET.CodeGenerator/OpenApiHandleBarHelpers/JsonDeSerializerHelper.cs
@@ -0,0 +1,108 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.CodeGenerator.OpenApiHandleBarHelpers
+{
+ using System;
+
+ using HandlebarsDotNet;
+
+ using Microsoft.OpenApi;
+
+ using SysML2.NET.CodeGenerator.Extensions;
+
+ ///
+ /// A handlebars block helper that supports the generation of the JSON deserializers
+ ///
+ public static class JsonDeSerializerHelper
+ {
+ ///
+ /// Registers the
+ ///
+ ///
+ /// The context with which the helper needs to be registered
+ ///
+ ///
+ /// A function that returns the reader that reads the items of a property whose schema has no C# equivalent
+ ///
+ ///
+ /// A function that returns the C# type of the items of a property whose schema has no C# equivalent
+ ///
+ ///
+ /// A function that returns the dispatcher method that reads a union that admits types outside the document
+ ///
+ public static void RegisterJsonDeSerializerHelper(this IHandlebars handlebars, Func queryElementReaderOverride, Func queryElementTypeOverride, Func queryDispatchedUnionReader)
+ {
+ ArgumentNullException.ThrowIfNull(handlebars);
+ ArgumentNullException.ThrowIfNull(queryElementReaderOverride);
+ ArgumentNullException.ThrowIfNull(queryElementTypeOverride);
+ ArgumentNullException.ThrowIfNull(queryDispatchedUnionReader);
+
+ handlebars.RegisterHelper("DeSerializer.WriteInstanceName", (writer, _, arguments) =>
+ writer.WriteSafeString(HandleBarArguments.QueryInstanceName(arguments.QuerySchemaName(0))));
+
+ handlebars.RegisterHelper("Property.WriteSeenFlag", (writer, _, arguments) =>
+ writer.WriteSafeString($"{HandleBarArguments.QueryLocalName(arguments.QuerySchemaName(0))}Seen"));
+
+ handlebars.RegisterHelper("Property.WriteLocalName", (writer, _, arguments) =>
+ writer.WriteSafeString(HandleBarArguments.QueryLocalName(arguments.QuerySchemaName(0))));
+
+ handlebars.RegisterHelper("Property.WriteReferencedDeSerializer", (writer, _, arguments) =>
+ writer.WriteSafeString($"{arguments.QueryPropertySchema().QueryTerminalReferenceName()}DeSerializer"));
+
+ handlebars.RegisterHelper("Property.WriteElementReader", (writer, _, arguments) =>
+ writer.WriteSafeString(queryElementReaderOverride(arguments.QuerySchemaName(1), arguments.QuerySchemaName(0))));
+
+ handlebars.RegisterHelper("Property.WriteUnionReader", (writer, _, arguments) =>
+ writer.WriteSafeString(queryDispatchedUnionReader(arguments.QueryPropertySchema().QueryTerminalReferenceName()) ?? QueryFamilyReader(arguments)));
+
+ handlebars.RegisterHelper("Property.WriteUnionCast", (writer, _, arguments) =>
+ writer.WriteSafeString(queryDispatchedUnionReader(arguments.QueryPropertySchema().QueryTerminalReferenceName()) is null
+ ? $"({OpenApiSchemaExtensions.QueryInterfaceName(arguments.QueryPropertySchema().QueryTerminalReferenceName())})"
+ : string.Empty));
+
+ handlebars.RegisterHelper("Property.WriteEnumerationProvider", (writer, _, arguments) =>
+ writer.WriteSafeString($"{OpenApiSchemaExtensions.QueryEnumerationTypeName(arguments.QuerySchemaName(1), arguments.QuerySchemaName(0))}Provider"));
+
+ handlebars.RegisterHelper("Property.WriteElementType", (writer, _, arguments) =>
+ writer.WriteSafeString(arguments.QueryCoreTypeName() ?? queryElementTypeOverride(arguments.QuerySchemaName(1), arguments.QuerySchemaName(0))));
+
+ handlebars.RegisterHelper("Property.QueryIsElementReaderOverridden", (_, arguments) =>
+ queryElementReaderOverride(arguments.QuerySchemaName(1), arguments.QuerySchemaName(0)) is not null);
+
+ handlebars.RegisterHelper("Property.QueryIsGuid", (_, arguments) =>
+ arguments.QueryCoreTypeName() == "Guid" && !arguments.QueryPropertySchema().QueryIsIdentifiedReference());
+
+ handlebars.RegisterHelper("Property.QueryIsDateTime", (_, arguments) => arguments.QueryCoreTypeName() == "DateTime");
+ }
+
+ ///
+ /// Queries the dispatcher method that reads a union whose alternatives are all declared by the document
+ ///
+ /// The helper arguments, being the property name, the class name and the class schema.
+ /// The dispatcher method.
+ private static string QueryFamilyReader(Arguments arguments)
+ {
+ return arguments.QuerySchemaName(1).EndsWith("Request", StringComparison.Ordinal)
+ ? "PsmDeSerializationDispatcher.ReadRequest"
+ : "PsmDeSerializationDispatcher.ReadResponse";
+ }
+ }
+}
diff --git a/SysML2.NET.CodeGenerator/OpenApiHandleBarHelpers/JsonSerializerHelper.cs b/SysML2.NET.CodeGenerator/OpenApiHandleBarHelpers/JsonSerializerHelper.cs
index 333ab4f42..d797b0890 100644
--- a/SysML2.NET.CodeGenerator/OpenApiHandleBarHelpers/JsonSerializerHelper.cs
+++ b/SysML2.NET.CodeGenerator/OpenApiHandleBarHelpers/JsonSerializerHelper.cs
@@ -48,121 +48,53 @@ public static void RegisterJsonSerializerHelper(this IHandlebars handlebars, Fun
ArgumentNullException.ThrowIfNull(queryElementWriterOverride);
handlebars.RegisterHelper("Serializer.WriteInstanceName", (writer, _, arguments) =>
- writer.WriteSafeString(QueryInstanceName(QuerySchemaName(arguments, 0))));
+ writer.WriteSafeString(HandleBarArguments.QueryInstanceName(arguments.QuerySchemaName(0))));
handlebars.RegisterHelper("Property.WriteName", (writer, _, arguments) =>
- writer.WriteSafeString(OpenApiSchemaExtensions.QueryPropertyName(QuerySchemaName(arguments, 0))));
+ writer.WriteSafeString(OpenApiSchemaExtensions.QueryPropertyName(arguments.QuerySchemaName(0))));
handlebars.RegisterHelper("Property.WriteAccessor", (writer, _, arguments) =>
- writer.WriteSafeString($"{QueryInstanceName(QuerySchemaName(arguments, 1))}.{OpenApiSchemaExtensions.QueryPropertyName(QuerySchemaName(arguments, 0))}"));
+ writer.WriteSafeString($"{HandleBarArguments.QueryInstanceName(arguments.QuerySchemaName(1))}.{OpenApiSchemaExtensions.QueryPropertyName(arguments.QuerySchemaName(0))}"));
handlebars.RegisterHelper("Property.WriteReferencedSerializer", (writer, _, arguments) =>
- writer.WriteSafeString($"{QueryPropertySchema(arguments).QueryTerminalReferenceName()}Serializer"));
+ writer.WriteSafeString($"{arguments.QueryPropertySchema().QueryTerminalReferenceName()}Serializer"));
+
+ handlebars.RegisterHelper("Property.WriteEnumerationProvider", (writer, _, arguments) =>
+ writer.WriteSafeString($"{OpenApiSchemaExtensions.QueryEnumerationTypeName(arguments.QuerySchemaName(1), arguments.QuerySchemaName(0))}Provider"));
handlebars.RegisterHelper("Property.WriteElementWriter", (writer, _, arguments) =>
- writer.WriteSafeString(queryElementWriterOverride(QuerySchemaName(arguments, 1), QuerySchemaName(arguments, 0))));
+ writer.WriteSafeString(queryElementWriterOverride(arguments.QuerySchemaName(1), arguments.QuerySchemaName(0))));
handlebars.RegisterHelper("Property.QueryIsOverridden", (_, arguments) =>
- queryElementWriterOverride(QuerySchemaName(arguments, 1), QuerySchemaName(arguments, 0)) is not null);
+ queryElementWriterOverride(arguments.QuerySchemaName(1), arguments.QuerySchemaName(0)) is not null);
handlebars.RegisterHelper("Property.QueryIsCollection", (_, arguments) =>
- QueryPropertySchema(arguments).QueryIsCollection());
+ arguments.QueryPropertySchema().QueryIsCollection());
handlebars.RegisterHelper("Property.QueryIsIdentifiedReference", (_, arguments) =>
- QueryPropertySchema(arguments).QueryIsIdentifiedReference());
+ arguments.QueryPropertySchema().QueryIsIdentifiedReference());
handlebars.RegisterHelper("Property.QueryIsComposite", (_, arguments) =>
- QueryPropertySchema(arguments).QueryIsCompositeReference());
+ arguments.QueryPropertySchema().QueryIsCompositeReference());
handlebars.RegisterHelper("Property.QueryIsPolymorphic", (_, arguments) =>
- QueryPropertySchema(arguments).QueryIsPolymorphicReference());
+ arguments.QueryPropertySchema().QueryIsPolymorphicReference());
handlebars.RegisterHelper("Property.QueryIsEnumeration", (_, arguments) =>
- QueryCoreTypeName(arguments) == OpenApiSchemaExtensions.QueryEnumerationTypeName(QuerySchemaName(arguments, 1), QuerySchemaName(arguments, 0)));
+ arguments.QueryCoreTypeName() == OpenApiSchemaExtensions.QueryEnumerationTypeName(arguments.QuerySchemaName(1), arguments.QuerySchemaName(0)));
- handlebars.RegisterHelper("Property.QueryIsBoolean", (_, arguments) => QueryCoreTypeName(arguments) == "bool");
+ handlebars.RegisterHelper("Property.QueryIsBoolean", (_, arguments) => arguments.QueryCoreTypeName() == "bool");
- handlebars.RegisterHelper("Property.QueryIsNumeric", (_, arguments) => QueryCoreTypeName(arguments) is "double" or "int");
+ handlebars.RegisterHelper("Property.QueryIsNumeric", (_, arguments) => arguments.QueryCoreTypeName() is "double" or "int");
- handlebars.RegisterHelper("Property.QueryIsUri", (_, arguments) => QueryCoreTypeName(arguments) == "Uri");
+ handlebars.RegisterHelper("Property.QueryIsUri", (_, arguments) => arguments.QueryCoreTypeName() == "Uri");
handlebars.RegisterHelper("Property.QueryIsNullableValue", (_, arguments) =>
{
- var propertySchema = QueryPropertySchema(arguments);
+ var propertySchema = arguments.QueryPropertySchema();
- return propertySchema.QueryIsValueType() && propertySchema.QueryIsNullable(QueryIsRequired(arguments));
+ return propertySchema.QueryIsValueType() && propertySchema.QueryIsNullable(arguments.QueryIsRequired());
});
}
-
- ///
- /// Queries the name of the local variable that holds the instance being serialized
- ///
- /// The name of the class that is serialized.
- /// The name of the local variable.
- private static string QueryInstanceName(string className)
- {
- return char.ToLowerInvariant(className[0]) + className[1..];
- }
-
- ///
- /// Queries a name from the helper arguments
- ///
- /// The helper arguments, being the property name, the class name and the class schema.
- /// The index of the argument.
- /// The name.
- private static string QuerySchemaName(Arguments arguments, int index)
- {
- if (arguments.Length < index + 1)
- {
- throw new HandlebarsException("the helper is missing arguments");
- }
-
- return arguments[index] as string ?? throw new ArgumentException("supposed to be a name");
- }
-
- ///
- /// Queries the schema of the property that the helper arguments identify
- ///
- /// The helper arguments, being the property name, the class name and the class schema.
- /// The of the property.
- private static IOpenApiSchema QueryPropertySchema(Arguments arguments)
- {
- return QueryClassSchema(arguments).Properties[QuerySchemaName(arguments, 0)];
- }
-
- ///
- /// Queries the schema of the class that the helper arguments identify
- ///
- /// The helper arguments, being the property name, the class name and the class schema.
- /// The of the class.
- private static IOpenApiSchema QueryClassSchema(Arguments arguments)
- {
- if (arguments.Length != 3)
- {
- throw new HandlebarsException("the helper must have exactly three arguments");
- }
-
- return arguments[2] as IOpenApiSchema ?? throw new ArgumentException("supposed to be IOpenApiSchema");
- }
-
- ///
- /// Queries whether the class lists the property as required
- ///
- /// The helper arguments, being the property name, the class name and the class schema.
- /// True when the property is required.
- private static bool QueryIsRequired(Arguments arguments)
- {
- return QueryClassSchema(arguments).Required?.Contains(QuerySchemaName(arguments, 0)) == true;
- }
-
- ///
- /// Queries the C# type of the property that the helper arguments identify
- ///
- /// The helper arguments, being the property name, the class name and the class schema.
- /// The C# type without its list wrapper or nullable annotation.
- private static string QueryCoreTypeName(Arguments arguments)
- {
- return QueryPropertySchema(arguments).QueryCoreTypeName(QuerySchemaName(arguments, 1), QuerySchemaName(arguments, 0));
- }
}
}
diff --git a/SysML2.NET.CodeGenerator/OpenApiHandleBarHelpers/MessagePackFormatterHelper.cs b/SysML2.NET.CodeGenerator/OpenApiHandleBarHelpers/MessagePackFormatterHelper.cs
new file mode 100644
index 000000000..ddb640fda
--- /dev/null
+++ b/SysML2.NET.CodeGenerator/OpenApiHandleBarHelpers/MessagePackFormatterHelper.cs
@@ -0,0 +1,94 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.CodeGenerator.OpenApiHandleBarHelpers
+{
+ using System;
+ using System.Globalization;
+
+ using HandlebarsDotNet;
+
+ using Microsoft.OpenApi;
+
+ using SysML2.NET.CodeGenerator.Extensions;
+
+ ///
+ /// A handlebars block helper that supports the generation of the MessagePack formatters
+ ///
+ public static class MessagePackFormatterHelper
+ {
+ ///
+ /// Registers the
+ ///
+ ///
+ /// The context with which the helper needs to be registered
+ ///
+ ///
+ /// A function that returns the C# type of a property whose schema has no C# equivalent
+ ///
+ ///
+ /// A function that returns the C# type that a union schema resolves to
+ ///
+ ///
+ /// A function that returns the reader that reads the items of a property whose schema has no C# equivalent
+ ///
+ ///
+ /// A function that returns the C# type of the items of a property whose schema has no C# equivalent
+ ///
+ public static void RegisterMessagePackFormatterHelper(this IHandlebars handlebars, Func queryTypeOverride, Func queryUnionType, Func queryElementReaderOverride, Func queryElementTypeOverride)
+ {
+ ArgumentNullException.ThrowIfNull(handlebars);
+ ArgumentNullException.ThrowIfNull(queryTypeOverride);
+ ArgumentNullException.ThrowIfNull(queryUnionType);
+ ArgumentNullException.ThrowIfNull(queryElementReaderOverride);
+ ArgumentNullException.ThrowIfNull(queryElementTypeOverride);
+
+ handlebars.RegisterHelper("Property.WriteUnionType", (writer, _, arguments) =>
+ writer.WriteSafeString(queryUnionType(arguments.QueryPropertySchema().QueryTerminalReferenceName())));
+
+ handlebars.RegisterHelper("Property.WriteElementReader", (writer, _, arguments) =>
+ writer.WriteSafeString(queryElementReaderOverride(arguments.QuerySchemaName(1), arguments.QuerySchemaName(0))));
+
+ handlebars.RegisterHelper("Schema.WritePropertyCount", (writer, _, arguments) =>
+ {
+ if (arguments.Length != 2)
+ {
+ throw new HandlebarsException("{{#Schema.WritePropertyCount}} helper must have exactly two arguments");
+ }
+
+ var schema = arguments[0] as IOpenApiSchema ?? throw new ArgumentException("supposed to be IOpenApiSchema");
+ var className = arguments[1] as string ?? throw new ArgumentException("supposed to be a schema name");
+
+ writer.WriteSafeString(schema.QueryMappableProperties(className, queryTypeOverride).Count.ToString(CultureInfo.InvariantCulture));
+ });
+
+ handlebars.RegisterHelper("Property.WriteLocalName", (writer, _, arguments) =>
+ writer.WriteSafeString(HandleBarArguments.QueryLocalName(arguments.QuerySchemaName(0))));
+
+ handlebars.RegisterHelper("Property.WriteElementType", (writer, _, arguments) =>
+ writer.WriteSafeString(arguments.QueryCoreTypeName() ?? queryElementTypeOverride(arguments.QuerySchemaName(1), arguments.QuerySchemaName(0))));
+
+ handlebars.RegisterHelper("Property.QueryIsGuid", (_, arguments) =>
+ arguments.QueryCoreTypeName() == "Guid" && !arguments.QueryPropertySchema().QueryIsIdentifiedReference());
+
+ handlebars.RegisterHelper("Property.QueryIsDateTime", (_, arguments) => arguments.QueryCoreTypeName() == "DateTime");
+ }
+ }
+}
diff --git a/SysML2.NET.CodeGenerator/SysML2.NET.CodeGenerator.csproj b/SysML2.NET.CodeGenerator/SysML2.NET.CodeGenerator.csproj
index 05a4be5e4..327a922c2 100644
--- a/SysML2.NET.CodeGenerator/SysML2.NET.CodeGenerator.csproj
+++ b/SysML2.NET.CodeGenerator/SysML2.NET.CodeGenerator.csproj
@@ -263,7 +263,7 @@
Always
-
+
Always
@@ -272,6 +272,27 @@
Always
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
diff --git a/SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-enumprovider-openapi-template.hbs b/SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-enumprovider-openapi-template.hbs
new file mode 100644
index 000000000..2dec3e585
--- /dev/null
+++ b/SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-enumprovider-openapi-template.hbs
@@ -0,0 +1,148 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Extensions.PSM
+{
+ using System;
+ using System.Buffers;
+ using System.Text;
+
+ using SysML2.NET.PSM.Enumerations;
+
+ ///
+ /// The purpose of the is to convert a
+ /// to and from its representation in the Systems Modeling API and Services
+ ///
+ public static class {{this.Key}}Provider
+ {
+ ///
+ /// The length in bytes of the longest {{this.Key}} representation
+ ///
+ private const int LongestValueByteLength = {{#Enumeration.WriteLongestValueByteLength this.Value}};
+
+ ///
+ /// Parses the to a
+ ///
+ /// The that is to be parsed.
+ /// A enumeration literal.
+ /// Thrown when the value denotes no literal.
+ public static {{this.Key}} Parse(ReadOnlySpan value)
+ {
+ if (TryParse(value, out var result))
+ {
+ return result;
+ }
+
+ throw new ArgumentException($"'{new string(value)}' is not a valid {{this.Key}}", nameof(value));
+ }
+
+ ///
+ /// Tries to parse the to a
+ ///
+ /// The that is to be parsed.
+ /// The parsed literal, or default when the value denotes none.
+ /// True when the value was parsed.
+ public static bool TryParse(ReadOnlySpan value, out {{this.Key}} result)
+ {
+ {{#each (Enumeration.QueryValues this.Value) as | enumerationValue |}}
+ if (value.Length == {{#Enumeration.WriteValueLength enumerationValue}} && value.Equals("{{{enumerationValue}}}".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = {{../this.Key}}.{{#Enumeration.WriteLiteralName enumerationValue}};
+ return true;
+ }
+
+ {{/each}}
+ result = default;
+ return false;
+ }
+
+ ///
+ /// Parses the UTF-8 encoded to a
+ ///
+ /// The that is to be parsed.
+ /// A enumeration literal.
+ /// Thrown when the value denotes no literal.
+ public static {{this.Key}} Parse(ReadOnlySpan value)
+ {
+ if (value.Length <= LongestValueByteLength)
+ {
+ Span characters = stackalloc char[LongestValueByteLength];
+
+ var characterCount = Encoding.UTF8.GetChars(value, characters);
+
+ if (TryParse(characters[..characterCount], out var result))
+ {
+ return result;
+ }
+ }
+
+ throw new ArgumentException($"'{Encoding.UTF8.GetString(value)}' is not a valid {{this.Key}}", nameof(value));
+ }
+
+ ///
+ /// Parses the UTF-8 encoded to a
+ ///
+ /// The that is to be parsed.
+ /// A enumeration literal.
+ /// Thrown when the value denotes no literal.
+ public static {{this.Key}} Parse(in ReadOnlySequence value)
+ {
+ if (value.IsSingleSegment)
+ {
+ return Parse(value.FirstSpan);
+ }
+
+ if (value.Length > LongestValueByteLength)
+ {
+ throw new ArgumentException($"a {{this.Key}} is at most {LongestValueByteLength} bytes long", nameof(value));
+ }
+
+ Span buffer = stackalloc byte[LongestValueByteLength];
+ value.CopyTo(buffer);
+
+ return Parse(buffer[..(int)value.Length]);
+ }
+
+ ///
+ /// Converts a to its UTF-8 encoded representation on the wire
+ ///
+ /// The that is to be converted.
+ /// A backed by static UTF-8 data.
+ /// Thrown when the literal is not known.
+ public static ReadOnlySpan ToUtf8Bytes({{this.Key}} value)
+ {
+ return value switch
+ {
+ {{#each (Enumeration.QueryValues this.Value) as | enumerationValue |}}
+ {{../this.Key}}.{{#Enumeration.WriteLiteralName enumerationValue}} => "{{{enumerationValue}}}"u8,
+ {{/each}}
+ _ => throw new ArgumentOutOfRangeException(nameof(value))
+ };
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-json-deserialization-provider-openapi-template.hbs b/SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-json-deserialization-provider-openapi-template.hbs
new file mode 100644
index 000000000..70067b889
--- /dev/null
+++ b/SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-json-deserialization-provider-openapi-template.hbs
@@ -0,0 +1,90 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+
+ ///
+ /// Delegate provider for the appropriate deserialization method to deserialize a
+ ///
+ ///
+ /// A {{this.Family}} and its counterpart in the other family share a @type discriminator, so the caller
+ /// states which family it expects rather than the payload declaring it.
+ ///
+ internal static class {{this.ProviderName}}
+ {
+ ///
+ /// Caches the for the @type that is to be deserialized
+ ///
+ private static readonly Dictionary DeSerializerActionMap =
+ new Dictionary(StringComparer.OrdinalIgnoreCase)
+ {
+ {{#each this.Entries as | entry |}}
+ { "{{entry.TypeDiscriminator}}", {{entry.SchemaName}}DeSerializer.DeSerialize },
+ {{/each}}
+ };
+
+ ///
+ /// Provides the delegate that deserializes the specified @type
+ ///
+ ///
+ /// The @type that is to be deserialized
+ ///
+ ///
+ /// The delegate that deserializes the @type
+ ///
+ ///
+ /// Thrown when the @type is not supported
+ ///
+ internal static {{this.DelegateName}} Provide(string typeName)
+ {
+ if (!DeSerializerActionMap.TryGetValue(typeName, out var action))
+ {
+ throw new NotSupportedException($"The {typeName} is not supported by the {{this.ProviderName}}.");
+ }
+
+ return action;
+ }
+
+ ///
+ /// Asserts whether the specified @type is supported by the provider
+ ///
+ ///
+ /// The @type for which support is asserted
+ ///
+ ///
+ /// True when the @type is supported
+ ///
+ internal static bool IsTypeSupported(string typeName)
+ {
+ return typeName != null && DeSerializerActionMap.ContainsKey(typeName);
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-json-deserializer-openapi-template.hbs b/SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-json-deserializer-openapi-template.hbs
new file mode 100644
index 000000000..1f55b4dc0
--- /dev/null
+++ b/SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-json-deserializer-openapi-template.hbs
@@ -0,0 +1,262 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class {{this.Key}}DeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static {{this.Key}} DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("{{this.Key}}DeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var {{#DeSerializer.WriteInstanceName this.Key}} = new {{this.Key}}();
+
+ {{#each (Schema.QueryPropertyNames this.Value this.Key) as | propertyName |}}
+ var {{#Property.WriteSeenFlag propertyName ../this.Key ../this.Value}} = false;
+ {{/each}}
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the {{this.Key}} json object.");
+ }
+
+ {{#each (Schema.QueryPropertyNames this.Value this.Key) as | propertyName |}}
+ if (reader.ValueTextEquals("{{propertyName}}"u8))
+ {
+ {{#Property.WriteSeenFlag propertyName ../this.Key ../this.Value}} = true;
+ reader.Read();
+
+ {{#if (Property.QueryIsElementReaderOverridden propertyName ../this.Key ../this.Value)}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = new List<{{#Property.WriteElementType propertyName ../this.Key ../this.Value}}>();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Add({{#Property.WriteElementReader propertyName ../this.Key ../this.Value}}(ref reader));
+ }
+ }
+ {{else if (Property.QueryIsCollection propertyName ../this.Key ../this.Value)}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = new List<{{#Property.WriteElementType propertyName ../this.Key ../this.Value}}>();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ {{#if (Property.QueryIsIdentifiedReference propertyName ../this.Key ../this.Value)}}
+ if (Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var {{#Property.WriteLocalName propertyName ../this.Key ../this.Value}}Item))
+ {
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Add({{#Property.WriteLocalName propertyName ../this.Key ../this.Value}}Item);
+ }
+ {{else if (Property.QueryIsPolymorphic propertyName ../this.Key ../this.Value)}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Add({{#Property.WriteUnionCast propertyName ../this.Key ../this.Value}}{{#Property.WriteUnionReader propertyName ../this.Key ../this.Value}}(ref reader, serializationModeKind, deserializeDerivedProperties, loggerFactory));
+ {{else if (Property.QueryIsComposite propertyName ../this.Key ../this.Value)}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Add({{#Property.WriteReferencedDeSerializer propertyName ../this.Key ../this.Value}}.DeSerialize(ref reader, serializationModeKind, deserializeDerivedProperties, loggerFactory));
+ {{else if (Property.QueryIsEnumeration propertyName ../this.Key ../this.Value)}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Add({{#Property.WriteEnumerationProvider propertyName ../this.Key ../this.Value}}.Parse(Utf8JsonReaderHelper.ReadStringOrNull(ref reader).AsSpan()));
+ {{else if (Property.QueryIsBoolean propertyName ../this.Key ../this.Value)}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Add(reader.GetBoolean());
+ {{else if (Property.QueryIsNumeric propertyName ../this.Key ../this.Value)}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Add(reader.GetDouble());
+ {{else if (Property.QueryIsUri propertyName ../this.Key ../this.Value)}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Add(Utf8JsonReaderHelper.ReadUriOrNull(ref reader));
+ {{else if (Property.QueryIsGuid propertyName ../this.Key ../this.Value)}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Add(Utf8JsonReaderHelper.ReadGuid(ref reader));
+ {{else}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Add(reader.GetString());
+ {{/if}}
+ }
+ }
+ {{else if (Property.QueryIsIdentifiedReference propertyName ../this.Key ../this.Value)}}
+ {{#if (Property.QueryIsNullableValue propertyName ../this.Key ../this.Value)}}
+ if (Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var {{#Property.WriteLocalName propertyName ../this.Key ../this.Value}}Value))
+ {
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = {{#Property.WriteLocalName propertyName ../this.Key ../this.Value}}Value;
+ }
+ else
+ {
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = null;
+ }
+ {{else}}
+ if (Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var {{#Property.WriteLocalName propertyName ../this.Key ../this.Value}}Value))
+ {
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = {{#Property.WriteLocalName propertyName ../this.Key ../this.Value}}Value;
+ }
+ else if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the {{../this.Key}}.{{propertyName}} reference is null, the value is left at Guid.Empty");
+ }
+ {{/if}}
+ {{else if (Property.QueryIsPolymorphic propertyName ../this.Key ../this.Value)}}
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = null;
+ }
+ else
+ {
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = {{#Property.WriteUnionCast propertyName ../this.Key ../this.Value}}{{#Property.WriteUnionReader propertyName ../this.Key ../this.Value}}(ref reader, serializationModeKind, deserializeDerivedProperties, loggerFactory);
+ }
+ {{else if (Property.QueryIsComposite propertyName ../this.Key ../this.Value)}}
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = null;
+ }
+ else
+ {
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = {{#Property.WriteReferencedDeSerializer propertyName ../this.Key ../this.Value}}.DeSerialize(ref reader, serializationModeKind, deserializeDerivedProperties, loggerFactory);
+ }
+ {{else if (Property.QueryIsEnumeration propertyName ../this.Key ../this.Value)}}
+ {{#if (Property.QueryIsNullableValue propertyName ../this.Key ../this.Value)}}
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = null;
+ }
+ else
+ {
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = {{#Property.WriteEnumerationProvider propertyName ../this.Key ../this.Value}}.Parse(Utf8JsonReaderHelper.ReadStringOrNull(ref reader).AsSpan());
+ }
+ {{else}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = {{#Property.WriteEnumerationProvider propertyName ../this.Key ../this.Value}}.Parse(Utf8JsonReaderHelper.ReadStringOrNull(ref reader).AsSpan());
+ {{/if}}
+ {{else if (Property.QueryIsBoolean propertyName ../this.Key ../this.Value)}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = Utf8JsonReaderHelper.ReadBoolOrNull(ref reader){{#unless (Property.QueryIsNullableValue propertyName ../this.Key ../this.Value)}} ?? false{{/unless}};
+ {{else if (Property.QueryIsNumeric propertyName ../this.Key ../this.Value)}}
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = default;
+ }
+ else
+ {
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = reader.GetDouble();
+ }
+ {{else if (Property.QueryIsUri propertyName ../this.Key ../this.Value)}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = Utf8JsonReaderHelper.ReadUriOrNull(ref reader);
+ {{else if (Property.QueryIsDateTime propertyName ../this.Key ../this.Value)}}
+ {{#if (Property.QueryIsNullableValue propertyName ../this.Key ../this.Value)}}
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = null;
+ }
+ else
+ {
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = Utf8JsonReaderHelper.ReadDateTimeIso8601(ref reader);
+ }
+ {{else}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = Utf8JsonReaderHelper.ReadDateTimeIso8601(ref reader);
+ {{/if}}
+ {{else if (Property.QueryIsGuid propertyName ../this.Key ../this.Value)}}
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ throw new JsonException("The {{propertyName}} property is null, the {{../this.Key}} cannot be deserialized");
+ }
+
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = Utf8JsonReaderHelper.ReadGuid(ref reader);
+ {{else}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+ {{/if}}
+
+ continue;
+ }
+
+ {{/each}}
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ {{#each (Schema.QueryPropertyNames this.Value this.Key) as | propertyName |}}
+ if (!{{#Property.WriteSeenFlag propertyName ../this.Key ../this.Value}})
+ {
+ logger.LogDebug("the {{propertyName}} Json property was not found in the {{../this.Key}}");
+ }
+
+ {{/each}}
+ }
+
+ return {{#DeSerializer.WriteInstanceName this.Key}};
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-json-serializer-openapi-template.hbs b/SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-json-serializer-openapi-template.hbs
index 1fd1d1dc6..4e18f0012 100644
--- a/SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-json-serializer-openapi-template.hbs
+++ b/SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-json-serializer-openapi-template.hbs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
@@ -105,7 +106,7 @@ namespace SysML2.NET.Serializer.Json.PSM
{{else if (Property.QueryIsComposite propertyName ../this.Key ../this.Value)}}
{{#Property.WriteReferencedSerializer propertyName ../this.Key ../this.Value}}.Serialize(item, writer, serializationModeKind, includeDerivedProperties);
{{else if (Property.QueryIsEnumeration propertyName ../this.Key ../this.Value)}}
- writer.WriteStringValue(item.ToWireValue());
+ writer.WriteStringValue({{#Property.WriteEnumerationProvider propertyName ../this.Key ../this.Value}}.ToUtf8Bytes(item));
{{else if (Property.QueryIsBoolean propertyName ../this.Key ../this.Value)}}
writer.WriteBooleanValue(item);
{{else if (Property.QueryIsNumeric propertyName ../this.Key ../this.Value)}}
@@ -160,7 +161,7 @@ namespace SysML2.NET.Serializer.Json.PSM
if ({{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.HasValue)
{
{{#if (Property.QueryIsEnumeration propertyName ../this.Key ../this.Value)}}
- writer.WriteString("{{propertyName}}"u8, {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Value.ToWireValue());
+ writer.WriteString("{{propertyName}}"u8, {{#Property.WriteEnumerationProvider propertyName ../this.Key ../this.Value}}.ToUtf8Bytes({{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Value));
{{else if (Property.QueryIsBoolean propertyName ../this.Key ../this.Value)}}
writer.WriteBoolean("{{propertyName}}"u8, {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Value);
{{else if (Property.QueryIsNumeric propertyName ../this.Key ../this.Value)}}
@@ -174,7 +175,7 @@ namespace SysML2.NET.Serializer.Json.PSM
writer.WriteNull("{{propertyName}}"u8);
}
{{else if (Property.QueryIsEnumeration propertyName ../this.Key ../this.Value)}}
- writer.WriteString("{{propertyName}}"u8, {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.ToWireValue());
+ writer.WriteString("{{propertyName}}"u8, {{#Property.WriteEnumerationProvider propertyName ../this.Key ../this.Value}}.ToUtf8Bytes({{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}));
{{else if (Property.QueryIsBoolean propertyName ../this.Key ../this.Value)}}
writer.WriteBoolean("{{propertyName}}"u8, {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}});
{{else if (Property.QueryIsNumeric propertyName ../this.Key ../this.Value)}}
diff --git a/SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-messagepack-formatter-openapi-template.hbs b/SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-messagepack-formatter-openapi-template.hbs
new file mode 100644
index 000000000..78f8af2aa
--- /dev/null
+++ b/SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-messagepack-formatter-openapi-template.hbs
@@ -0,0 +1,372 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.MessagePack.PSM
+{
+ using System;
+ using System.Collections.Generic;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.Serializer.MessagePack.Core;
+
+ using global::MessagePack;
+ using global::MessagePack.Formatters;
+
+ ///
+ /// The purpose of the is to provide
+ /// the contract for MessagePack serialization of the type
+ ///
+ public class {{this.Key}}MessagePackFormatter : MessagePackFormatterBase, IMessagePackFormatter<{{this.Key}}>
+ {
+ ///
+ /// Serializes a DTO.
+ ///
+ ///
+ /// The to use when serializing the value.
+ ///
+ ///
+ /// The that is to be serialized.
+ ///
+ ///
+ /// The serialization settings to use.
+ ///
+ ///
+ /// Thrown when the DTO is null
+ ///
+ public void Serialize(ref MessagePackWriter writer, {{this.Key}} {{#Serializer.WriteInstanceName this.Key}}, MessagePackSerializerOptions options)
+ {
+ if ({{#Serializer.WriteInstanceName this.Key}} == null)
+ {
+ throw new ArgumentNullException(nameof({{#Serializer.WriteInstanceName this.Key}}), "The {{this.Key}} may not be null");
+ }
+
+ writer.WriteArrayHeader({{#Schema.WritePropertyCount this.Value this.Key}});
+
+ {{#each (Schema.QueryPropertyNames this.Value this.Key) as | propertyName |}}
+ {{#if (Property.QueryIsOverridden propertyName ../this.Key ../this.Value)}}
+ if ({{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} == null)
+ {
+ writer.WriteArrayHeader(0);
+ }
+ else
+ {
+ writer.WriteArrayHeader({{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Count);
+
+ foreach (var item in {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}})
+ {
+ {{#Property.WriteElementWriter propertyName ../this.Key ../this.Value}}(ref writer, item);
+ }
+ }
+ {{else if (Property.QueryIsCollection propertyName ../this.Key ../this.Value)}}
+ if ({{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} == null)
+ {
+ writer.WriteArrayHeader(0);
+ }
+ else
+ {
+ writer.WriteArrayHeader({{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Count);
+
+ foreach (var item in {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}})
+ {
+ {{#if (Property.QueryIsIdentifiedReference propertyName ../this.Key ../this.Value)}}
+ WriteGuidBin16(ref writer, item);
+ {{else if (Property.QueryIsPolymorphic propertyName ../this.Key ../this.Value)}}
+ PsmMessagePackDispatcher.Write(ref writer, item, options);
+ {{else if (Property.QueryIsComposite propertyName ../this.Key ../this.Value)}}
+ options.Resolver.GetFormatterWithVerify<{{#Property.WriteElementType propertyName ../this.Key ../this.Value}}>().Serialize(ref writer, item, options);
+ {{else if (Property.QueryIsEnumeration propertyName ../this.Key ../this.Value)}}
+ writer.WriteString({{#Property.WriteEnumerationProvider propertyName ../this.Key ../this.Value}}.ToUtf8Bytes(item));
+ {{else if (Property.QueryIsBoolean propertyName ../this.Key ../this.Value)}}
+ writer.Write(item);
+ {{else if (Property.QueryIsNumeric propertyName ../this.Key ../this.Value)}}
+ writer.Write(item);
+ {{else if (Property.QueryIsUri propertyName ../this.Key ../this.Value)}}
+ writer.Write(item?.ToString());
+ {{else}}
+ writer.Write(item);
+ {{/if}}
+ }
+ }
+ {{else if (Property.QueryIsIdentifiedReference propertyName ../this.Key ../this.Value)}}
+ {{#if (Property.QueryIsNullableValue propertyName ../this.Key ../this.Value)}}
+ if ({{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.HasValue)
+ {
+ WriteGuidBin16(ref writer, {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Value);
+ }
+ else
+ {
+ writer.WriteNil();
+ }
+ {{else}}
+ WriteGuidBin16(ref writer, {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}});
+ {{/if}}
+ {{else if (Property.QueryIsPolymorphic propertyName ../this.Key ../this.Value)}}
+ PsmMessagePackDispatcher.Write(ref writer, {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}, options);
+ {{else if (Property.QueryIsComposite propertyName ../this.Key ../this.Value)}}
+ if ({{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} == null)
+ {
+ writer.WriteNil();
+ }
+ else
+ {
+ options.Resolver.GetFormatterWithVerify<{{#Property.WriteElementType propertyName ../this.Key ../this.Value}}>().Serialize(ref writer, {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}, options);
+ }
+ {{else if (Property.QueryIsEnumeration propertyName ../this.Key ../this.Value)}}
+ {{#if (Property.QueryIsNullableValue propertyName ../this.Key ../this.Value)}}
+ if ({{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.HasValue)
+ {
+ writer.WriteString({{#Property.WriteEnumerationProvider propertyName ../this.Key ../this.Value}}.ToUtf8Bytes({{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Value));
+ }
+ else
+ {
+ writer.WriteNil();
+ }
+ {{else}}
+ writer.WriteString({{#Property.WriteEnumerationProvider propertyName ../this.Key ../this.Value}}.ToUtf8Bytes({{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}));
+ {{/if}}
+ {{else if (Property.QueryIsGuid propertyName ../this.Key ../this.Value)}}
+ {{#if (Property.QueryIsNullableValue propertyName ../this.Key ../this.Value)}}
+ if ({{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.HasValue)
+ {
+ WriteGuidBin16(ref writer, {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Value);
+ }
+ else
+ {
+ writer.WriteNil();
+ }
+ {{else}}
+ WriteGuidBin16(ref writer, {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}});
+ {{/if}}
+ {{else if (Property.QueryIsDateTime propertyName ../this.Key ../this.Value)}}
+ {{#if (Property.QueryIsNullableValue propertyName ../this.Key ../this.Value)}}
+ if ({{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.HasValue)
+ {
+ writer.Write({{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Value);
+ }
+ else
+ {
+ writer.WriteNil();
+ }
+ {{else}}
+ writer.Write({{#Property.WriteAccessor propertyName ../this.Key ../this.Value}});
+ {{/if}}
+ {{else if (Property.QueryIsNullableValue propertyName ../this.Key ../this.Value)}}
+ if ({{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.HasValue)
+ {
+ writer.Write({{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Value);
+ }
+ else
+ {
+ writer.WriteNil();
+ }
+ {{else if (Property.QueryIsUri propertyName ../this.Key ../this.Value)}}
+ writer.Write({{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}?.ToString());
+ {{else}}
+ writer.Write({{#Property.WriteAccessor propertyName ../this.Key ../this.Value}});
+ {{/if}}
+
+ {{/each}}
+ writer.Flush();
+ }
+
+ ///
+ /// Deserializes a DTO.
+ ///
+ ///
+ /// The to deserialize the from.
+ ///
+ ///
+ /// The serialization settings to use.
+ ///
+ ///
+ /// The deserialized .
+ ///
+ public {{this.Key}} Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
+ {
+ if (reader.TryReadNil())
+ {
+ return null;
+ }
+
+ options.Security.DepthStep(ref reader);
+
+ var {{#Serializer.WriteInstanceName this.Key}} = new {{this.Key}}();
+
+ var propertyCounter = reader.ReadArrayHeader();
+
+ for (var i = 0; i < propertyCounter; i++)
+ {
+ switch (i)
+ {
+ {{#each (Schema.QueryPropertyNames this.Value this.Key) as | propertyName |}}
+ case {{@index}}:
+ {{#if (Property.QueryIsOverridden propertyName ../this.Key ../this.Value)}}
+ var {{#Property.WriteLocalName propertyName ../this.Key ../this.Value}}Length = reader.ReadArrayHeader();
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = new List<{{#Property.WriteElementType propertyName ../this.Key ../this.Value}}>({{#Property.WriteLocalName propertyName ../this.Key ../this.Value}}Length);
+
+ for (var valueCounter = 0; valueCounter < {{#Property.WriteLocalName propertyName ../this.Key ../this.Value}}Length; valueCounter++)
+ {
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Add({{#Property.WriteElementReader propertyName ../this.Key ../this.Value}}(ref reader));
+ }
+
+ {{else if (Property.QueryIsCollection propertyName ../this.Key ../this.Value)}}
+ var {{#Property.WriteLocalName propertyName ../this.Key ../this.Value}}Length = reader.ReadArrayHeader();
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = new List<{{#Property.WriteElementType propertyName ../this.Key ../this.Value}}>({{#Property.WriteLocalName propertyName ../this.Key ../this.Value}}Length);
+
+ for (var valueCounter = 0; valueCounter < {{#Property.WriteLocalName propertyName ../this.Key ../this.Value}}Length; valueCounter++)
+ {
+ {{#if (Property.QueryIsIdentifiedReference propertyName ../this.Key ../this.Value)}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Add(ReadGuidBin16(ref reader));
+ {{else if (Property.QueryIsPolymorphic propertyName ../this.Key ../this.Value)}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Add(({{#Property.WriteElementType propertyName ../this.Key ../this.Value}})PsmMessagePackDispatcher.Read(ref reader, options));
+ {{else if (Property.QueryIsComposite propertyName ../this.Key ../this.Value)}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Add(options.Resolver.GetFormatterWithVerify<{{#Property.WriteElementType propertyName ../this.Key ../this.Value}}>().Deserialize(ref reader, options));
+ {{else if (Property.QueryIsEnumeration propertyName ../this.Key ../this.Value)}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Add({{#Property.WriteEnumerationProvider propertyName ../this.Key ../this.Value}}.Parse(reader.ReadStringSequence().Value));
+ {{else if (Property.QueryIsBoolean propertyName ../this.Key ../this.Value)}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Add(reader.ReadBoolean());
+ {{else if (Property.QueryIsNumeric propertyName ../this.Key ../this.Value)}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Add(reader.ReadDouble());
+ {{else if (Property.QueryIsUri propertyName ../this.Key ../this.Value)}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Add(ReadUriOrNull(ref reader));
+ {{else if (Property.QueryIsGuid propertyName ../this.Key ../this.Value)}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Add(ReadGuidBin16(ref reader));
+ {{else}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}}.Add(reader.ReadString());
+ {{/if}}
+ }
+
+ {{else if (Property.QueryIsIdentifiedReference propertyName ../this.Key ../this.Value)}}
+ {{#if (Property.QueryIsNullableValue propertyName ../this.Key ../this.Value)}}
+ if (reader.TryReadNil())
+ {
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = null;
+ }
+ else
+ {
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = ReadGuidBin16(ref reader);
+ }
+
+ {{else}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = ReadGuidBin16(ref reader);
+ {{/if}}
+ {{else if (Property.QueryIsPolymorphic propertyName ../this.Key ../this.Value)}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = ({{#Property.WriteUnionType propertyName ../this.Key ../this.Value}})PsmMessagePackDispatcher.Read(ref reader, options);
+ {{else if (Property.QueryIsComposite propertyName ../this.Key ../this.Value)}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = options.Resolver.GetFormatterWithVerify<{{#Property.WriteElementType propertyName ../this.Key ../this.Value}}>().Deserialize(ref reader, options);
+ {{else if (Property.QueryIsEnumeration propertyName ../this.Key ../this.Value)}}
+ {{#if (Property.QueryIsNullableValue propertyName ../this.Key ../this.Value)}}
+ if (reader.TryReadNil())
+ {
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = null;
+ }
+ else
+ {
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = {{#Property.WriteEnumerationProvider propertyName ../this.Key ../this.Value}}.Parse(reader.ReadStringSequence().Value);
+ }
+
+ {{else}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = {{#Property.WriteEnumerationProvider propertyName ../this.Key ../this.Value}}.Parse(reader.ReadStringSequence().Value);
+ {{/if}}
+ {{else if (Property.QueryIsGuid propertyName ../this.Key ../this.Value)}}
+ {{#if (Property.QueryIsNullableValue propertyName ../this.Key ../this.Value)}}
+ if (reader.TryReadNil())
+ {
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = null;
+ }
+ else
+ {
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = ReadGuidBin16(ref reader);
+ }
+
+ {{else}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = ReadGuidBin16(ref reader);
+ {{/if}}
+ {{else if (Property.QueryIsDateTime propertyName ../this.Key ../this.Value)}}
+ {{#if (Property.QueryIsNullableValue propertyName ../this.Key ../this.Value)}}
+ if (reader.TryReadNil())
+ {
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = null;
+ }
+ else
+ {
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = reader.ReadDateTime();
+ }
+
+ {{else}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = reader.ReadDateTime();
+ {{/if}}
+ {{else if (Property.QueryIsBoolean propertyName ../this.Key ../this.Value)}}
+ {{#if (Property.QueryIsNullableValue propertyName ../this.Key ../this.Value)}}
+ if (reader.TryReadNil())
+ {
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = null;
+ }
+ else
+ {
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = reader.ReadBoolean();
+ }
+
+ {{else}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = reader.ReadBoolean();
+ {{/if}}
+ {{else if (Property.QueryIsNumeric propertyName ../this.Key ../this.Value)}}
+ {{#if (Property.QueryIsNullableValue propertyName ../this.Key ../this.Value)}}
+ if (reader.TryReadNil())
+ {
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = null;
+ }
+ else
+ {
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = reader.ReadDouble();
+ }
+
+ {{else}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = reader.ReadDouble();
+ {{/if}}
+ {{else if (Property.QueryIsUri propertyName ../this.Key ../this.Value)}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = ReadUriOrNull(ref reader);
+ {{else}}
+ {{#Property.WriteAccessor propertyName ../this.Key ../this.Value}} = reader.ReadString();
+ {{/if}}
+ break;
+
+ {{/each}}
+ default:
+ reader.Skip();
+ break;
+ }
+ }
+
+ reader.Depth--;
+
+ return {{#Serializer.WriteInstanceName this.Key}};
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-messagepack-formatterhelper-openapi-template.hbs b/SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-messagepack-formatterhelper-openapi-template.hbs
new file mode 100644
index 000000000..01ff7b652
--- /dev/null
+++ b/SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-messagepack-formatterhelper-openapi-template.hbs
@@ -0,0 +1,79 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.MessagePack.PSM
+{
+ using System;
+ using System.Collections.Generic;
+
+ ///
+ /// Helper class that resolves a MessagePack formatter for the Systems Modeling API and Services types
+ ///
+ internal static class PsmDataResolverGetFormatterHelper
+ {
+ ///
+ /// Maps a to the formatter that serializes it
+ ///
+ private static readonly Dictionary FormatterMap = new()
+ {
+ { typeof(RequestPayload), new RequestPayloadMessagePackFormatter() },
+ { typeof(ResponsePayload), new ResponsePayloadMessagePackFormatter() },
+ {{#each this as | schemaName |}}
+ { typeof(SysML2.NET.PSM.DTO.{{schemaName}}), new {{schemaName}}MessagePackFormatter() },
+ {{/each}}
+ };
+
+ ///
+ /// Resolves the formatter that serializes the specified
+ ///
+ ///
+ /// The that is to be serialized
+ ///
+ ///
+ /// The formatter, or null when the is not a Systems Modeling API and Services type
+ ///
+ internal static object GetFormatter(Type type)
+ {
+ return FormatterMap.TryGetValue(type, out var formatter) ? formatter : null;
+ }
+
+ ///
+ /// Asserts whether the specified is a Systems Modeling API and Services type
+ ///
+ ///
+ /// The for which support is asserted
+ ///
+ ///
+ /// True when the is supported
+ ///
+ internal static bool IsTypeSupported(Type type)
+ {
+ return FormatterMap.ContainsKey(type);
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-enumeration-extensions-openapi-template.hbs b/SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-messagepack-payload-openapi-template.hbs
similarity index 58%
rename from SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-enumeration-extensions-openapi-template.hbs
rename to SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-messagepack-payload-openapi-template.hbs
index 9af5c2627..15e399fe3 100644
--- a/SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-enumeration-extensions-openapi-template.hbs
+++ b/SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-messagepack-payload-openapi-template.hbs
@@ -1,5 +1,5 @@
// -------------------------------------------------------------------------------------------------
-//
+//
//
// Copyright (C) 2022-2026 Starion Group S.A.
//
@@ -22,33 +22,31 @@
// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
// ------------------------------------------------------------------------------------------------
-namespace SysML2.NET.PSM.Enumerations
+namespace SysML2.NET.Serializer.MessagePack.PSM
{
using System;
- using System.CodeDom.Compiler;
+ using System.Collections.Generic;
+
+ using SysML2.NET.PSM.DTO;
///
- /// Extension methods for the enumeration
+ /// The acts as envelope around the Systems Modeling API and Services
+ /// {{this.Family}} data transfer objects and is used as construct to transport them using MessagePack
///
- [GeneratedCode("SysML2.NET", "latest")]
- public static class {{this.Key}}Extensions
+ internal class {{this.PayloadName}}
{
///
- /// Queries the value that represents the literal in the Systems Modeling API and Services
+ /// Gets or sets the at which the was created
///
- /// The subject .
- /// The value as it appears on the wire.
- /// Thrown when the literal is not known.
- public static string ToWireValue(this {{this.Key}} value)
- {
- return value switch
- {
- {{#each (Enumeration.QueryValues this.Value) as | enumerationValue |}}
- {{../this.Key}}.{{#Enumeration.WriteLiteralName enumerationValue}} => "{{{enumerationValue}}}",
- {{/each}}
- _ => throw new ArgumentOutOfRangeException(nameof(value))
- };
- }
+ internal DateTime Created { get; set; } = DateTime.UtcNow;
+
+ {{#each this.Entries as | entry |}}
+ ///
+ /// Gets or sets the list of .
+ ///
+ internal List<{{entry.SchemaName}}> {{entry.SchemaName}} { get; set; } = [];
+
+ {{/each}}
}
}
diff --git a/SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-messagepack-payloadfactory-openapi-template.hbs b/SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-messagepack-payloadfactory-openapi-template.hbs
new file mode 100644
index 000000000..a391f3bf1
--- /dev/null
+++ b/SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-messagepack-payloadfactory-openapi-template.hbs
@@ -0,0 +1,115 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.MessagePack.PSM
+{
+ using System;
+ using System.Collections.Generic;
+
+ using SysML2.NET.PSM.DTO;
+
+ ///
+ /// The purpose of the class is to create an
+ /// instance of
+ ///
+ internal static class {{this.PayloadName}}Factory
+ {
+ ///
+ /// Creates an instance of from the provided
+ ///
+ ///
+ /// The on the bases of which the will be created
+ ///
+ ///
+ /// An instance of
+ ///
+ ///
+ /// Thrown when the data items are null
+ ///
+ ///
+ /// Thrown when a data item is of a type that the envelope does not carry
+ ///
+ internal static {{this.PayloadName}} To{{this.PayloadName}}(this IEnumerable<{{this.MarkerInterface}}> dataItems)
+ {
+ if (dataItems == null)
+ {
+ throw new ArgumentNullException(nameof(dataItems));
+ }
+
+ var payload = new {{this.PayloadName}}
+ {
+ Created = DateTime.UtcNow
+ };
+
+ foreach (var dataItem in dataItems)
+ {
+ switch (dataItem)
+ {
+ {{#each this.Entries as | entry |}}
+ case {{entry.SchemaName}} {{entry.InstanceName}}:
+ payload.{{entry.SchemaName}}.Add({{entry.InstanceName}});
+ break;
+
+ {{/each}}
+ default:
+ throw new NotSupportedException($"The {dataItem.GetType().Name} is not carried by the {{this.PayloadName}}.");
+ }
+ }
+
+ return payload;
+ }
+
+ ///
+ /// Flattens the into the data items that it carries
+ ///
+ ///
+ /// The that is to be flattened
+ ///
+ ///
+ /// An
+ ///
+ ///
+ /// Thrown when the payload is null
+ ///
+ internal static IEnumerable<{{this.MarkerInterface}}> ToDataItems(this {{this.PayloadName}} payload)
+ {
+ if (payload == null)
+ {
+ throw new ArgumentNullException(nameof(payload));
+ }
+
+ var dataItems = new List<{{this.MarkerInterface}}>();
+
+ {{#each this.Entries as | entry |}}
+ dataItems.AddRange(payload.{{entry.SchemaName}});
+ {{/each}}
+
+ return dataItems;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-messagepack-payloadformatter-openapi-template.hbs b/SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-messagepack-payloadformatter-openapi-template.hbs
new file mode 100644
index 000000000..d517e0302
--- /dev/null
+++ b/SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-messagepack-payloadformatter-openapi-template.hbs
@@ -0,0 +1,142 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.MessagePack.PSM
+{
+ using System;
+
+ using SysML2.NET.PSM.DTO;
+
+ using global::MessagePack;
+ using global::MessagePack.Formatters;
+
+ ///
+ /// The purpose of the is to provide
+ /// the contract for serialization of the type
+ ///
+ internal class {{this.PayloadName}}MessagePackFormatter : IMessagePackFormatter<{{this.PayloadName}}>
+ {
+ ///
+ /// Serializes a .
+ ///
+ ///
+ /// The writer to use when serializing the .
+ ///
+ ///
+ /// The that is to be serialized.
+ ///
+ ///
+ /// The serialization settings to use.
+ ///
+ ///
+ /// Thrown when the payload is null
+ ///
+ public void Serialize(ref MessagePackWriter writer, {{this.PayloadName}} payload, MessagePackSerializerOptions options)
+ {
+ if (payload == null)
+ {
+ throw new ArgumentNullException(nameof(payload), "The {{this.PayloadName}} may not be null");
+ }
+
+ var formatterResolver = options.Resolver;
+
+ writer.WriteArrayHeader({{this.SlotCount}});
+
+ writer.Write(payload.Created);
+
+ {{#each this.Entries as | entry |}}
+ writer.WriteArrayHeader(payload.{{entry.SchemaName}}.Count);
+ foreach (var {{entry.InstanceName}}Dto in payload.{{entry.SchemaName}})
+ {
+ formatterResolver.GetFormatterWithVerify<{{entry.SchemaName}}>().Serialize(ref writer, {{entry.InstanceName}}Dto, options);
+ }
+
+ {{/each}}
+ writer.Flush();
+ }
+
+ ///
+ /// Deserializes a .
+ ///
+ ///
+ /// The to deserialize the from.
+ ///
+ ///
+ /// The serialization settings to use.
+ ///
+ ///
+ /// The deserialized .
+ ///
+ public {{this.PayloadName}} Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
+ {
+ if (reader.TryReadNil())
+ {
+ return null;
+ }
+
+ options.Security.DepthStep(ref reader);
+
+ var formatterResolver = options.Resolver;
+
+ var payload = new {{this.PayloadName}}();
+
+ var slotCounter = reader.ReadArrayHeader();
+
+ for (var i = 0; i < slotCounter; i++)
+ {
+ switch (i)
+ {
+ case 0:
+ payload.Created = reader.ReadDateTime();
+ break;
+
+ {{#each this.Entries as | entry |}}
+ case {{entry.SlotIndex}}:
+ var {{entry.InstanceName}}Length = reader.ReadArrayHeader();
+ payload.{{entry.SchemaName}}.Capacity = {{entry.InstanceName}}Length;
+
+ for (var valueCounter = 0; valueCounter < {{entry.InstanceName}}Length; valueCounter++)
+ {
+ payload.{{entry.SchemaName}}.Add(formatterResolver.GetFormatterWithVerify<{{entry.SchemaName}}>().Deserialize(ref reader, options));
+ }
+
+ break;
+
+ {{/each}}
+ default:
+ reader.Skip();
+ break;
+ }
+ }
+
+ reader.Depth--;
+
+ return payload;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Dal/Assembler.cs b/SysML2.NET.Dal/Assembler.cs
index 817585ff6..3a24e5ef0 100644
--- a/SysML2.NET.Dal/Assembler.cs
+++ b/SysML2.NET.Dal/Assembler.cs
@@ -103,7 +103,11 @@ public void Synchronize(IEnumerable dtos)
{
if (!this.Cache.TryRemove(identifier, out var deletedLazyPoco))
{
- this.logger.LogWarning("The element with identifier {Identifier} was not deleted as it could not be found in the cache", identifier);
+ if (this.logger.IsEnabled(LogLevel.Warning))
+ {
+ this.logger.LogWarning("The element with identifier {Identifier} was not deleted as it could not be found in the cache", identifier);
+ }
+
continue;
}
diff --git a/SysML2.NET.Dal/SysML2.NET.Dal.csproj b/SysML2.NET.Dal/SysML2.NET.Dal.csproj
index 151ded8b2..d1fa60194 100644
--- a/SysML2.NET.Dal/SysML2.NET.Dal.csproj
+++ b/SysML2.NET.Dal/SysML2.NET.Dal.csproj
@@ -1,41 +1,41 @@
-
-
-
- netstandard2.1;net10.0
- 12.0
- 0.23.0
- A .NET implementation of the OMG SysML v2 specification data-acces-layer.
- SysML2.NET.Dal
- Starion Group S.A.
- Copyright © Starion Group S.A.
- Apache-2.0
- https://github.com/STARIONGROUP/SysML2.NET.git
- Git
- Sam Gerené
- true
-
- [Fix] Assembler.Synchronize no longer degrades to O(n2) on large models (#347)
- [Fix] The Assembler deletion path no longer throws on every removal (#349)
- [Update] Aligned with SysML2.NET 0.23.0
-
- cdp4-icon.png
- README.md
- true
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ netstandard2.1;net10.0
+ 14.0
+ 0.23.0
+ A .NET implementation of the OMG SysML v2 specification data-acces-layer.
+ SysML2.NET.Dal
+ Starion Group S.A.
+ Copyright © Starion Group S.A.
+ Apache-2.0
+ https://github.com/STARIONGROUP/SysML2.NET.git
+ Git
+ Sam Gerené
+ true
+
+ [Fix] Assembler.Synchronize no longer degrades to O(n2) on large models (#347)
+ [Fix] The Assembler deletion path no longer throws on every removal (#349)
+ [Update] Aligned with SysML2.NET 0.23.0
+
+ cdp4-icon.png
+ README.md
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/SysML2.NET.Extensions.Tests/PSM/EnumProvider/CompositeConstraintOperatorProviderTestFixture.cs b/SysML2.NET.Extensions.Tests/PSM/EnumProvider/CompositeConstraintOperatorProviderTestFixture.cs
new file mode 100644
index 000000000..2839fe40d
--- /dev/null
+++ b/SysML2.NET.Extensions.Tests/PSM/EnumProvider/CompositeConstraintOperatorProviderTestFixture.cs
@@ -0,0 +1,90 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Extensions.Tests.PSM.EnumProvider
+{
+ using System;
+ using System.Buffers;
+ using System.Text;
+
+ using NUnit.Framework;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.Enumerations;
+
+ [TestFixture]
+ public class CompositeConstraintOperatorProviderTestFixture
+ {
+ [Test]
+ public void VerifyParse()
+ {
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(CompositeConstraintOperatorProvider.Parse("and".AsSpan()), Is.EqualTo(CompositeConstraintOperator.and));
+ Assert.That(CompositeConstraintOperatorProvider.Parse("or".AsSpan()), Is.EqualTo(CompositeConstraintOperator.or));
+ Assert.That(CompositeConstraintOperatorProvider.Parse("AND".AsSpan()), Is.EqualTo(CompositeConstraintOperator.and));
+
+ Assert.That(CompositeConstraintOperatorProvider.Parse("and"u8), Is.EqualTo(CompositeConstraintOperator.and));
+ Assert.That(CompositeConstraintOperatorProvider.Parse("or"u8), Is.EqualTo(CompositeConstraintOperator.or));
+
+ Assert.That(() => CompositeConstraintOperatorProvider.Parse("xor".AsSpan()), Throws.ArgumentException);
+ Assert.That(() => CompositeConstraintOperatorProvider.Parse(string.Empty.AsSpan()), Throws.ArgumentException);
+ Assert.That(() => CompositeConstraintOperatorProvider.Parse("xor"u8), Throws.ArgumentException);
+ Assert.That(() => CompositeConstraintOperatorProvider.Parse("Starion"u8), Throws.ArgumentException);
+ }
+
+ var singleSegment = new ReadOnlySequence(Encoding.UTF8.GetBytes("and"));
+ var unknownSegment = new ReadOnlySequence(Encoding.UTF8.GetBytes("Starion"));
+
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(CompositeConstraintOperatorProvider.Parse(in singleSegment), Is.EqualTo(CompositeConstraintOperator.and));
+ Assert.That(() => CompositeConstraintOperatorProvider.Parse(in unknownSegment), Throws.ArgumentException);
+ }
+ }
+
+ [Test]
+ public void VerifyTryParse()
+ {
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(CompositeConstraintOperatorProvider.TryParse("or".AsSpan(), out var or), Is.True);
+ Assert.That(or, Is.EqualTo(CompositeConstraintOperator.or));
+ }
+
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(CompositeConstraintOperatorProvider.TryParse("xor".AsSpan(), out var unknown), Is.False);
+ Assert.That(unknown, Is.EqualTo(default(CompositeConstraintOperator)));
+ }
+ }
+
+ [Test]
+ public void VerifyToUtf8Bytes()
+ {
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(CompositeConstraintOperatorProvider.ToUtf8Bytes(CompositeConstraintOperator.and).SequenceEqual("and"u8), Is.True);
+ Assert.That(CompositeConstraintOperatorProvider.ToUtf8Bytes(CompositeConstraintOperator.or).SequenceEqual("or"u8), Is.True);
+ Assert.That(() => CompositeConstraintOperatorProvider.ToUtf8Bytes((CompositeConstraintOperator)123456), Throws.TypeOf());
+ }
+ }
+ }
+}
diff --git a/SysML2.NET.Extensions.Tests/PSM/EnumProvider/CompositeConstraintRequestOperatorProviderTestFixture.cs b/SysML2.NET.Extensions.Tests/PSM/EnumProvider/CompositeConstraintRequestOperatorProviderTestFixture.cs
new file mode 100644
index 000000000..2371294c6
--- /dev/null
+++ b/SysML2.NET.Extensions.Tests/PSM/EnumProvider/CompositeConstraintRequestOperatorProviderTestFixture.cs
@@ -0,0 +1,90 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Extensions.Tests.PSM.EnumProvider
+{
+ using System;
+ using System.Buffers;
+ using System.Text;
+
+ using NUnit.Framework;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.Enumerations;
+
+ [TestFixture]
+ public class CompositeConstraintRequestOperatorProviderTestFixture
+ {
+ [Test]
+ public void VerifyParse()
+ {
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(CompositeConstraintRequestOperatorProvider.Parse("and".AsSpan()), Is.EqualTo(CompositeConstraintRequestOperator.and));
+ Assert.That(CompositeConstraintRequestOperatorProvider.Parse("or".AsSpan()), Is.EqualTo(CompositeConstraintRequestOperator.or));
+ Assert.That(CompositeConstraintRequestOperatorProvider.Parse("AND".AsSpan()), Is.EqualTo(CompositeConstraintRequestOperator.and));
+
+ Assert.That(CompositeConstraintRequestOperatorProvider.Parse("and"u8), Is.EqualTo(CompositeConstraintRequestOperator.and));
+ Assert.That(CompositeConstraintRequestOperatorProvider.Parse("or"u8), Is.EqualTo(CompositeConstraintRequestOperator.or));
+
+ Assert.That(() => CompositeConstraintRequestOperatorProvider.Parse("xor".AsSpan()), Throws.ArgumentException);
+ Assert.That(() => CompositeConstraintRequestOperatorProvider.Parse(string.Empty.AsSpan()), Throws.ArgumentException);
+ Assert.That(() => CompositeConstraintRequestOperatorProvider.Parse("xor"u8), Throws.ArgumentException);
+ Assert.That(() => CompositeConstraintRequestOperatorProvider.Parse("Starion"u8), Throws.ArgumentException);
+ }
+
+ var singleSegment = new ReadOnlySequence(Encoding.UTF8.GetBytes("and"));
+ var unknownSegment = new ReadOnlySequence(Encoding.UTF8.GetBytes("Starion"));
+
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(CompositeConstraintRequestOperatorProvider.Parse(in singleSegment), Is.EqualTo(CompositeConstraintRequestOperator.and));
+ Assert.That(() => CompositeConstraintRequestOperatorProvider.Parse(in unknownSegment), Throws.ArgumentException);
+ }
+ }
+
+ [Test]
+ public void VerifyTryParse()
+ {
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(CompositeConstraintRequestOperatorProvider.TryParse("or".AsSpan(), out var or), Is.True);
+ Assert.That(or, Is.EqualTo(CompositeConstraintRequestOperator.or));
+ }
+
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(CompositeConstraintRequestOperatorProvider.TryParse("xor".AsSpan(), out var unknown), Is.False);
+ Assert.That(unknown, Is.EqualTo(default(CompositeConstraintRequestOperator)));
+ }
+ }
+
+ [Test]
+ public void VerifyToUtf8Bytes()
+ {
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(CompositeConstraintRequestOperatorProvider.ToUtf8Bytes(CompositeConstraintRequestOperator.and).SequenceEqual("and"u8), Is.True);
+ Assert.That(CompositeConstraintRequestOperatorProvider.ToUtf8Bytes(CompositeConstraintRequestOperator.or).SequenceEqual("or"u8), Is.True);
+ Assert.That(() => CompositeConstraintRequestOperatorProvider.ToUtf8Bytes((CompositeConstraintRequestOperator)123456), Throws.TypeOf());
+ }
+ }
+ }
+}
diff --git a/SysML2.NET.Extensions.Tests/PSM/EnumProvider/PrimitiveConstraintOperatorProviderTestFixture.cs b/SysML2.NET.Extensions.Tests/PSM/EnumProvider/PrimitiveConstraintOperatorProviderTestFixture.cs
new file mode 100644
index 000000000..095b91f69
--- /dev/null
+++ b/SysML2.NET.Extensions.Tests/PSM/EnumProvider/PrimitiveConstraintOperatorProviderTestFixture.cs
@@ -0,0 +1,100 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Extensions.Tests.PSM.EnumProvider
+{
+ using System;
+ using System.Buffers;
+ using System.Text;
+
+ using NUnit.Framework;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.Enumerations;
+
+ [TestFixture]
+ public class PrimitiveConstraintOperatorProviderTestFixture
+ {
+ [Test]
+ public void VerifyParse()
+ {
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(PrimitiveConstraintOperatorProvider.Parse("<".AsSpan()), Is.EqualTo(PrimitiveConstraintOperator.lessthan));
+ Assert.That(PrimitiveConstraintOperatorProvider.Parse("<=".AsSpan()), Is.EqualTo(PrimitiveConstraintOperator.lessthanorequalto));
+ Assert.That(PrimitiveConstraintOperatorProvider.Parse("=".AsSpan()), Is.EqualTo(PrimitiveConstraintOperator.equalto));
+ Assert.That(PrimitiveConstraintOperatorProvider.Parse(">".AsSpan()), Is.EqualTo(PrimitiveConstraintOperator.greaterthan));
+ Assert.That(PrimitiveConstraintOperatorProvider.Parse(">=".AsSpan()), Is.EqualTo(PrimitiveConstraintOperator.greaterthanorequalto));
+ Assert.That(PrimitiveConstraintOperatorProvider.Parse("in".AsSpan()), Is.EqualTo(PrimitiveConstraintOperator.@in));
+ Assert.That(PrimitiveConstraintOperatorProvider.Parse("instanceOf".AsSpan()), Is.EqualTo(PrimitiveConstraintOperator.instanceOf));
+ Assert.That(PrimitiveConstraintOperatorProvider.Parse("INSTANCEOF".AsSpan()), Is.EqualTo(PrimitiveConstraintOperator.instanceOf));
+
+ Assert.That(PrimitiveConstraintOperatorProvider.Parse("instanceOf"u8), Is.EqualTo(PrimitiveConstraintOperator.instanceOf));
+ Assert.That(PrimitiveConstraintOperatorProvider.Parse("<="u8), Is.EqualTo(PrimitiveConstraintOperator.lessthanorequalto));
+
+ Assert.That(() => PrimitiveConstraintOperatorProvider.Parse("Starion".AsSpan()), Throws.ArgumentException);
+ Assert.That(() => PrimitiveConstraintOperatorProvider.Parse(string.Empty.AsSpan()), Throws.ArgumentException);
+ Assert.That(() => PrimitiveConstraintOperatorProvider.Parse("Starion"u8), Throws.ArgumentException);
+ Assert.That(() => PrimitiveConstraintOperatorProvider.Parse("aRatherLongerValue"u8), Throws.ArgumentException);
+ }
+
+ var singleSegment = new ReadOnlySequence(Encoding.UTF8.GetBytes("instanceOf"));
+ var unknownSegment = new ReadOnlySequence(Encoding.UTF8.GetBytes("Starion"));
+
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(PrimitiveConstraintOperatorProvider.Parse(in singleSegment), Is.EqualTo(PrimitiveConstraintOperator.instanceOf));
+ Assert.That(() => PrimitiveConstraintOperatorProvider.Parse(in unknownSegment), Throws.ArgumentException);
+ }
+ }
+
+ [Test]
+ public void VerifyTryParse()
+ {
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(PrimitiveConstraintOperatorProvider.TryParse(">=".AsSpan(), out var greaterThanOrEqualTo), Is.True);
+ Assert.That(greaterThanOrEqualTo, Is.EqualTo(PrimitiveConstraintOperator.greaterthanorequalto));
+ }
+
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(PrimitiveConstraintOperatorProvider.TryParse("Starion".AsSpan(), out var unknown), Is.False);
+ Assert.That(unknown, Is.EqualTo(default(PrimitiveConstraintOperator)));
+ }
+ }
+
+ [Test]
+ public void VerifyToUtf8Bytes()
+ {
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(PrimitiveConstraintOperatorProvider.ToUtf8Bytes(PrimitiveConstraintOperator.lessthan).SequenceEqual("<"u8), Is.True);
+ Assert.That(PrimitiveConstraintOperatorProvider.ToUtf8Bytes(PrimitiveConstraintOperator.lessthanorequalto).SequenceEqual("<="u8), Is.True);
+ Assert.That(PrimitiveConstraintOperatorProvider.ToUtf8Bytes(PrimitiveConstraintOperator.equalto).SequenceEqual("="u8), Is.True);
+ Assert.That(PrimitiveConstraintOperatorProvider.ToUtf8Bytes(PrimitiveConstraintOperator.greaterthan).SequenceEqual(">"u8), Is.True);
+ Assert.That(PrimitiveConstraintOperatorProvider.ToUtf8Bytes(PrimitiveConstraintOperator.greaterthanorequalto).SequenceEqual(">="u8), Is.True);
+ Assert.That(PrimitiveConstraintOperatorProvider.ToUtf8Bytes(PrimitiveConstraintOperator.@in).SequenceEqual("in"u8), Is.True);
+ Assert.That(PrimitiveConstraintOperatorProvider.ToUtf8Bytes(PrimitiveConstraintOperator.instanceOf).SequenceEqual("instanceOf"u8), Is.True);
+ Assert.That(() => PrimitiveConstraintOperatorProvider.ToUtf8Bytes((PrimitiveConstraintOperator)123456), Throws.TypeOf());
+ }
+ }
+ }
+}
diff --git a/SysML2.NET.Extensions.Tests/PSM/EnumProvider/PrimitiveConstraintRequestOperatorProviderTestFixture.cs b/SysML2.NET.Extensions.Tests/PSM/EnumProvider/PrimitiveConstraintRequestOperatorProviderTestFixture.cs
new file mode 100644
index 000000000..59c5ea141
--- /dev/null
+++ b/SysML2.NET.Extensions.Tests/PSM/EnumProvider/PrimitiveConstraintRequestOperatorProviderTestFixture.cs
@@ -0,0 +1,100 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Extensions.Tests.PSM.EnumProvider
+{
+ using System;
+ using System.Buffers;
+ using System.Text;
+
+ using NUnit.Framework;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.Enumerations;
+
+ [TestFixture]
+ public class PrimitiveConstraintRequestOperatorProviderTestFixture
+ {
+ [Test]
+ public void VerifyParse()
+ {
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(PrimitiveConstraintRequestOperatorProvider.Parse("<".AsSpan()), Is.EqualTo(PrimitiveConstraintRequestOperator.lessthan));
+ Assert.That(PrimitiveConstraintRequestOperatorProvider.Parse("<=".AsSpan()), Is.EqualTo(PrimitiveConstraintRequestOperator.lessthanorequalto));
+ Assert.That(PrimitiveConstraintRequestOperatorProvider.Parse("=".AsSpan()), Is.EqualTo(PrimitiveConstraintRequestOperator.equalto));
+ Assert.That(PrimitiveConstraintRequestOperatorProvider.Parse(">".AsSpan()), Is.EqualTo(PrimitiveConstraintRequestOperator.greaterthan));
+ Assert.That(PrimitiveConstraintRequestOperatorProvider.Parse(">=".AsSpan()), Is.EqualTo(PrimitiveConstraintRequestOperator.greaterthanorequalto));
+ Assert.That(PrimitiveConstraintRequestOperatorProvider.Parse("in".AsSpan()), Is.EqualTo(PrimitiveConstraintRequestOperator.@in));
+ Assert.That(PrimitiveConstraintRequestOperatorProvider.Parse("instanceOf".AsSpan()), Is.EqualTo(PrimitiveConstraintRequestOperator.instanceOf));
+ Assert.That(PrimitiveConstraintRequestOperatorProvider.Parse("INSTANCEOF".AsSpan()), Is.EqualTo(PrimitiveConstraintRequestOperator.instanceOf));
+
+ Assert.That(PrimitiveConstraintRequestOperatorProvider.Parse("instanceOf"u8), Is.EqualTo(PrimitiveConstraintRequestOperator.instanceOf));
+ Assert.That(PrimitiveConstraintRequestOperatorProvider.Parse("<="u8), Is.EqualTo(PrimitiveConstraintRequestOperator.lessthanorequalto));
+
+ Assert.That(() => PrimitiveConstraintRequestOperatorProvider.Parse("Starion".AsSpan()), Throws.ArgumentException);
+ Assert.That(() => PrimitiveConstraintRequestOperatorProvider.Parse(string.Empty.AsSpan()), Throws.ArgumentException);
+ Assert.That(() => PrimitiveConstraintRequestOperatorProvider.Parse("Starion"u8), Throws.ArgumentException);
+ Assert.That(() => PrimitiveConstraintRequestOperatorProvider.Parse("aRatherLongerValue"u8), Throws.ArgumentException);
+ }
+
+ var singleSegment = new ReadOnlySequence(Encoding.UTF8.GetBytes("instanceOf"));
+ var unknownSegment = new ReadOnlySequence(Encoding.UTF8.GetBytes("Starion"));
+
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(PrimitiveConstraintRequestOperatorProvider.Parse(in singleSegment), Is.EqualTo(PrimitiveConstraintRequestOperator.instanceOf));
+ Assert.That(() => PrimitiveConstraintRequestOperatorProvider.Parse(in unknownSegment), Throws.ArgumentException);
+ }
+ }
+
+ [Test]
+ public void VerifyTryParse()
+ {
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(PrimitiveConstraintRequestOperatorProvider.TryParse(">=".AsSpan(), out var greaterThanOrEqualTo), Is.True);
+ Assert.That(greaterThanOrEqualTo, Is.EqualTo(PrimitiveConstraintRequestOperator.greaterthanorequalto));
+ }
+
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(PrimitiveConstraintRequestOperatorProvider.TryParse("Starion".AsSpan(), out var unknown), Is.False);
+ Assert.That(unknown, Is.EqualTo(default(PrimitiveConstraintRequestOperator)));
+ }
+ }
+
+ [Test]
+ public void VerifyToUtf8Bytes()
+ {
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(PrimitiveConstraintRequestOperatorProvider.ToUtf8Bytes(PrimitiveConstraintRequestOperator.lessthan).SequenceEqual("<"u8), Is.True);
+ Assert.That(PrimitiveConstraintRequestOperatorProvider.ToUtf8Bytes(PrimitiveConstraintRequestOperator.lessthanorequalto).SequenceEqual("<="u8), Is.True);
+ Assert.That(PrimitiveConstraintRequestOperatorProvider.ToUtf8Bytes(PrimitiveConstraintRequestOperator.equalto).SequenceEqual("="u8), Is.True);
+ Assert.That(PrimitiveConstraintRequestOperatorProvider.ToUtf8Bytes(PrimitiveConstraintRequestOperator.greaterthan).SequenceEqual(">"u8), Is.True);
+ Assert.That(PrimitiveConstraintRequestOperatorProvider.ToUtf8Bytes(PrimitiveConstraintRequestOperator.greaterthanorequalto).SequenceEqual(">="u8), Is.True);
+ Assert.That(PrimitiveConstraintRequestOperatorProvider.ToUtf8Bytes(PrimitiveConstraintRequestOperator.@in).SequenceEqual("in"u8), Is.True);
+ Assert.That(PrimitiveConstraintRequestOperatorProvider.ToUtf8Bytes(PrimitiveConstraintRequestOperator.instanceOf).SequenceEqual("instanceOf"u8), Is.True);
+ Assert.That(() => PrimitiveConstraintRequestOperatorProvider.ToUtf8Bytes((PrimitiveConstraintRequestOperator)123456), Throws.TypeOf());
+ }
+ }
+ }
+}
diff --git a/SysML2.NET.Extensions/PSM/AutoGenEnumProvider/CompositeConstraintOperatorProvider.cs b/SysML2.NET.Extensions/PSM/AutoGenEnumProvider/CompositeConstraintOperatorProvider.cs
new file mode 100644
index 000000000..c51ad7763
--- /dev/null
+++ b/SysML2.NET.Extensions/PSM/AutoGenEnumProvider/CompositeConstraintOperatorProvider.cs
@@ -0,0 +1,151 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Extensions.PSM
+{
+ using System;
+ using System.Buffers;
+ using System.Text;
+
+ using SysML2.NET.PSM.Enumerations;
+
+ ///
+ /// The purpose of the is to convert a
+ /// to and from its representation in the Systems Modeling API and Services
+ ///
+ public static class CompositeConstraintOperatorProvider
+ {
+ ///
+ /// The length in bytes of the longest CompositeConstraintOperator representation
+ ///
+ private const int LongestValueByteLength = 3;
+
+ ///
+ /// Parses the to a
+ ///
+ /// The that is to be parsed.
+ /// A enumeration literal.
+ /// Thrown when the value denotes no literal.
+ public static CompositeConstraintOperator Parse(ReadOnlySpan value)
+ {
+ if (TryParse(value, out var result))
+ {
+ return result;
+ }
+
+ throw new ArgumentException($"'{new string(value)}' is not a valid CompositeConstraintOperator", nameof(value));
+ }
+
+ ///
+ /// Tries to parse the to a
+ ///
+ /// The that is to be parsed.
+ /// The parsed literal, or default when the value denotes none.
+ /// True when the value was parsed.
+ public static bool TryParse(ReadOnlySpan value, out CompositeConstraintOperator result)
+ {
+ if (value.Length == 3 && value.Equals("and".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = CompositeConstraintOperator.and;
+ return true;
+ }
+
+ if (value.Length == 2 && value.Equals("or".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = CompositeConstraintOperator.or;
+ return true;
+ }
+
+ result = default;
+ return false;
+ }
+
+ ///
+ /// Parses the UTF-8 encoded to a
+ ///
+ /// The that is to be parsed.
+ /// A enumeration literal.
+ /// Thrown when the value denotes no literal.
+ public static CompositeConstraintOperator Parse(ReadOnlySpan value)
+ {
+ if (value.Length <= LongestValueByteLength)
+ {
+ Span characters = stackalloc char[LongestValueByteLength];
+
+ var characterCount = Encoding.UTF8.GetChars(value, characters);
+
+ if (TryParse(characters[..characterCount], out var result))
+ {
+ return result;
+ }
+ }
+
+ throw new ArgumentException($"'{Encoding.UTF8.GetString(value)}' is not a valid CompositeConstraintOperator", nameof(value));
+ }
+
+ ///
+ /// Parses the UTF-8 encoded to a
+ ///
+ /// The that is to be parsed.
+ /// A enumeration literal.
+ /// Thrown when the value denotes no literal.
+ public static CompositeConstraintOperator Parse(in ReadOnlySequence value)
+ {
+ if (value.IsSingleSegment)
+ {
+ return Parse(value.FirstSpan);
+ }
+
+ if (value.Length > LongestValueByteLength)
+ {
+ throw new ArgumentException($"a CompositeConstraintOperator is at most {LongestValueByteLength} bytes long", nameof(value));
+ }
+
+ Span buffer = stackalloc byte[LongestValueByteLength];
+ value.CopyTo(buffer);
+
+ return Parse(buffer[..(int)value.Length]);
+ }
+
+ ///
+ /// Converts a to its UTF-8 encoded representation on the wire
+ ///
+ /// The that is to be converted.
+ /// A backed by static UTF-8 data.
+ /// Thrown when the literal is not known.
+ public static ReadOnlySpan ToUtf8Bytes(CompositeConstraintOperator value)
+ {
+ return value switch
+ {
+ CompositeConstraintOperator.and => "and"u8,
+ CompositeConstraintOperator.or => "or"u8,
+ _ => throw new ArgumentOutOfRangeException(nameof(value))
+ };
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Extensions/PSM/AutoGenEnumProvider/CompositeConstraintRequestOperatorProvider.cs b/SysML2.NET.Extensions/PSM/AutoGenEnumProvider/CompositeConstraintRequestOperatorProvider.cs
new file mode 100644
index 000000000..ec4259178
--- /dev/null
+++ b/SysML2.NET.Extensions/PSM/AutoGenEnumProvider/CompositeConstraintRequestOperatorProvider.cs
@@ -0,0 +1,151 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Extensions.PSM
+{
+ using System;
+ using System.Buffers;
+ using System.Text;
+
+ using SysML2.NET.PSM.Enumerations;
+
+ ///
+ /// The purpose of the is to convert a
+ /// to and from its representation in the Systems Modeling API and Services
+ ///
+ public static class CompositeConstraintRequestOperatorProvider
+ {
+ ///
+ /// The length in bytes of the longest CompositeConstraintRequestOperator representation
+ ///
+ private const int LongestValueByteLength = 3;
+
+ ///
+ /// Parses the to a
+ ///
+ /// The that is to be parsed.
+ /// A enumeration literal.
+ /// Thrown when the value denotes no literal.
+ public static CompositeConstraintRequestOperator Parse(ReadOnlySpan value)
+ {
+ if (TryParse(value, out var result))
+ {
+ return result;
+ }
+
+ throw new ArgumentException($"'{new string(value)}' is not a valid CompositeConstraintRequestOperator", nameof(value));
+ }
+
+ ///
+ /// Tries to parse the to a
+ ///
+ /// The that is to be parsed.
+ /// The parsed literal, or default when the value denotes none.
+ /// True when the value was parsed.
+ public static bool TryParse(ReadOnlySpan value, out CompositeConstraintRequestOperator result)
+ {
+ if (value.Length == 3 && value.Equals("and".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = CompositeConstraintRequestOperator.and;
+ return true;
+ }
+
+ if (value.Length == 2 && value.Equals("or".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = CompositeConstraintRequestOperator.or;
+ return true;
+ }
+
+ result = default;
+ return false;
+ }
+
+ ///
+ /// Parses the UTF-8 encoded to a
+ ///
+ /// The that is to be parsed.
+ /// A enumeration literal.
+ /// Thrown when the value denotes no literal.
+ public static CompositeConstraintRequestOperator Parse(ReadOnlySpan value)
+ {
+ if (value.Length <= LongestValueByteLength)
+ {
+ Span characters = stackalloc char[LongestValueByteLength];
+
+ var characterCount = Encoding.UTF8.GetChars(value, characters);
+
+ if (TryParse(characters[..characterCount], out var result))
+ {
+ return result;
+ }
+ }
+
+ throw new ArgumentException($"'{Encoding.UTF8.GetString(value)}' is not a valid CompositeConstraintRequestOperator", nameof(value));
+ }
+
+ ///
+ /// Parses the UTF-8 encoded to a
+ ///
+ /// The that is to be parsed.
+ /// A enumeration literal.
+ /// Thrown when the value denotes no literal.
+ public static CompositeConstraintRequestOperator Parse(in ReadOnlySequence value)
+ {
+ if (value.IsSingleSegment)
+ {
+ return Parse(value.FirstSpan);
+ }
+
+ if (value.Length > LongestValueByteLength)
+ {
+ throw new ArgumentException($"a CompositeConstraintRequestOperator is at most {LongestValueByteLength} bytes long", nameof(value));
+ }
+
+ Span buffer = stackalloc byte[LongestValueByteLength];
+ value.CopyTo(buffer);
+
+ return Parse(buffer[..(int)value.Length]);
+ }
+
+ ///
+ /// Converts a to its UTF-8 encoded representation on the wire
+ ///
+ /// The that is to be converted.
+ /// A backed by static UTF-8 data.
+ /// Thrown when the literal is not known.
+ public static ReadOnlySpan ToUtf8Bytes(CompositeConstraintRequestOperator value)
+ {
+ return value switch
+ {
+ CompositeConstraintRequestOperator.and => "and"u8,
+ CompositeConstraintRequestOperator.or => "or"u8,
+ _ => throw new ArgumentOutOfRangeException(nameof(value))
+ };
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Extensions/PSM/AutoGenEnumProvider/PrimitiveConstraintOperatorProvider.cs b/SysML2.NET.Extensions/PSM/AutoGenEnumProvider/PrimitiveConstraintOperatorProvider.cs
new file mode 100644
index 000000000..5aaecf3c1
--- /dev/null
+++ b/SysML2.NET.Extensions/PSM/AutoGenEnumProvider/PrimitiveConstraintOperatorProvider.cs
@@ -0,0 +1,186 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Extensions.PSM
+{
+ using System;
+ using System.Buffers;
+ using System.Text;
+
+ using SysML2.NET.PSM.Enumerations;
+
+ ///
+ /// The purpose of the is to convert a
+ /// to and from its representation in the Systems Modeling API and Services
+ ///
+ public static class PrimitiveConstraintOperatorProvider
+ {
+ ///
+ /// The length in bytes of the longest PrimitiveConstraintOperator representation
+ ///
+ private const int LongestValueByteLength = 10;
+
+ ///
+ /// Parses the to a
+ ///
+ /// The that is to be parsed.
+ /// A enumeration literal.
+ /// Thrown when the value denotes no literal.
+ public static PrimitiveConstraintOperator Parse(ReadOnlySpan value)
+ {
+ if (TryParse(value, out var result))
+ {
+ return result;
+ }
+
+ throw new ArgumentException($"'{new string(value)}' is not a valid PrimitiveConstraintOperator", nameof(value));
+ }
+
+ ///
+ /// Tries to parse the to a
+ ///
+ /// The that is to be parsed.
+ /// The parsed literal, or default when the value denotes none.
+ /// True when the value was parsed.
+ public static bool TryParse(ReadOnlySpan value, out PrimitiveConstraintOperator result)
+ {
+ if (value.Length == 1 && value.Equals("<".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = PrimitiveConstraintOperator.lessthan;
+ return true;
+ }
+
+ if (value.Length == 2 && value.Equals("<=".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = PrimitiveConstraintOperator.lessthanorequalto;
+ return true;
+ }
+
+ if (value.Length == 1 && value.Equals("=".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = PrimitiveConstraintOperator.equalto;
+ return true;
+ }
+
+ if (value.Length == 1 && value.Equals(">".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = PrimitiveConstraintOperator.greaterthan;
+ return true;
+ }
+
+ if (value.Length == 2 && value.Equals(">=".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = PrimitiveConstraintOperator.greaterthanorequalto;
+ return true;
+ }
+
+ if (value.Length == 2 && value.Equals("in".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = PrimitiveConstraintOperator.@in;
+ return true;
+ }
+
+ if (value.Length == 10 && value.Equals("instanceOf".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = PrimitiveConstraintOperator.instanceOf;
+ return true;
+ }
+
+ result = default;
+ return false;
+ }
+
+ ///
+ /// Parses the UTF-8 encoded to a
+ ///
+ /// The that is to be parsed.
+ /// A enumeration literal.
+ /// Thrown when the value denotes no literal.
+ public static PrimitiveConstraintOperator Parse(ReadOnlySpan value)
+ {
+ if (value.Length <= LongestValueByteLength)
+ {
+ Span characters = stackalloc char[LongestValueByteLength];
+
+ var characterCount = Encoding.UTF8.GetChars(value, characters);
+
+ if (TryParse(characters[..characterCount], out var result))
+ {
+ return result;
+ }
+ }
+
+ throw new ArgumentException($"'{Encoding.UTF8.GetString(value)}' is not a valid PrimitiveConstraintOperator", nameof(value));
+ }
+
+ ///
+ /// Parses the UTF-8 encoded to a
+ ///
+ /// The that is to be parsed.
+ /// A enumeration literal.
+ /// Thrown when the value denotes no literal.
+ public static PrimitiveConstraintOperator Parse(in ReadOnlySequence value)
+ {
+ if (value.IsSingleSegment)
+ {
+ return Parse(value.FirstSpan);
+ }
+
+ if (value.Length > LongestValueByteLength)
+ {
+ throw new ArgumentException($"a PrimitiveConstraintOperator is at most {LongestValueByteLength} bytes long", nameof(value));
+ }
+
+ Span buffer = stackalloc byte[LongestValueByteLength];
+ value.CopyTo(buffer);
+
+ return Parse(buffer[..(int)value.Length]);
+ }
+
+ ///
+ /// Converts a to its UTF-8 encoded representation on the wire
+ ///
+ /// The that is to be converted.
+ /// A backed by static UTF-8 data.
+ /// Thrown when the literal is not known.
+ public static ReadOnlySpan ToUtf8Bytes(PrimitiveConstraintOperator value)
+ {
+ return value switch
+ {
+ PrimitiveConstraintOperator.lessthan => "<"u8,
+ PrimitiveConstraintOperator.lessthanorequalto => "<="u8,
+ PrimitiveConstraintOperator.equalto => "="u8,
+ PrimitiveConstraintOperator.greaterthan => ">"u8,
+ PrimitiveConstraintOperator.greaterthanorequalto => ">="u8,
+ PrimitiveConstraintOperator.@in => "in"u8,
+ PrimitiveConstraintOperator.instanceOf => "instanceOf"u8,
+ _ => throw new ArgumentOutOfRangeException(nameof(value))
+ };
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Extensions/PSM/AutoGenEnumProvider/PrimitiveConstraintRequestOperatorProvider.cs b/SysML2.NET.Extensions/PSM/AutoGenEnumProvider/PrimitiveConstraintRequestOperatorProvider.cs
new file mode 100644
index 000000000..43daa6570
--- /dev/null
+++ b/SysML2.NET.Extensions/PSM/AutoGenEnumProvider/PrimitiveConstraintRequestOperatorProvider.cs
@@ -0,0 +1,186 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Extensions.PSM
+{
+ using System;
+ using System.Buffers;
+ using System.Text;
+
+ using SysML2.NET.PSM.Enumerations;
+
+ ///
+ /// The purpose of the is to convert a
+ /// to and from its representation in the Systems Modeling API and Services
+ ///
+ public static class PrimitiveConstraintRequestOperatorProvider
+ {
+ ///
+ /// The length in bytes of the longest PrimitiveConstraintRequestOperator representation
+ ///
+ private const int LongestValueByteLength = 10;
+
+ ///
+ /// Parses the to a
+ ///
+ /// The that is to be parsed.
+ /// A enumeration literal.
+ /// Thrown when the value denotes no literal.
+ public static PrimitiveConstraintRequestOperator Parse(ReadOnlySpan value)
+ {
+ if (TryParse(value, out var result))
+ {
+ return result;
+ }
+
+ throw new ArgumentException($"'{new string(value)}' is not a valid PrimitiveConstraintRequestOperator", nameof(value));
+ }
+
+ ///
+ /// Tries to parse the to a
+ ///
+ /// The that is to be parsed.
+ /// The parsed literal, or default when the value denotes none.
+ /// True when the value was parsed.
+ public static bool TryParse(ReadOnlySpan value, out PrimitiveConstraintRequestOperator result)
+ {
+ if (value.Length == 1 && value.Equals("<".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = PrimitiveConstraintRequestOperator.lessthan;
+ return true;
+ }
+
+ if (value.Length == 2 && value.Equals("<=".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = PrimitiveConstraintRequestOperator.lessthanorequalto;
+ return true;
+ }
+
+ if (value.Length == 1 && value.Equals("=".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = PrimitiveConstraintRequestOperator.equalto;
+ return true;
+ }
+
+ if (value.Length == 1 && value.Equals(">".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = PrimitiveConstraintRequestOperator.greaterthan;
+ return true;
+ }
+
+ if (value.Length == 2 && value.Equals(">=".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = PrimitiveConstraintRequestOperator.greaterthanorequalto;
+ return true;
+ }
+
+ if (value.Length == 2 && value.Equals("in".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = PrimitiveConstraintRequestOperator.@in;
+ return true;
+ }
+
+ if (value.Length == 10 && value.Equals("instanceOf".AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ result = PrimitiveConstraintRequestOperator.instanceOf;
+ return true;
+ }
+
+ result = default;
+ return false;
+ }
+
+ ///
+ /// Parses the UTF-8 encoded to a
+ ///
+ /// The that is to be parsed.
+ /// A enumeration literal.
+ /// Thrown when the value denotes no literal.
+ public static PrimitiveConstraintRequestOperator Parse(ReadOnlySpan value)
+ {
+ if (value.Length <= LongestValueByteLength)
+ {
+ Span characters = stackalloc char[LongestValueByteLength];
+
+ var characterCount = Encoding.UTF8.GetChars(value, characters);
+
+ if (TryParse(characters[..characterCount], out var result))
+ {
+ return result;
+ }
+ }
+
+ throw new ArgumentException($"'{Encoding.UTF8.GetString(value)}' is not a valid PrimitiveConstraintRequestOperator", nameof(value));
+ }
+
+ ///
+ /// Parses the UTF-8 encoded to a
+ ///
+ /// The that is to be parsed.
+ /// A enumeration literal.
+ /// Thrown when the value denotes no literal.
+ public static PrimitiveConstraintRequestOperator Parse(in ReadOnlySequence value)
+ {
+ if (value.IsSingleSegment)
+ {
+ return Parse(value.FirstSpan);
+ }
+
+ if (value.Length > LongestValueByteLength)
+ {
+ throw new ArgumentException($"a PrimitiveConstraintRequestOperator is at most {LongestValueByteLength} bytes long", nameof(value));
+ }
+
+ Span buffer = stackalloc byte[LongestValueByteLength];
+ value.CopyTo(buffer);
+
+ return Parse(buffer[..(int)value.Length]);
+ }
+
+ ///
+ /// Converts a to its UTF-8 encoded representation on the wire
+ ///
+ /// The that is to be converted.
+ /// A backed by static UTF-8 data.
+ /// Thrown when the literal is not known.
+ public static ReadOnlySpan ToUtf8Bytes(PrimitiveConstraintRequestOperator value)
+ {
+ return value switch
+ {
+ PrimitiveConstraintRequestOperator.lessthan => "<"u8,
+ PrimitiveConstraintRequestOperator.lessthanorequalto => "<="u8,
+ PrimitiveConstraintRequestOperator.equalto => "="u8,
+ PrimitiveConstraintRequestOperator.greaterthan => ">"u8,
+ PrimitiveConstraintRequestOperator.greaterthanorequalto => ">="u8,
+ PrimitiveConstraintRequestOperator.@in => "in"u8,
+ PrimitiveConstraintRequestOperator.instanceOf => "instanceOf"u8,
+ _ => throw new ArgumentOutOfRangeException(nameof(value))
+ };
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Extensions/SysML2.NET.Extensions.csproj b/SysML2.NET.Extensions/SysML2.NET.Extensions.csproj
index 3d7e000c9..795e36683 100644
--- a/SysML2.NET.Extensions/SysML2.NET.Extensions.csproj
+++ b/SysML2.NET.Extensions/SysML2.NET.Extensions.csproj
@@ -2,7 +2,7 @@
netstandard2.1;net10.0
- 12.0
+ 14.0
0.23.0
A .NET implementation of the OMG SysML v2 specification Extension and Helper methods.
SysML2.NET.Extensions
diff --git a/SysML2.NET.Kpar/Reader.cs b/SysML2.NET.Kpar/Reader.cs
index 4c7062953..75b71882f 100644
--- a/SysML2.NET.Kpar/Reader.cs
+++ b/SysML2.NET.Kpar/Reader.cs
@@ -1,4 +1,4 @@
-// -------------------------------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
//
//
// Copyright 2022-2026 Starion Group S.A.
@@ -136,7 +136,10 @@ public Archive Read(string filePath, ReadOptions options = null)
var sw = Stopwatch.StartNew();
- this.logger.LogDebug("starting to read kpar at {Path}", filePath);
+ if (this.logger.IsEnabled(LogLevel.Debug))
+ {
+ this.logger.LogDebug("starting to read kpar at {Path}", filePath);
+ }
options ??= new ReadOptions();
using var fileStream = File.OpenRead(filePath);
@@ -147,7 +150,10 @@ public Archive Read(string filePath, ReadOptions options = null)
this.Path = filePath;
- this.logger.LogDebug("kpar at {Path} read in {ElapsedMilliseconds} [ms]", filePath, sw.ElapsedMilliseconds);
+ if (this.logger.IsEnabled(LogLevel.Debug))
+ {
+ this.logger.LogDebug("kpar at {Path} read in {ElapsedMilliseconds} [ms]", filePath, sw.ElapsedMilliseconds);
+ }
return archive;
}
@@ -180,7 +186,10 @@ public Archive Read(Stream source, ReadOptions options = null)
using var zip = OpenZip(source);
var archive = ReadFromZip(zip, options);
- this.logger.LogDebug("kpar read in {ElapsedMilliseconds} [ms]", sw.ElapsedMilliseconds);
+ if (this.logger.IsEnabled(LogLevel.Debug))
+ {
+ this.logger.LogDebug("kpar read in {ElapsedMilliseconds} [ms]", sw.ElapsedMilliseconds);
+ }
return archive;
}
@@ -207,7 +216,10 @@ public async Task ReadAsync(string filePath, ReadOptions options = null
var sw = Stopwatch.StartNew();
- this.logger.LogDebug("starting to read kpar at {Path}", filePath);
+ if (this.logger.IsEnabled(LogLevel.Debug))
+ {
+ this.logger.LogDebug("starting to read kpar at {Path}", filePath);
+ }
options ??= new ReadOptions();
@@ -219,7 +231,10 @@ public async Task ReadAsync(string filePath, ReadOptions options = null
this.Path = filePath;
- this.logger.LogDebug("kpar at {Path} read in {ElapsedMilliseconds} [ms]", filePath, sw.ElapsedMilliseconds);
+ if (this.logger.IsEnabled(LogLevel.Debug))
+ {
+ this.logger.LogDebug("kpar at {Path} read in {ElapsedMilliseconds} [ms]", filePath, sw.ElapsedMilliseconds);
+ }
return archive;
}
@@ -256,7 +271,10 @@ public async Task ReadAsync(Stream source, ReadOptions options = null,
var archive = await ReadFromZipAsync(zip, options, cancellationToken).ConfigureAwait(false);
- this.logger.LogDebug("kpar read in {ElapsedMilliseconds} [ms]", sw.ElapsedMilliseconds);
+ if (this.logger.IsEnabled(LogLevel.Debug))
+ {
+ this.logger.LogDebug("kpar read in {ElapsedMilliseconds} [ms]", sw.ElapsedMilliseconds);
+ }
return archive;
}
diff --git a/SysML2.NET.Kpar/SysML2.NET.Kpar.csproj b/SysML2.NET.Kpar/SysML2.NET.Kpar.csproj
index d59910b82..a0cb04ad7 100644
--- a/SysML2.NET.Kpar/SysML2.NET.Kpar.csproj
+++ b/SysML2.NET.Kpar/SysML2.NET.Kpar.csproj
@@ -4,7 +4,7 @@
netstandard2.1;net10.0
- 12.0
+ 14.0
0.23.0
A .NET implementation of the OMG SysML v2 specification.
SysML2.NET.Kpar
diff --git a/SysML2.NET.Semantics/SysML2.NET.Semantics.csproj b/SysML2.NET.Semantics/SysML2.NET.Semantics.csproj
index ef27f4940..87744a011 100644
--- a/SysML2.NET.Semantics/SysML2.NET.Semantics.csproj
+++ b/SysML2.NET.Semantics/SysML2.NET.Semantics.csproj
@@ -2,7 +2,7 @@
netstandard2.1;net10.0
- 12.0
+ 14.0
disable
0.23.0
A .NET implementation of the OMG SysML v2 specification semantic constraints and implied Relationships.
diff --git a/SysML2.NET.Serializer.Json.Tests/PsmDeSerializerTestFixture.cs b/SysML2.NET.Serializer.Json.Tests/PsmDeSerializerTestFixture.cs
new file mode 100644
index 000000000..2b60f5c4f
--- /dev/null
+++ b/SysML2.NET.Serializer.Json.Tests/PsmDeSerializerTestFixture.cs
@@ -0,0 +1,495 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.Tests
+{
+ using System;
+ using System.Collections.Generic;
+ using System.IO;
+ using System.Linq;
+ using System.Text.Json;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ using NUnit.Framework;
+
+ using SysML2.NET.Core.Core.Types;
+ using SysML2.NET.Core.DTO.Core.Features;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+
+ [TestFixture]
+ public class PsmDeSerializerTestFixture
+ {
+ private static readonly Guid ProjectIdentifier = Guid.Parse("9b0e1914-3241-461e-b9ee-a3ff5120de4e");
+
+ private static readonly Guid BranchIdentifier = Guid.Parse("a910a705-7fbe-415f-9cbb-624bfadf6c20");
+
+ private static readonly Guid DataVersionIdentifier = Guid.Parse("94e5b40e-741e-49ca-bd7f-f3138c071bf9");
+
+ private static readonly Guid ElementIdentifier = Guid.Parse("00a6ef10-d3dc-4741-9029-2c9978c2f083");
+
+ private Serializer serializer;
+
+ private DeSerializer deSerializer;
+
+ private JsonWriterOptions jsonWriterOptions;
+
+ [SetUp]
+ public void SetUp()
+ {
+ this.serializer = new Serializer();
+ this.deSerializer = new DeSerializer();
+ this.jsonWriterOptions = new JsonWriterOptions { Indented = false };
+ }
+
+ [Test]
+ public void VerifyDeSerializeResponse()
+ {
+ var project = new Project
+ {
+ Id = ProjectIdentifier,
+ Alias = ["first", "second"],
+ Created = new DateTime(1976, 8, 20, 0, 0, 0, DateTimeKind.Utc),
+ DefaultBranch = BranchIdentifier,
+ Description = "the description",
+ Name = "the name"
+ };
+
+ using var stream = this.SerializeResponse(project);
+
+ var roundTripped = this.deSerializer.DeSerializeResponse(stream, SerializationModeKind.JSON, false);
+
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(roundTripped.Id, Is.EqualTo(ProjectIdentifier));
+ Assert.That(roundTripped.Alias, Is.EqualTo(new List { "first", "second" }));
+ Assert.That(roundTripped.Created, Is.EqualTo(project.Created));
+ Assert.That(roundTripped.DefaultBranch, Is.EqualTo(BranchIdentifier));
+ Assert.That(roundTripped.Description, Is.EqualTo("the description"));
+ Assert.That(roundTripped.Name, Is.EqualTo("the name"));
+ }
+
+ using var mismatched = this.SerializeRequest(new ProjectRequest { Name = "the name" });
+
+ Assert.That(() => this.deSerializer.DeSerializeResponse(mismatched, SerializationModeKind.JSON, false),
+ Throws.TypeOf());
+
+ using var notAnObject = ToStream("[]");
+
+ Assert.That(() => this.deSerializer.DeSerializeResponse(notAnObject, SerializationModeKind.JSON, false),
+ Throws.TypeOf());
+ }
+
+ [Test]
+ public void VerifyDeSerializeRequest()
+ {
+ var projectRequest = new ProjectRequest
+ {
+ Alias = ["only"],
+ DefaultBranch = BranchIdentifier,
+ Description = null,
+ Name = "the name"
+ };
+
+ using var stream = this.SerializeRequest(projectRequest);
+
+ var roundTripped = this.deSerializer.DeSerializeRequest(stream, SerializationModeKind.JSON, false);
+
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(roundTripped.Alias, Is.EqualTo(new List { "only" }));
+ Assert.That(roundTripped.DefaultBranch, Is.EqualTo(BranchIdentifier));
+ Assert.That(roundTripped.Description, Is.Null);
+ Assert.That(roundTripped.Name, Is.EqualTo("the name"));
+ }
+
+ using var withoutBranch = this.SerializeRequest(new ProjectRequest { Name = "no branch" });
+
+ var withoutBranchRoundTripped = this.deSerializer.DeSerializeRequest(withoutBranch, SerializationModeKind.JSON, false);
+
+ Assert.That(withoutBranchRoundTripped.DefaultBranch, Is.Null);
+
+ using var mismatched = this.SerializeRequest(projectRequest);
+
+ Assert.That(() => this.deSerializer.DeSerializeRequest(mismatched, SerializationModeKind.JSON, false),
+ Throws.TypeOf());
+ }
+
+ [Test]
+ public void VerifyDeSerializeConstraint()
+ {
+ var constraint = new PrimitiveConstraint
+ {
+ Inverse = true,
+ Operator = PrimitiveConstraintOperator.lessthan,
+ Property = "created",
+ Value =
+ [
+ ConstraintValue.From(true),
+ ConstraintValue.From(1.5),
+ ConstraintValue.From("text"),
+ ConstraintValue.From(ProjectIdentifier),
+ ConstraintValue.Null
+ ]
+ };
+
+ using var stream = this.SerializeResponse(constraint);
+
+ var roundTripped = this.deSerializer.DeSerializeResponse(stream, SerializationModeKind.JSON, false);
+
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(roundTripped.Inverse, Is.True);
+ Assert.That(roundTripped.Operator, Is.EqualTo(PrimitiveConstraintOperator.lessthan));
+ Assert.That(roundTripped.Property, Is.EqualTo("created"));
+ Assert.That(roundTripped.Value, Has.Count.EqualTo(5));
+ Assert.That(roundTripped.Value, Is.EqualTo(constraint.Value));
+ }
+
+ var composite = new CompositeConstraint
+ {
+ Operator = CompositeConstraintOperator.and,
+ Constraint = [constraint]
+ };
+
+ using var compositeStream = this.SerializeResponse(composite);
+
+ var compositeRoundTripped = this.deSerializer.DeSerializeResponse(compositeStream, SerializationModeKind.JSON, false);
+
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(compositeRoundTripped.Operator, Is.EqualTo(CompositeConstraintOperator.and));
+ Assert.That(compositeRoundTripped.Constraint, Has.Count.EqualTo(1));
+ Assert.That(compositeRoundTripped.Constraint[0], Is.TypeOf());
+ Assert.That(((PrimitiveConstraint)compositeRoundTripped.Constraint[0]).Operator, Is.EqualTo(PrimitiveConstraintOperator.lessthan));
+ }
+ }
+
+ [Test]
+ public void VerifyDeSerializeDataVersion()
+ {
+ var dataVersion = new DataVersion
+ {
+ Id = DataVersionIdentifier,
+ Identity = new DataIdentity { Id = ElementIdentifier, Name = "the identity" },
+ Payload = new Feature { Id = ElementIdentifier, ElementId = ElementIdentifier.ToString(), DeclaredName = "the feature" }
+ };
+
+ using var stream = this.SerializeResponse(dataVersion);
+
+ var roundTripped = this.deSerializer.DeSerializeResponse(stream, SerializationModeKind.JSON, false);
+
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(roundTripped.Id, Is.EqualTo(DataVersionIdentifier));
+ Assert.That(roundTripped.Identity.Name, Is.EqualTo("the identity"));
+ Assert.That(roundTripped.Payload, Is.TypeOf());
+ Assert.That(((Feature)roundTripped.Payload).Id, Is.EqualTo(ElementIdentifier));
+ Assert.That(((Feature)roundTripped.Payload).DeclaredName, Is.EqualTo("the feature"));
+ Assert.That(roundTripped.Payload, Is.EqualTo(dataVersion.Payload).UsingPropertiesComparer());
+ }
+
+ var withApiPayload = new DataVersion
+ {
+ Id = DataVersionIdentifier,
+ Payload = new ExternalData { Id = ElementIdentifier, ResourceIdentifier = new Uri("http://www.stariongroup.eu/external") }
+ };
+
+ using var apiStream = this.SerializeResponse(withApiPayload);
+
+ var apiRoundTripped = this.deSerializer.DeSerializeResponse(apiStream, SerializationModeKind.JSON, false);
+
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(apiRoundTripped.Payload, Is.TypeOf());
+ Assert.That(((ExternalData)apiRoundTripped.Payload).ResourceIdentifier, Is.EqualTo(new Uri("http://www.stariongroup.eu/external")));
+ Assert.That(apiRoundTripped.Identity, Is.Null);
+ Assert.That(apiRoundTripped.Payload, Is.EqualTo(withApiPayload.Payload).UsingPropertiesComparer());
+ }
+
+ using var withoutPayload = this.SerializeResponse(new DataVersion { Id = DataVersionIdentifier });
+
+ var withoutPayloadRoundTripped = this.deSerializer.DeSerializeResponse(withoutPayload, SerializationModeKind.JSON, false);
+
+ Assert.That(withoutPayloadRoundTripped.Payload, Is.Null);
+ }
+
+ [Test]
+ public void VerifyDeSerializeResponses()
+ {
+ var project = new Project { Id = ProjectIdentifier, Name = "the name" };
+ var branch = new Branch { Id = BranchIdentifier, Name = "the branch" };
+
+ using var stream = this.SerializeResponses([project, branch]);
+
+ var roundTripped = this.deSerializer.DeSerializeResponses(stream, SerializationModeKind.JSON, false).ToList();
+
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(roundTripped, Has.Count.EqualTo(2));
+ Assert.That(roundTripped[0], Is.TypeOf());
+ Assert.That(roundTripped[1], Is.TypeOf());
+ }
+
+ using var homogeneous = this.SerializeResponses([project]);
+
+ Assert.That(this.deSerializer.DeSerializeResponses(homogeneous, SerializationModeKind.JSON, false), Has.Count.EqualTo(1));
+
+ using var heterogeneous = this.SerializeResponses([project, branch]);
+
+ Assert.That(() => this.deSerializer.DeSerializeResponses(heterogeneous, SerializationModeKind.JSON, false),
+ Throws.TypeOf());
+ }
+
+ [Test]
+ public void VerifyDeSerializeRequests()
+ {
+ var projectRequest = new ProjectRequest { Name = "the name" };
+ var branchRequest = new BranchRequest { Name = "the branch" };
+
+ using var stream = this.SerializeRequests([projectRequest, branchRequest]);
+
+ var roundTripped = this.deSerializer.DeSerializeRequests(stream, SerializationModeKind.JSON, false).ToList();
+
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(roundTripped, Has.Count.EqualTo(2));
+ Assert.That(roundTripped[0], Is.TypeOf());
+ Assert.That(roundTripped[1], Is.TypeOf());
+ }
+
+ using var heterogeneous = this.SerializeRequests([projectRequest, branchRequest]);
+
+ Assert.That(() => this.deSerializer.DeSerializeRequests(heterogeneous, SerializationModeKind.JSON, false),
+ Throws.TypeOf());
+ }
+
+ [Test]
+ public async Task VerifyDeSerializeResponseAsync()
+ {
+ var project = new Project { Id = ProjectIdentifier, Name = "the name" };
+
+ using var stream = this.SerializeResponse(project);
+
+ var roundTripped = await this.deSerializer.DeSerializeResponseAsync(stream, SerializationModeKind.JSON, false, CancellationToken.None);
+
+ Assert.That(roundTripped.Id, Is.EqualTo(ProjectIdentifier));
+
+ using var collection = this.SerializeResponses([project]);
+
+ var responses = await this.deSerializer.DeSerializeResponsesAsync(collection, SerializationModeKind.JSON, false, CancellationToken.None);
+
+ Assert.That(responses, Has.Count.EqualTo(1));
+
+ using var mismatched = this.SerializeResponse(project);
+
+ await Assert.ThatAsync(() => this.deSerializer.DeSerializeResponseAsync(mismatched, SerializationModeKind.JSON, false, CancellationToken.None),
+ Throws.TypeOf());
+ }
+
+ [Test]
+ public async Task VerifyDeSerializeRequestAsync()
+ {
+ var projectRequest = new ProjectRequest { Name = "the name" };
+
+ using var stream = this.SerializeRequest(projectRequest);
+
+ var roundTripped = await this.deSerializer.DeSerializeRequestAsync(stream, SerializationModeKind.JSON, false, CancellationToken.None);
+
+ Assert.That(roundTripped.Name, Is.EqualTo("the name"));
+
+ using var collection = this.SerializeRequests([projectRequest]);
+
+ var requests = await this.deSerializer.DeSerializeRequestsAsync(collection, SerializationModeKind.JSON, false, CancellationToken.None);
+
+ Assert.That(requests, Has.Count.EqualTo(1));
+
+ using var mismatched = this.SerializeRequest(projectRequest);
+
+ await Assert.ThatAsync(() => this.deSerializer.DeSerializeRequestAsync(mismatched, SerializationModeKind.JSON, false, CancellationToken.None),
+ Throws.TypeOf());
+ }
+
+ [Test]
+ public void VerifyRoundTrip()
+ {
+ var dataVersion = new DataVersion
+ {
+ Id = DataVersionIdentifier,
+ Alias = ["first", "second"],
+ Description = "the description",
+ Name = "the name",
+ Identity = new DataIdentity { Id = ElementIdentifier, Alias = ["identity alias"], Name = "the identity" },
+ Payload = CreateCoreFeature()
+ };
+
+ var project = new Project
+ {
+ Id = ProjectIdentifier,
+ Alias = ["alias"],
+ Created = new DateTime(1976, 8, 20, 13, 45, 56, DateTimeKind.Utc),
+ DefaultBranch = BranchIdentifier,
+ Description = "the project",
+ Name = "the project name"
+ };
+
+ var constraint = new PrimitiveConstraint
+ {
+ Inverse = true,
+ Operator = PrimitiveConstraintOperator.lessthanorequalto,
+ Property = "created",
+ Value =
+ [
+ ConstraintValue.From(true),
+ ConstraintValue.From(1.5),
+ ConstraintValue.From("text"),
+ ConstraintValue.From(ProjectIdentifier),
+ ConstraintValue.Null
+ ]
+ };
+
+ var roundTrippedDataVersion = this.RoundTripResponse(dataVersion);
+
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(roundTrippedDataVersion, Is.EqualTo(dataVersion).UsingPropertiesComparer());
+ Assert.That(this.RoundTripResponse(project), Is.EqualTo(project).UsingPropertiesComparer());
+ Assert.That(this.RoundTripResponse(constraint), Is.EqualTo(constraint).UsingPropertiesComparer());
+
+ Assert.That(roundTrippedDataVersion.Payload, Is.TypeOf());
+ Assert.That(roundTrippedDataVersion.Payload, Is.EqualTo(dataVersion.Payload).UsingPropertiesComparer());
+ Assert.That(roundTrippedDataVersion.Identity, Is.EqualTo(dataVersion.Identity).UsingPropertiesComparer());
+ }
+
+ var divergentPayload = this.RoundTripResponse(dataVersion);
+ ((Feature)divergentPayload.Payload).DeclaredName = "a different name";
+
+ var divergentIdentity = this.RoundTripResponse(dataVersion);
+ divergentIdentity.Identity.Alias.Add("an extra alias");
+
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(divergentPayload, Is.Not.EqualTo(dataVersion).UsingPropertiesComparer());
+ Assert.That(divergentIdentity, Is.Not.EqualTo(dataVersion).UsingPropertiesComparer());
+ }
+
+ List responses = [project, dataVersion, constraint];
+
+ using var collectionStream = this.SerializeResponses(responses);
+
+ var roundTrippedCollection = this.deSerializer.DeSerializeResponses(collectionStream, SerializationModeKind.JSON, false).ToList();
+
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(roundTrippedCollection, Has.Count.EqualTo(3));
+ Assert.That(roundTrippedCollection, Is.EqualTo(responses).UsingPropertiesComparer());
+ }
+
+ var dataVersionRequest = new DataVersionRequest
+ {
+ Identity = new DataIdentityRequest { Alias = ["identity alias"], Name = "the identity" },
+ Payload = CreateCoreFeature()
+ };
+
+ using var requestStream = this.SerializeRequest(dataVersionRequest);
+
+ var roundTrippedRequest = this.deSerializer.DeSerializeRequest(requestStream, SerializationModeKind.JSON, false);
+
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(roundTrippedRequest.Payload, Is.TypeOf());
+ Assert.That(roundTrippedRequest, Is.EqualTo(dataVersionRequest).UsingPropertiesComparer());
+ Assert.That(roundTrippedRequest.Payload, Is.EqualTo(dataVersionRequest.Payload).UsingPropertiesComparer());
+ Assert.That(roundTrippedRequest.Identity, Is.EqualTo(dataVersionRequest.Identity).UsingPropertiesComparer());
+ }
+ }
+
+ private static Feature CreateCoreFeature()
+ {
+ return new Feature
+ {
+ Id = ElementIdentifier,
+ AliasIds = ["core alias"],
+ DeclaredName = "the feature",
+ DeclaredShortName = "f",
+ Direction = FeatureDirectionKind.Inout,
+ ElementId = ElementIdentifier.ToString(),
+ IsAbstract = true,
+ IsUnique = false,
+ OwnedRelationship = [BranchIdentifier],
+ OwningRelationship = ProjectIdentifier
+ };
+ }
+
+ private T RoundTripResponse(T response) where T : IResponse
+ {
+ using var stream = this.SerializeResponse(response);
+
+ return this.deSerializer.DeSerializeResponse(stream, SerializationModeKind.JSON, false);
+ }
+
+ private MemoryStream SerializeResponse(IResponse response)
+ {
+ var stream = new MemoryStream();
+
+ this.serializer.SerializeResponse(response, SerializationModeKind.JSON, false, stream, this.jsonWriterOptions);
+ stream.Position = 0;
+
+ return stream;
+ }
+
+ private MemoryStream SerializeResponses(IEnumerable responses)
+ {
+ var stream = new MemoryStream();
+
+ this.serializer.SerializeResponse(responses, SerializationModeKind.JSON, false, stream, this.jsonWriterOptions);
+ stream.Position = 0;
+
+ return stream;
+ }
+
+ private MemoryStream SerializeRequest(IRequest request)
+ {
+ var stream = new MemoryStream();
+
+ this.serializer.SerializeRequest(request, SerializationModeKind.JSON, false, stream, this.jsonWriterOptions);
+ stream.Position = 0;
+
+ return stream;
+ }
+
+ private MemoryStream SerializeRequests(IEnumerable requests)
+ {
+ var stream = new MemoryStream();
+
+ this.serializer.SerializeRequest(requests, SerializationModeKind.JSON, false, stream, this.jsonWriterOptions);
+ stream.Position = 0;
+
+ return stream;
+ }
+
+ private static MemoryStream ToStream(string json)
+ {
+ return new MemoryStream(System.Text.Encoding.UTF8.GetBytes(json));
+ }
+ }
+}
diff --git a/SysML2.NET.Serializer.Json/DeSerializer.cs b/SysML2.NET.Serializer.Json/DeSerializer.cs
index 581bb8b09..45056f4a0 100644
--- a/SysML2.NET.Serializer.Json/DeSerializer.cs
+++ b/SysML2.NET.Serializer.Json/DeSerializer.cs
@@ -34,8 +34,11 @@ namespace SysML2.NET.Serializer.Json
using Microsoft.Extensions.Logging.Abstractions;
using SysML2.NET.Common;
+ using SysML2.NET.PSM.DTO;
using SysML2.NET.Serializer.Json.Core.DTO;
using SysML2.NET.Serializer.Json.PIM.DTO;
+ using SysML2.NET.Serializer.Json.PSM;
+ using SysML2.NET.Serializer.Json.Utility;
///
/// The purpose of the is to deserialize a JSON to
@@ -107,7 +110,10 @@ public IEnumerable DeSerialize(Stream stream, SerializationModeKind
{
var result = this.DeSerializeUtf8Json(buffer, length, serializationModeKind, serializationTargetKind, deserializeDerivedProperties);
- this.logger.LogInformation("stream deserialized in {ElapsedTime} [ms]", sw.ElapsedMilliseconds);
+ if (this.logger.IsEnabled(LogLevel.Information))
+ {
+ this.logger.LogInformation("stream deserialized in {ElapsedTime} [ms]", sw.ElapsedMilliseconds);
+ }
return result;
}
@@ -146,7 +152,10 @@ public async Task> DeSerializeAsync(Stream stream, Seri
{
var result = this.DeSerializeUtf8Json(buffer, length, serializationModeKind, serializationTargetKind, deserializeDerivedProperties);
- this.logger.LogInformation("stream deserialized asynchronously in {ElapsedMilliseconds} [ms]", sw.ElapsedMilliseconds);
+ if (this.logger.IsEnabled(LogLevel.Information))
+ {
+ this.logger.LogInformation("stream deserialized asynchronously in {ElapsedMilliseconds} [ms]", sw.ElapsedMilliseconds);
+ }
return result;
}
@@ -156,6 +165,271 @@ public async Task> DeSerializeAsync(Stream stream, Seri
}
}
+ ///
+ /// Deserializes the JSON stream to a single request
+ ///
+ /// The expected type.
+ /// the JSON input stream
+ /// The to use
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ /// an instance of
+ public T DeSerializeRequest(Stream stream, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties) where T : IRequest
+ {
+ return ReadPooled(stream, (byte[] buffer, int length) => this.ReadSingle(buffer, length, serializationModeKind, deserializeDerivedProperties, true));
+ }
+
+ ///
+ /// Deserializes the JSON stream to a collection of requests
+ ///
+ /// The expected type.
+ /// the JSON input stream
+ /// The to use
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ /// an
+ public IEnumerable DeSerializeRequests(Stream stream, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties) where T : IRequest
+ {
+ return ReadPooled(stream, (byte[] buffer, int length) => this.ReadMany(buffer, length, serializationModeKind, deserializeDerivedProperties, true));
+ }
+
+ ///
+ /// Deserializes the JSON stream to a single response
+ ///
+ /// The expected type.
+ /// the JSON input stream
+ /// The to use
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ /// an instance of
+ public T DeSerializeResponse(Stream stream, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties) where T : IResponse
+ {
+ return ReadPooled(stream, (byte[] buffer, int length) => this.ReadSingle(buffer, length, serializationModeKind, deserializeDerivedProperties, false));
+ }
+
+ ///
+ /// Deserializes the JSON stream to a collection of responses
+ ///
+ /// The expected type.
+ /// the JSON input stream
+ /// The to use
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ /// an
+ public IEnumerable DeSerializeResponses(Stream stream, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties) where T : IResponse
+ {
+ return ReadPooled(stream, (byte[] buffer, int length) => this.ReadMany(buffer, length, serializationModeKind, deserializeDerivedProperties, false));
+ }
+
+ ///
+ /// Asynchronously deserializes the JSON stream to a single request
+ ///
+ /// The expected type.
+ /// the JSON input stream
+ /// The to use
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ /// The used to cancel the operation
+ /// an instance of
+ public Task DeSerializeRequestAsync(Stream stream, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, CancellationToken cancellationToken) where T : IRequest
+ {
+ return ReadPooledAsync(stream, (byte[] buffer, int length) => this.ReadSingle(buffer, length, serializationModeKind, deserializeDerivedProperties, true), cancellationToken);
+ }
+
+ ///
+ /// Asynchronously deserializes the JSON stream to a collection of requests
+ ///
+ /// The expected type.
+ /// the JSON input stream
+ /// The to use
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ /// The used to cancel the operation
+ /// an
+ public async Task> DeSerializeRequestsAsync(Stream stream, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, CancellationToken cancellationToken) where T : IRequest
+ {
+ return await ReadPooledAsync(stream, (byte[] buffer, int length) => this.ReadMany(buffer, length, serializationModeKind, deserializeDerivedProperties, true), cancellationToken);
+ }
+
+ ///
+ /// Asynchronously deserializes the JSON stream to a single response
+ ///
+ /// The expected type.
+ /// the JSON input stream
+ /// The to use
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ /// The used to cancel the operation
+ /// an instance of
+ public Task DeSerializeResponseAsync(Stream stream, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, CancellationToken cancellationToken) where T : IResponse
+ {
+ return ReadPooledAsync(stream, (byte[] buffer, int length) => this.ReadSingle(buffer, length, serializationModeKind, deserializeDerivedProperties, false), cancellationToken);
+ }
+
+ ///
+ /// Asynchronously deserializes the JSON stream to a collection of responses
+ ///
+ /// The expected type.
+ /// the JSON input stream
+ /// The to use
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ /// The used to cancel the operation
+ /// an
+ public async Task> DeSerializeResponsesAsync(Stream stream, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, CancellationToken cancellationToken) where T : IResponse
+ {
+ return await ReadPooledAsync(stream, (byte[] buffer, int length) => this.ReadMany(buffer, length, serializationModeKind, deserializeDerivedProperties, false), cancellationToken);
+ }
+
+ ///
+ /// Reads a single Systems Modeling API and Services object from the UTF-8 encoded JSON payload
+ ///
+ /// The expected type.
+ /// the buffer that contains the UTF-8 encoded JSON payload
+ /// the number of bytes of that make up the payload
+ /// The to use
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ /// Asserts that the payload is resolved against the request family
+ /// an instance of
+ /// Thrown when the payload is not a single object of the expected type
+ private T ReadSingle(byte[] utf8Json, int length, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, bool isRequestFamily)
+ {
+ var reader = CreateReader(utf8Json, length);
+
+ if (reader.TokenType != JsonTokenType.StartObject)
+ {
+ throw new JsonException($"Expected a single JSON object, got {reader.TokenType}.");
+ }
+
+ var result = this.ReadFamilyObject(ref reader, serializationModeKind, deserializeDerivedProperties, isRequestFamily);
+
+ if (reader.Read())
+ {
+ throw new JsonException("Additional text encountered after the top level JSON value.");
+ }
+
+ return result;
+ }
+
+ ///
+ /// Reads a collection of Systems Modeling API and Services objects from the UTF-8 encoded JSON payload
+ ///
+ /// The expected type.
+ /// the buffer that contains the UTF-8 encoded JSON payload
+ /// the number of bytes of that make up the payload
+ /// The to use
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ /// Asserts that the payload is resolved against the request family
+ /// an
+ /// Thrown when the payload is neither an object nor an array
+ private List ReadMany(byte[] utf8Json, int length, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, bool isRequestFamily)
+ {
+ var reader = CreateReader(utf8Json, length);
+
+ var result = new List();
+
+ switch (reader.TokenType)
+ {
+ case JsonTokenType.StartObject:
+ result.Add(this.ReadFamilyObject(ref reader, serializationModeKind, deserializeDerivedProperties, isRequestFamily));
+ break;
+
+ case JsonTokenType.StartArray:
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ result.Add(this.ReadFamilyObject(ref reader, serializationModeKind, deserializeDerivedProperties, isRequestFamily));
+ }
+
+ break;
+
+ default:
+ throw new JsonException($"Expected a JSON object or array, got {reader.TokenType}.");
+ }
+
+ return reader.Read() ? throw new JsonException("Additional text encountered after the top level JSON value.") : result;
+ }
+
+ ///
+ /// Reads the json object that the reader is positioned on and asserts that it is a
+ ///
+ /// The expected type.
+ /// The positioned on the
+ /// The to use
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ /// Asserts that the payload is resolved against the request family
+ /// an instance of
+ /// Thrown when the resolved object is not a
+ private T ReadFamilyObject(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, bool isRequestFamily)
+ {
+ object resolved = isRequestFamily
+ ? PsmDeSerializationDispatcher.ReadRequest(ref reader, serializationModeKind, deserializeDerivedProperties, this.loggerFactory)
+ : PsmDeSerializationDispatcher.ReadResponse(ref reader, serializationModeKind, deserializeDerivedProperties, this.loggerFactory);
+
+ if (resolved is not T expected)
+ {
+ throw new JsonException($"Expected a {typeof(T).Name}, the payload declares a {resolved.GetType().Name}.");
+ }
+
+ return expected;
+ }
+
+ ///
+ /// Creates a over the payload and advances it to the first token
+ ///
+ /// the buffer that contains the UTF-8 encoded JSON payload
+ /// the number of bytes of that make up the payload
+ /// a positioned on the first token
+ /// Thrown when the payload contains no token
+ private static Utf8JsonReader CreateReader(byte[] utf8Json, int length)
+ {
+ var offset = HasUtf8ByteOrderMark(utf8Json, length) ? 3 : 0;
+
+ var reader = new Utf8JsonReader(new ReadOnlySpan(utf8Json, offset, length - offset));
+
+ if (!reader.Read())
+ {
+ throw new JsonException("The input does not contain any JSON tokens.");
+ }
+
+ return reader;
+ }
+
+ ///
+ /// Reads the stream into a pooled buffer, applies the read function and returns the buffer to the pool
+ ///
+ /// The type that the read function returns.
+ /// the JSON input stream
+ /// the function that reads the payload
+ /// the result of the read function
+ private static TResult ReadPooled(Stream stream, Func read)
+ {
+ var buffer = ReadToPooledBuffer(stream, out var length);
+
+ try
+ {
+ return read(buffer, length);
+ }
+ finally
+ {
+ ArrayPool.Shared.Return(buffer);
+ }
+ }
+
+ ///
+ /// Asynchronously reads the stream into a pooled buffer, applies the read function and returns the buffer
+ ///
+ /// The type that the read function returns.
+ /// the JSON input stream
+ /// the function that reads the payload
+ /// The used to cancel the operation
+ /// the result of the read function
+ private static async Task ReadPooledAsync(Stream stream, Func read, CancellationToken cancellationToken)
+ {
+ var (buffer, length) = await ReadToPooledBufferAsync(stream, cancellationToken);
+
+ try
+ {
+ return read(buffer, length);
+ }
+ finally
+ {
+ ArrayPool.Shared.Return(buffer);
+ }
+ }
+
///
/// Deserializes the UTF-8 encoded JSON payload to a
///
@@ -182,17 +456,10 @@ public async Task> DeSerializeAsync(Stream stream, Seri
///
private List DeSerializeUtf8Json(byte[] utf8Json, int length, SerializationModeKind serializationModeKind, SerializationTargetKind serializationTargetKind, bool deserializeDerivedProperties)
{
- var offset = HasUtf8ByteOrderMark(utf8Json, length) ? 3 : 0;
-
- var reader = new Utf8JsonReader(new ReadOnlySpan(utf8Json, offset, length - offset));
+ var reader = CreateReader(utf8Json, length);
var result = new List();
- if (!reader.Read())
- {
- throw new JsonException("The input does not contain any JSON tokens.");
- }
-
switch (reader.TokenType)
{
case JsonTokenType.StartObject:
@@ -244,7 +511,7 @@ private IIdentified DeserializeObject(ref Utf8JsonReader reader, SerializationMo
throw new ArgumentException($"The {nameof(reader)} must be positioned on a JsonTokenType.StartObject", nameof(reader));
}
- if (!TryPeekTypeName(reader, out var typeName))
+ if (!Utf8JsonReaderHelper.TryPeekTypeName(reader, out var typeName))
{
throw new SerializationException("The @type Json property is not available, the DeSerializer cannot be used to deserialize this JsonElement");
}
@@ -261,60 +528,6 @@ private IIdentified DeserializeObject(ref Utf8JsonReader reader, SerializationMo
return func(ref reader, serializationModeKind, deserializeDerivedProperties, this.loggerFactory);
}
- ///
- /// Reads ahead for the @type discriminator of the json object that the reader is positioned on
- ///
- ///
- /// A copy of the , positioned on the
- /// of the json object
- ///
- ///
- /// The value of the @type property, which is null when the property is present but null
- ///
- ///
- /// true when the object carries a @type property, false otherwise
- ///
- ///
- /// Thrown when the @type property is neither a string nor null
- ///
- ///
- /// The reader is taken by value on purpose: is a struct, so the copy is a
- /// free snapshot and the caller's reader stays parked on the .
- /// The SysML v2 API does not guarantee that @type comes first — it is the first property of the
- /// elements payload but the second of the projects payload — so the scan has to tolerate any position.
- ///
- private static bool TryPeekTypeName(Utf8JsonReader reader, out string typeName)
- {
- typeName = null;
-
- while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
- {
- if (reader.ValueTextEquals("@type"u8))
- {
- reader.Read();
-
- if (reader.TokenType == JsonTokenType.Null)
- {
- return true;
- }
-
- if (reader.TokenType != JsonTokenType.String)
- {
- throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{reader.TokenType}'.");
- }
-
- typeName = reader.GetString();
-
- return true;
- }
-
- reader.Read();
- reader.Skip();
- }
-
- return false;
- }
-
///
/// Reads the complete into a buffer rented from the
///
diff --git a/SysML2.NET.Serializer.Json/IDeSerializer.cs b/SysML2.NET.Serializer.Json/IDeSerializer.cs
index 7d1bfaa84..820cea3a1 100644
--- a/SysML2.NET.Serializer.Json/IDeSerializer.cs
+++ b/SysML2.NET.Serializer.Json/IDeSerializer.cs
@@ -26,6 +26,7 @@ namespace SysML2.NET.Serializer.Json
using System.Threading.Tasks;
using SysML2.NET.Common;
+ using SysML2.NET.PSM.DTO;
///
/// The purpose of the is to deserialize a JSON to
@@ -71,5 +72,89 @@ public interface IDeSerializer
/// an
///
Task> DeSerializeAsync(Stream stream, SerializationModeKind serializationModeKind, SerializationTargetKind serializationTargetKind, bool deserializeDerivedProperties, CancellationToken cancellationToken);
+
+ ///
+ /// Deserializes the JSON stream to a single request
+ ///
+ /// The expected type.
+ /// the JSON input stream
+ /// The to use
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ /// an instance of
+ T DeSerializeRequest(Stream stream, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties) where T : IRequest;
+
+ ///
+ /// Deserializes the JSON stream to a collection of requests
+ ///
+ /// The expected type.
+ /// the JSON input stream
+ /// The to use
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ /// an
+ IEnumerable DeSerializeRequests(Stream stream, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties) where T : IRequest;
+
+ ///
+ /// Deserializes the JSON stream to a single response
+ ///
+ /// The expected type.
+ /// the JSON input stream
+ /// The to use
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ /// an instance of
+ T DeSerializeResponse(Stream stream, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties) where T : IResponse;
+
+ ///
+ /// Deserializes the JSON stream to a collection of responses
+ ///
+ /// The expected type.
+ /// the JSON input stream
+ /// The to use
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ /// an
+ IEnumerable DeSerializeResponses(Stream stream, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties) where T : IResponse;
+
+ ///
+ /// Asynchronously deserializes the JSON stream to a single request
+ ///
+ /// The expected type.
+ /// the JSON input stream
+ /// The to use
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ /// The used to cancel the operation
+ /// an instance of
+ Task DeSerializeRequestAsync(Stream stream, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, CancellationToken cancellationToken) where T : IRequest;
+
+ ///
+ /// Asynchronously deserializes the JSON stream to a collection of requests
+ ///
+ /// The expected type.
+ /// the JSON input stream
+ /// The to use
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ /// The used to cancel the operation
+ /// an
+ Task> DeSerializeRequestsAsync(Stream stream, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, CancellationToken cancellationToken) where T : IRequest;
+
+ ///
+ /// Asynchronously deserializes the JSON stream to a single response
+ ///
+ /// The expected type.
+ /// the JSON input stream
+ /// The to use
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ /// The used to cancel the operation
+ /// an instance of
+ Task DeSerializeResponseAsync(Stream stream, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, CancellationToken cancellationToken) where T : IResponse;
+
+ ///
+ /// Asynchronously deserializes the JSON stream to a collection of responses
+ ///
+ /// The expected type.
+ /// the JSON input stream
+ /// The to use
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ /// The used to cancel the operation
+ /// an
+ Task> DeSerializeResponsesAsync(Stream stream, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, CancellationToken cancellationToken) where T : IResponse;
}
}
diff --git a/SysML2.NET.Serializer.Json/ModelInterchange/InterchangeChecksumDeserializer.cs b/SysML2.NET.Serializer.Json/ModelInterchange/InterchangeChecksumDeserializer.cs
index f6e29fa48..c08b0ec80 100644
--- a/SysML2.NET.Serializer.Json/ModelInterchange/InterchangeChecksumDeserializer.cs
+++ b/SysML2.NET.Serializer.Json/ModelInterchange/InterchangeChecksumDeserializer.cs
@@ -1,4 +1,4 @@
-// -------------------------------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
//
//
// Copyright 2022-2026 Starion Group S.A.
@@ -125,7 +125,10 @@ public static InterchangeChecksum DeSerialize(ref Utf8JsonReader reader, ILogger
reader.Read();
Utf8JsonReaderHelper.SkipValue(ref reader);
- logger.LogDebug("The property {Property} is unknown and skipped", propertyName);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("The property {Property} is unknown and skipped", propertyName);
+ }
}
return checksum;
diff --git a/SysML2.NET.Serializer.Json/ModelInterchange/InterchangeProjectDeSerializer.cs b/SysML2.NET.Serializer.Json/ModelInterchange/InterchangeProjectDeSerializer.cs
index e44eff335..5febde213 100644
--- a/SysML2.NET.Serializer.Json/ModelInterchange/InterchangeProjectDeSerializer.cs
+++ b/SysML2.NET.Serializer.Json/ModelInterchange/InterchangeProjectDeSerializer.cs
@@ -1,4 +1,4 @@
-// -------------------------------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
//
//
// Copyright 2022-2026 Starion Group S.A.
@@ -224,7 +224,10 @@ public static InterchangeProject DeSerialize(ref Utf8JsonReader reader, ILoggerF
reader.Read();
Utf8JsonReaderHelper.SkipValue(ref reader);
- logger.LogDebug("The property {Property} is unknown and skipped", reader.GetString());
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("The property {Property} is unknown and skipped", reader.GetString());
+ }
}
return project;
diff --git a/SysML2.NET.Serializer.Json/ModelInterchange/InterchangeProjectMetadataDeSerializer.cs b/SysML2.NET.Serializer.Json/ModelInterchange/InterchangeProjectMetadataDeSerializer.cs
index 4f9c89ebd..9ce6fc7a2 100644
--- a/SysML2.NET.Serializer.Json/ModelInterchange/InterchangeProjectMetadataDeSerializer.cs
+++ b/SysML2.NET.Serializer.Json/ModelInterchange/InterchangeProjectMetadataDeSerializer.cs
@@ -1,4 +1,4 @@
-// -------------------------------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
//
//
// Copyright 2022-2026 Starion Group S.A.
@@ -248,7 +248,10 @@ public static InterchangeProjectMetadata DeSerialize(ref Utf8JsonReader reader,
reader.Read();
Utf8JsonReaderHelper.SkipValue(ref reader);
- logger.LogDebug("The property {Property} is unknown and skipped", propertyName);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("The property {Property} is unknown and skipped", propertyName);
+ }
}
return metadata;
diff --git a/SysML2.NET.Serializer.Json/ModelInterchange/InterchangeProjectUsageDeSerializer.cs b/SysML2.NET.Serializer.Json/ModelInterchange/InterchangeProjectUsageDeSerializer.cs
index 594a77d40..7306238a5 100644
--- a/SysML2.NET.Serializer.Json/ModelInterchange/InterchangeProjectUsageDeSerializer.cs
+++ b/SysML2.NET.Serializer.Json/ModelInterchange/InterchangeProjectUsageDeSerializer.cs
@@ -1,4 +1,4 @@
-// -------------------------------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
//
//
// Copyright 2022-2026 Starion Group S.A.
@@ -100,7 +100,10 @@ public static InterchangeProjectUsage DeSerialize(ref Utf8JsonReader reader, ILo
reader.Read();
Utf8JsonReaderHelper.SkipValue(ref reader);
- logger.LogDebug("The property {Property} is unknown and skipped", reader.GetString());
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("The property {Property} is unknown and skipped", reader.GetString());
+ }
}
return usage;
diff --git a/SysML2.NET.Serializer.Json/PIM/BranchDeserializer.cs b/SysML2.NET.Serializer.Json/PIM/BranchDeserializer.cs
index dca38e326..0cb60749b 100644
--- a/SysML2.NET.Serializer.Json/PIM/BranchDeserializer.cs
+++ b/SysML2.NET.Serializer.Json/PIM/BranchDeserializer.cs
@@ -89,7 +89,10 @@ internal static Branch DeSerialize(JsonElement jsonElement, SerializationModeKin
}
else
{
- logger.LogDebug("the alias Json property was not found in the Branch: {Identifier}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the alias Json property was not found in the Branch: {Identifier}", dtoInstance.Id);
+ }
}
if (jsonElement.TryGetProperty("created"u8, out JsonElement createdProperty))
@@ -98,7 +101,10 @@ internal static Branch DeSerialize(JsonElement jsonElement, SerializationModeKin
}
else
{
- logger.LogDebug("the created Json property was not found in the Branch: {Identifier}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the created Json property was not found in the Branch: {Identifier}", dtoInstance.Id);
+ }
}
if (jsonElement.TryGetProperty("description"u8, out JsonElement descriptionProperty))
@@ -111,14 +117,20 @@ internal static Branch DeSerialize(JsonElement jsonElement, SerializationModeKin
}
else
{
- logger.LogDebug("the name Json property was not found in the Branch: {Identifier}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the name Json property was not found in the Branch: {Identifier}", dtoInstance.Id);
+ }
}
if (jsonElement.TryGetProperty("head"u8, out JsonElement headProperty))
{
if (headProperty.ValueKind == JsonValueKind.Null)
{
- logger.LogWarning("the head Json property was null which should not be allowed: Branch {Identifier}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Warning))
+ {
+ logger.LogWarning("the head Json property was null which should not be allowed: Branch {Identifier}", dtoInstance.Id);
+ }
}
else
{
@@ -134,7 +146,10 @@ internal static Branch DeSerialize(JsonElement jsonElement, SerializationModeKin
}
else
{
- logger.LogDebug("the head Json property was not found in the Branch: {Identifier}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the head Json property was not found in the Branch: {Identifier}", dtoInstance.Id);
+ }
}
if (jsonElement.TryGetProperty("name"u8, out JsonElement nameProperty))
@@ -147,7 +162,10 @@ internal static Branch DeSerialize(JsonElement jsonElement, SerializationModeKin
}
else
{
- logger.LogDebug("the name Json property was not found in the Branch: {Identifier}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the name Json property was not found in the Branch: {Identifier}", dtoInstance.Id);
+ }
}
if (jsonElement.TryGetProperty("owningProject"u8, out JsonElement owningProjectProperty))
@@ -170,7 +188,10 @@ internal static Branch DeSerialize(JsonElement jsonElement, SerializationModeKin
}
else
{
- logger.LogDebug("the owningProject Json property was not found in the Branch: {Identifier}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the owningProject Json property was not found in the Branch: {Identifier}", dtoInstance.Id);
+ }
}
if (jsonElement.TryGetProperty("resourceIdentifier"u8, out JsonElement resourceIdentifierProperty))
@@ -179,7 +200,10 @@ internal static Branch DeSerialize(JsonElement jsonElement, SerializationModeKin
}
else
{
- logger.LogDebug("the resourceIdentifier Json property was not found in the Branch: {Identifier}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the resourceIdentifier Json property was not found in the Branch: {Identifier}", dtoInstance.Id);
+ }
}
logger.LogTrace("finish deserialization: Branch");
diff --git a/SysML2.NET.Serializer.Json/PIM/CommitDeSerializer.cs b/SysML2.NET.Serializer.Json/PIM/CommitDeSerializer.cs
index 011d0ded4..62d99b6ba 100644
--- a/SysML2.NET.Serializer.Json/PIM/CommitDeSerializer.cs
+++ b/SysML2.NET.Serializer.Json/PIM/CommitDeSerializer.cs
@@ -89,7 +89,10 @@ internal static Commit DeSerialize(JsonElement jsonElement, SerializationModeKin
}
else
{
- logger.LogDebug("The alias Json property was not found in the Commit: {Id}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("The alias Json property was not found in the Commit: {Id}", dtoInstance.Id);
+ }
}
if (jsonElement.TryGetProperty("created"u8, out JsonElement createdProperty))
@@ -98,7 +101,10 @@ internal static Commit DeSerialize(JsonElement jsonElement, SerializationModeKin
}
else
{
- logger.LogDebug("The created Json property was not found in the Commit: {Id}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("The created Json property was not found in the Commit: {Id}", dtoInstance.Id);
+ }
}
if (jsonElement.TryGetProperty("description"u8, out JsonElement descriptionProperty))
@@ -157,7 +163,10 @@ internal static Commit DeSerialize(JsonElement jsonElement, SerializationModeKin
}
else
{
- logger.LogDebug("the owningProject Json property was not found in the Commit: {Id}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the owningProject Json property was not found in the Commit: {Id}", dtoInstance.Id);
+ }
}
if (jsonElement.TryGetProperty("resourceIdentifier"u8, out JsonElement resourceIdentifierProperty))
diff --git a/SysML2.NET.Serializer.Json/PIM/DataIdentityDeSerializer.cs b/SysML2.NET.Serializer.Json/PIM/DataIdentityDeSerializer.cs
index 89ff97478..fb4387187 100644
--- a/SysML2.NET.Serializer.Json/PIM/DataIdentityDeSerializer.cs
+++ b/SysML2.NET.Serializer.Json/PIM/DataIdentityDeSerializer.cs
@@ -89,7 +89,10 @@ internal static DataIdentity DeSerialize(JsonElement jsonElement, SerializationM
}
else
{
- logger.LogDebug("the alias Json property was not found in the DataIdentity: {Id}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the alias Json property was not found in the DataIdentity: {Id}", dtoInstance.Id);
+ }
}
if (jsonElement.TryGetProperty("description"u8, out JsonElement descriptionProperty))
@@ -102,7 +105,10 @@ internal static DataIdentity DeSerialize(JsonElement jsonElement, SerializationM
}
else
{
- logger.LogDebug("the name Json property was not found in the DataIdentity: {Id}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the name Json property was not found in the DataIdentity: {Id}", dtoInstance.Id);
+ }
}
if (jsonElement.TryGetProperty("resourceIdentifier"u8, out JsonElement resourceIdentifierProperty))
@@ -111,7 +117,10 @@ internal static DataIdentity DeSerialize(JsonElement jsonElement, SerializationM
}
else
{
- logger.LogDebug("the resourceIdentifier Json property was not found in the DataIdentity: {Id}",dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the resourceIdentifier Json property was not found in the DataIdentity: {Id}",dtoInstance.Id);
+ }
}
logger.Log(LogLevel.Trace, "finish deserialization: DataIdentity");
diff --git a/SysML2.NET.Serializer.Json/PIM/DataVersionDeSerializer.cs b/SysML2.NET.Serializer.Json/PIM/DataVersionDeSerializer.cs
index 1e1d67f30..c5731fb45 100644
--- a/SysML2.NET.Serializer.Json/PIM/DataVersionDeSerializer.cs
+++ b/SysML2.NET.Serializer.Json/PIM/DataVersionDeSerializer.cs
@@ -91,7 +91,10 @@ internal static DataVersion DeSerialize(JsonElement jsonElement, SerializationMo
}
else
{
- logger.LogDebug("the alias Json property was not found in the DataVersion: {Id}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the alias Json property was not found in the DataVersion: {Id}", dtoInstance.Id);
+ }
}
if (jsonElement.TryGetProperty("description"u8, out JsonElement descriptionProperty))
@@ -104,7 +107,10 @@ internal static DataVersion DeSerialize(JsonElement jsonElement, SerializationMo
}
else
{
- logger.LogDebug("the name Json property was not found in the DataVersion: {Id}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the name Json property was not found in the DataVersion: {Id}", dtoInstance.Id);
+ }
}
if (jsonElement.TryGetProperty("identity"u8, out JsonElement identityObject))
@@ -113,7 +119,10 @@ internal static DataVersion DeSerialize(JsonElement jsonElement, SerializationMo
}
else
{
- logger.LogDebug("the identity property was not found in the DataVersion: {Id}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the identity property was not found in the DataVersion: {Id}", dtoInstance.Id);
+ }
}
if (jsonElement.TryGetProperty("payload"u8, out JsonElement payloadObject))
@@ -143,7 +152,10 @@ internal static DataVersion DeSerialize(JsonElement jsonElement, SerializationMo
}
else
{
- logger.LogDebug("the resourceIdentifier Json property was not found in the DataVersion: {Id}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the resourceIdentifier Json property was not found in the DataVersion: {Id}", dtoInstance.Id);
+ }
}
logger.Log(LogLevel.Trace, "finish deserialization: DataVersion");
diff --git a/SysML2.NET.Serializer.Json/PIM/ProjectDeSerializer.cs b/SysML2.NET.Serializer.Json/PIM/ProjectDeSerializer.cs
index 2b57b3b06..4cec68e27 100644
--- a/SysML2.NET.Serializer.Json/PIM/ProjectDeSerializer.cs
+++ b/SysML2.NET.Serializer.Json/PIM/ProjectDeSerializer.cs
@@ -95,7 +95,10 @@ internal static Project DeSerialize(JsonElement jsonElement, SerializationModeKi
}
else
{
- logger.LogDebug("the alias Json property was not found in the Project: {Identifier}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the alias Json property was not found in the Project: {Identifier}", dtoInstance.Id);
+ }
}
if (jsonElement.TryGetProperty("created"u8, out JsonElement createdProperty))
@@ -107,12 +110,18 @@ internal static Project DeSerialize(JsonElement jsonElement, SerializationModeKi
}
else
{
- logger.LogDebug("the created Json property was null in the Project: {Identifier}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the created Json property was null in the Project: {Identifier}", dtoInstance.Id);
+ }
}
}
else
{
- logger.LogDebug("the created Json property was not found in the Project: {Identifier}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the created Json property was not found in the Project: {Identifier}", dtoInstance.Id);
+ }
}
if (jsonElement.TryGetProperty("defaultBranch"u8, out JsonElement defaultBranchProperty))
@@ -135,7 +144,10 @@ internal static Project DeSerialize(JsonElement jsonElement, SerializationModeKi
}
else
{
- logger.LogDebug("the defaultBranch Json property was not found in the Project: {Identifier}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the defaultBranch Json property was not found in the Project: {Identifier}", dtoInstance.Id);
+ }
}
if (jsonElement.TryGetProperty("description"u8, out JsonElement descriptionProperty))
@@ -148,7 +160,10 @@ internal static Project DeSerialize(JsonElement jsonElement, SerializationModeKi
}
else
{
- logger.LogDebug("the name Json property was not found in the Project: {Identifier}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the name Json property was not found in the Project: {Identifier}", dtoInstance.Id);
+ }
}
if (jsonElement.TryGetProperty("name"u8, out JsonElement nameProperty))
@@ -161,7 +176,10 @@ internal static Project DeSerialize(JsonElement jsonElement, SerializationModeKi
}
else
{
- logger.LogDebug("the name Json property was not found in the Project: {Identifier}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the name Json property was not found in the Project: {Identifier}", dtoInstance.Id);
+ }
}
if (jsonElement.TryGetProperty("resourceIdentifier"u8, out JsonElement resourceIdentifierProperty))
@@ -170,7 +188,10 @@ internal static Project DeSerialize(JsonElement jsonElement, SerializationModeKi
}
else
{
- logger.LogDebug("the resourceIdentifier Json property was not found in the Project: {Identifier}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the resourceIdentifier Json property was not found in the Project: {Identifier}", dtoInstance.Id);
+ }
}
logger.LogTrace("finish deserialization: Project");
diff --git a/SysML2.NET.Serializer.Json/PIM/TagDeserializer.cs b/SysML2.NET.Serializer.Json/PIM/TagDeserializer.cs
index 60a9bb8b2..9f9935e33 100644
--- a/SysML2.NET.Serializer.Json/PIM/TagDeserializer.cs
+++ b/SysML2.NET.Serializer.Json/PIM/TagDeserializer.cs
@@ -89,7 +89,10 @@ internal static Tag DeSerialize(JsonElement jsonElement, SerializationModeKind s
}
else
{
- logger.LogDebug("the alias Json property was not found in the Branch: {Id}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the alias Json property was not found in the Branch: {Id}", dtoInstance.Id);
+ }
}
if (jsonElement.TryGetProperty("created"u8, out JsonElement createdProperty))
@@ -98,7 +101,10 @@ internal static Tag DeSerialize(JsonElement jsonElement, SerializationModeKind s
}
else
{
- logger.LogDebug("the created Json property was not found in the Tag: {Id}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the created Json property was not found in the Tag: {Id}", dtoInstance.Id);
+ }
}
if (jsonElement.TryGetProperty("description"u8, out JsonElement descriptionProperty))
@@ -111,7 +117,10 @@ internal static Tag DeSerialize(JsonElement jsonElement, SerializationModeKind s
}
else
{
- logger.LogDebug("the name Json property was not found in the Tag: {Id}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the name Json property was not found in the Tag: {Id}", dtoInstance.Id);
+ }
}
if (jsonElement.TryGetProperty("name"u8, out JsonElement nameProperty))
@@ -124,7 +133,10 @@ internal static Tag DeSerialize(JsonElement jsonElement, SerializationModeKind s
}
else
{
- logger.LogDebug("the name Json property was not found in the Tag: {Id}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the name Json property was not found in the Tag: {Id}", dtoInstance.Id);
+ }
}
if (jsonElement.TryGetProperty("owningProject"u8, out JsonElement owningProjectProperty))
@@ -147,7 +159,10 @@ internal static Tag DeSerialize(JsonElement jsonElement, SerializationModeKind s
}
else
{
- logger.LogDebug("the owningProject Json property was not found in the Tag: {Id}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the owningProject Json property was not found in the Tag: {Id}", dtoInstance.Id);
+ }
}
if (jsonElement.TryGetProperty("resourceIdentifier"u8, out JsonElement resourceIdentifierProperty))
@@ -156,7 +171,10 @@ internal static Tag DeSerialize(JsonElement jsonElement, SerializationModeKind s
}
else
{
- logger.LogDebug("the resourceIdentifier Json property was not found in the Tag: {Id}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the resourceIdentifier Json property was not found in the Tag: {Id}", dtoInstance.Id);
+ }
}
if (jsonElement.TryGetProperty("taggedCommit"u8, out JsonElement taggedCommitProperty))
@@ -172,7 +190,10 @@ internal static Tag DeSerialize(JsonElement jsonElement, SerializationModeKind s
}
else
{
- logger.LogDebug("the taggedCommit Json property was not found in the Tag: {Id}", dtoInstance.Id);
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the taggedCommit Json property was not found in the Tag: {Id}", dtoInstance.Id);
+ }
}
logger.Log(LogLevel.Trace, "finish deserialization: Tag");
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/BranchDeSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/BranchDeSerializer.cs
new file mode 100644
index 000000000..28553cf75
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/BranchDeSerializer.cs
@@ -0,0 +1,296 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class BranchDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static Branch DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("BranchDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var branch = new Branch();
+
+ var idSeen = false;
+ var aliasSeen = false;
+ var createdSeen = false;
+ var deletedSeen = false;
+ var descriptionSeen = false;
+ var headSeen = false;
+ var nameSeen = false;
+ var owningProjectSeen = false;
+ var referencedCommitSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the Branch json object.");
+ }
+
+ if (reader.ValueTextEquals("@id"u8))
+ {
+ idSeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ throw new JsonException("The @id property is null, the Branch cannot be deserialized");
+ }
+
+ branch.Id = Utf8JsonReaderHelper.ReadGuid(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("alias"u8))
+ {
+ aliasSeen = true;
+ reader.Read();
+
+ branch.Alias = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ branch.Alias.Add(reader.GetString());
+ }
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("created"u8))
+ {
+ createdSeen = true;
+ reader.Read();
+
+ branch.Created = Utf8JsonReaderHelper.ReadDateTimeIso8601(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("deleted"u8))
+ {
+ deletedSeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ branch.Deleted = null;
+ }
+ else
+ {
+ branch.Deleted = Utf8JsonReaderHelper.ReadDateTimeIso8601(ref reader);
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("description"u8))
+ {
+ descriptionSeen = true;
+ reader.Read();
+
+ branch.Description = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("head"u8))
+ {
+ headSeen = true;
+ reader.Read();
+
+ if (Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var headValue))
+ {
+ branch.Head = headValue;
+ }
+ else
+ {
+ branch.Head = null;
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("name"u8))
+ {
+ nameSeen = true;
+ reader.Read();
+
+ branch.Name = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("owningProject"u8))
+ {
+ owningProjectSeen = true;
+ reader.Read();
+
+ if (Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var owningProjectValue))
+ {
+ branch.OwningProject = owningProjectValue;
+ }
+ else if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the Branch.owningProject reference is null, the value is left at Guid.Empty");
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("referencedCommit"u8))
+ {
+ referencedCommitSeen = true;
+ reader.Read();
+
+ if (Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var referencedCommitValue))
+ {
+ branch.ReferencedCommit = referencedCommitValue;
+ }
+ else if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the Branch.referencedCommit reference is null, the value is left at Guid.Empty");
+ }
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!idSeen)
+ {
+ logger.LogDebug("the @id Json property was not found in the Branch");
+ }
+
+ if (!aliasSeen)
+ {
+ logger.LogDebug("the alias Json property was not found in the Branch");
+ }
+
+ if (!createdSeen)
+ {
+ logger.LogDebug("the created Json property was not found in the Branch");
+ }
+
+ if (!deletedSeen)
+ {
+ logger.LogDebug("the deleted Json property was not found in the Branch");
+ }
+
+ if (!descriptionSeen)
+ {
+ logger.LogDebug("the description Json property was not found in the Branch");
+ }
+
+ if (!headSeen)
+ {
+ logger.LogDebug("the head Json property was not found in the Branch");
+ }
+
+ if (!nameSeen)
+ {
+ logger.LogDebug("the name Json property was not found in the Branch");
+ }
+
+ if (!owningProjectSeen)
+ {
+ logger.LogDebug("the owningProject Json property was not found in the Branch");
+ }
+
+ if (!referencedCommitSeen)
+ {
+ logger.LogDebug("the referencedCommit Json property was not found in the Branch");
+ }
+
+ }
+
+ return branch;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/BranchRequestDeSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/BranchRequestDeSerializer.cs
new file mode 100644
index 000000000..4f2c1ab10
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/BranchRequestDeSerializer.cs
@@ -0,0 +1,190 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class BranchRequestDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static BranchRequest DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("BranchRequestDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var branchRequest = new BranchRequest();
+
+ var aliasSeen = false;
+ var descriptionSeen = false;
+ var headSeen = false;
+ var nameSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the BranchRequest json object.");
+ }
+
+ if (reader.ValueTextEquals("alias"u8))
+ {
+ aliasSeen = true;
+ reader.Read();
+
+ branchRequest.Alias = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ branchRequest.Alias.Add(reader.GetString());
+ }
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("description"u8))
+ {
+ descriptionSeen = true;
+ reader.Read();
+
+ branchRequest.Description = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("head"u8))
+ {
+ headSeen = true;
+ reader.Read();
+
+ if (Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var headValue))
+ {
+ branchRequest.Head = headValue;
+ }
+ else
+ {
+ branchRequest.Head = null;
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("name"u8))
+ {
+ nameSeen = true;
+ reader.Read();
+
+ branchRequest.Name = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!aliasSeen)
+ {
+ logger.LogDebug("the alias Json property was not found in the BranchRequest");
+ }
+
+ if (!descriptionSeen)
+ {
+ logger.LogDebug("the description Json property was not found in the BranchRequest");
+ }
+
+ if (!headSeen)
+ {
+ logger.LogDebug("the head Json property was not found in the BranchRequest");
+ }
+
+ if (!nameSeen)
+ {
+ logger.LogDebug("the name Json property was not found in the BranchRequest");
+ }
+
+ }
+
+ return branchRequest;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/CommitDeSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/CommitDeSerializer.cs
new file mode 100644
index 000000000..addc83be8
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/CommitDeSerializer.cs
@@ -0,0 +1,256 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class CommitDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static Commit DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("CommitDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var commit = new Commit();
+
+ var idSeen = false;
+ var aliasSeen = false;
+ var createdSeen = false;
+ var descriptionSeen = false;
+ var nameSeen = false;
+ var owningProjectSeen = false;
+ var previousCommitSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the Commit json object.");
+ }
+
+ if (reader.ValueTextEquals("@id"u8))
+ {
+ idSeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ throw new JsonException("The @id property is null, the Commit cannot be deserialized");
+ }
+
+ commit.Id = Utf8JsonReaderHelper.ReadGuid(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("alias"u8))
+ {
+ aliasSeen = true;
+ reader.Read();
+
+ commit.Alias = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ commit.Alias.Add(reader.GetString());
+ }
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("created"u8))
+ {
+ createdSeen = true;
+ reader.Read();
+
+ commit.Created = Utf8JsonReaderHelper.ReadDateTimeIso8601(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("description"u8))
+ {
+ descriptionSeen = true;
+ reader.Read();
+
+ commit.Description = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("name"u8))
+ {
+ nameSeen = true;
+ reader.Read();
+
+ commit.Name = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("owningProject"u8))
+ {
+ owningProjectSeen = true;
+ reader.Read();
+
+ if (Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var owningProjectValue))
+ {
+ commit.OwningProject = owningProjectValue;
+ }
+ else if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the Commit.owningProject reference is null, the value is left at Guid.Empty");
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("previousCommit"u8))
+ {
+ previousCommitSeen = true;
+ reader.Read();
+
+ commit.PreviousCommit = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ if (Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var previousCommitItem))
+ {
+ commit.PreviousCommit.Add(previousCommitItem);
+ }
+ }
+ }
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!idSeen)
+ {
+ logger.LogDebug("the @id Json property was not found in the Commit");
+ }
+
+ if (!aliasSeen)
+ {
+ logger.LogDebug("the alias Json property was not found in the Commit");
+ }
+
+ if (!createdSeen)
+ {
+ logger.LogDebug("the created Json property was not found in the Commit");
+ }
+
+ if (!descriptionSeen)
+ {
+ logger.LogDebug("the description Json property was not found in the Commit");
+ }
+
+ if (!nameSeen)
+ {
+ logger.LogDebug("the name Json property was not found in the Commit");
+ }
+
+ if (!owningProjectSeen)
+ {
+ logger.LogDebug("the owningProject Json property was not found in the Commit");
+ }
+
+ if (!previousCommitSeen)
+ {
+ logger.LogDebug("the previousCommit Json property was not found in the Commit");
+ }
+
+ }
+
+ return commit;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/CommitRequestDeSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/CommitRequestDeSerializer.cs
new file mode 100644
index 000000000..873b2d5cd
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/CommitRequestDeSerializer.cs
@@ -0,0 +1,193 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class CommitRequestDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static CommitRequest DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("CommitRequestDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var commitRequest = new CommitRequest();
+
+ var aliasSeen = false;
+ var changeSeen = false;
+ var descriptionSeen = false;
+ var nameSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the CommitRequest json object.");
+ }
+
+ if (reader.ValueTextEquals("alias"u8))
+ {
+ aliasSeen = true;
+ reader.Read();
+
+ commitRequest.Alias = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ commitRequest.Alias.Add(reader.GetString());
+ }
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("change"u8))
+ {
+ changeSeen = true;
+ reader.Read();
+
+ commitRequest.Change = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ commitRequest.Change.Add(DataVersionRequestDeSerializer.DeSerialize(ref reader, serializationModeKind, deserializeDerivedProperties, loggerFactory));
+ }
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("description"u8))
+ {
+ descriptionSeen = true;
+ reader.Read();
+
+ commitRequest.Description = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("name"u8))
+ {
+ nameSeen = true;
+ reader.Read();
+
+ commitRequest.Name = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!aliasSeen)
+ {
+ logger.LogDebug("the alias Json property was not found in the CommitRequest");
+ }
+
+ if (!changeSeen)
+ {
+ logger.LogDebug("the change Json property was not found in the CommitRequest");
+ }
+
+ if (!descriptionSeen)
+ {
+ logger.LogDebug("the description Json property was not found in the CommitRequest");
+ }
+
+ if (!nameSeen)
+ {
+ logger.LogDebug("the name Json property was not found in the CommitRequest");
+ }
+
+ }
+
+ return commitRequest;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/CompositeConstraintDeSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/CompositeConstraintDeSerializer.cs
new file mode 100644
index 000000000..78fbfbab0
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/CompositeConstraintDeSerializer.cs
@@ -0,0 +1,151 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class CompositeConstraintDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static CompositeConstraint DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("CompositeConstraintDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var compositeConstraint = new CompositeConstraint();
+
+ var constraintSeen = false;
+ var operatorSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the CompositeConstraint json object.");
+ }
+
+ if (reader.ValueTextEquals("constraint"u8))
+ {
+ constraintSeen = true;
+ reader.Read();
+
+ compositeConstraint.Constraint = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ compositeConstraint.Constraint.Add((IConstraint)PsmDeSerializationDispatcher.ReadResponse(ref reader, serializationModeKind, deserializeDerivedProperties, loggerFactory));
+ }
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("operator"u8))
+ {
+ operatorSeen = true;
+ reader.Read();
+
+ compositeConstraint.Operator = CompositeConstraintOperatorProvider.Parse(Utf8JsonReaderHelper.ReadStringOrNull(ref reader).AsSpan());
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!constraintSeen)
+ {
+ logger.LogDebug("the constraint Json property was not found in the CompositeConstraint");
+ }
+
+ if (!operatorSeen)
+ {
+ logger.LogDebug("the operator Json property was not found in the CompositeConstraint");
+ }
+
+ }
+
+ return compositeConstraint;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/CompositeConstraintRequestDeSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/CompositeConstraintRequestDeSerializer.cs
new file mode 100644
index 000000000..dc2928338
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/CompositeConstraintRequestDeSerializer.cs
@@ -0,0 +1,151 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class CompositeConstraintRequestDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static CompositeConstraintRequest DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("CompositeConstraintRequestDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var compositeConstraintRequest = new CompositeConstraintRequest();
+
+ var constraintSeen = false;
+ var operatorSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the CompositeConstraintRequest json object.");
+ }
+
+ if (reader.ValueTextEquals("constraint"u8))
+ {
+ constraintSeen = true;
+ reader.Read();
+
+ compositeConstraintRequest.Constraint = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ compositeConstraintRequest.Constraint.Add((IConstraint)PsmDeSerializationDispatcher.ReadRequest(ref reader, serializationModeKind, deserializeDerivedProperties, loggerFactory));
+ }
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("operator"u8))
+ {
+ operatorSeen = true;
+ reader.Read();
+
+ compositeConstraintRequest.Operator = CompositeConstraintRequestOperatorProvider.Parse(Utf8JsonReaderHelper.ReadStringOrNull(ref reader).AsSpan());
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!constraintSeen)
+ {
+ logger.LogDebug("the constraint Json property was not found in the CompositeConstraintRequest");
+ }
+
+ if (!operatorSeen)
+ {
+ logger.LogDebug("the operator Json property was not found in the CompositeConstraintRequest");
+ }
+
+ }
+
+ return compositeConstraintRequest;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/DataDifferenceDeSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/DataDifferenceDeSerializer.cs
new file mode 100644
index 000000000..2deab51f0
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/DataDifferenceDeSerializer.cs
@@ -0,0 +1,155 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class DataDifferenceDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static DataDifference DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("DataDifferenceDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var dataDifference = new DataDifference();
+
+ var baseDataSeen = false;
+ var compareDataSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the DataDifference json object.");
+ }
+
+ if (reader.ValueTextEquals("baseData"u8))
+ {
+ baseDataSeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ dataDifference.BaseData = null;
+ }
+ else
+ {
+ dataDifference.BaseData = DataVersionDeSerializer.DeSerialize(ref reader, serializationModeKind, deserializeDerivedProperties, loggerFactory);
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("compareData"u8))
+ {
+ compareDataSeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ dataDifference.CompareData = null;
+ }
+ else
+ {
+ dataDifference.CompareData = DataVersionDeSerializer.DeSerialize(ref reader, serializationModeKind, deserializeDerivedProperties, loggerFactory);
+ }
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!baseDataSeen)
+ {
+ logger.LogDebug("the baseData Json property was not found in the DataDifference");
+ }
+
+ if (!compareDataSeen)
+ {
+ logger.LogDebug("the compareData Json property was not found in the DataDifference");
+ }
+
+ }
+
+ return dataDifference;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/DataIdentityDeSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/DataIdentityDeSerializer.cs
new file mode 100644
index 000000000..3e15abb26
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/DataIdentityDeSerializer.cs
@@ -0,0 +1,188 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class DataIdentityDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static DataIdentity DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("DataIdentityDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var dataIdentity = new DataIdentity();
+
+ var idSeen = false;
+ var aliasSeen = false;
+ var descriptionSeen = false;
+ var nameSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the DataIdentity json object.");
+ }
+
+ if (reader.ValueTextEquals("@id"u8))
+ {
+ idSeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ throw new JsonException("The @id property is null, the DataIdentity cannot be deserialized");
+ }
+
+ dataIdentity.Id = Utf8JsonReaderHelper.ReadGuid(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("alias"u8))
+ {
+ aliasSeen = true;
+ reader.Read();
+
+ dataIdentity.Alias = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ dataIdentity.Alias.Add(reader.GetString());
+ }
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("description"u8))
+ {
+ descriptionSeen = true;
+ reader.Read();
+
+ dataIdentity.Description = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("name"u8))
+ {
+ nameSeen = true;
+ reader.Read();
+
+ dataIdentity.Name = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!idSeen)
+ {
+ logger.LogDebug("the @id Json property was not found in the DataIdentity");
+ }
+
+ if (!aliasSeen)
+ {
+ logger.LogDebug("the alias Json property was not found in the DataIdentity");
+ }
+
+ if (!descriptionSeen)
+ {
+ logger.LogDebug("the description Json property was not found in the DataIdentity");
+ }
+
+ if (!nameSeen)
+ {
+ logger.LogDebug("the name Json property was not found in the DataIdentity");
+ }
+
+ }
+
+ return dataIdentity;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/DataIdentityRequestDeSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/DataIdentityRequestDeSerializer.cs
new file mode 100644
index 000000000..3419806d2
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/DataIdentityRequestDeSerializer.cs
@@ -0,0 +1,188 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class DataIdentityRequestDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static DataIdentityRequest DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("DataIdentityRequestDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var dataIdentityRequest = new DataIdentityRequest();
+
+ var idSeen = false;
+ var aliasSeen = false;
+ var descriptionSeen = false;
+ var nameSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the DataIdentityRequest json object.");
+ }
+
+ if (reader.ValueTextEquals("@id"u8))
+ {
+ idSeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ throw new JsonException("The @id property is null, the DataIdentityRequest cannot be deserialized");
+ }
+
+ dataIdentityRequest.Id = Utf8JsonReaderHelper.ReadGuid(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("alias"u8))
+ {
+ aliasSeen = true;
+ reader.Read();
+
+ dataIdentityRequest.Alias = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ dataIdentityRequest.Alias.Add(reader.GetString());
+ }
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("description"u8))
+ {
+ descriptionSeen = true;
+ reader.Read();
+
+ dataIdentityRequest.Description = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("name"u8))
+ {
+ nameSeen = true;
+ reader.Read();
+
+ dataIdentityRequest.Name = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!idSeen)
+ {
+ logger.LogDebug("the @id Json property was not found in the DataIdentityRequest");
+ }
+
+ if (!aliasSeen)
+ {
+ logger.LogDebug("the alias Json property was not found in the DataIdentityRequest");
+ }
+
+ if (!descriptionSeen)
+ {
+ logger.LogDebug("the description Json property was not found in the DataIdentityRequest");
+ }
+
+ if (!nameSeen)
+ {
+ logger.LogDebug("the name Json property was not found in the DataIdentityRequest");
+ }
+
+ }
+
+ return dataIdentityRequest;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/DataVersionDeSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/DataVersionDeSerializer.cs
new file mode 100644
index 000000000..76cd3228d
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/DataVersionDeSerializer.cs
@@ -0,0 +1,234 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class DataVersionDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static DataVersion DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("DataVersionDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var dataVersion = new DataVersion();
+
+ var idSeen = false;
+ var aliasSeen = false;
+ var descriptionSeen = false;
+ var identitySeen = false;
+ var nameSeen = false;
+ var payloadSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the DataVersion json object.");
+ }
+
+ if (reader.ValueTextEquals("@id"u8))
+ {
+ idSeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ throw new JsonException("The @id property is null, the DataVersion cannot be deserialized");
+ }
+
+ dataVersion.Id = Utf8JsonReaderHelper.ReadGuid(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("alias"u8))
+ {
+ aliasSeen = true;
+ reader.Read();
+
+ dataVersion.Alias = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ dataVersion.Alias.Add(reader.GetString());
+ }
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("description"u8))
+ {
+ descriptionSeen = true;
+ reader.Read();
+
+ dataVersion.Description = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("identity"u8))
+ {
+ identitySeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ dataVersion.Identity = null;
+ }
+ else
+ {
+ dataVersion.Identity = DataIdentityDeSerializer.DeSerialize(ref reader, serializationModeKind, deserializeDerivedProperties, loggerFactory);
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("name"u8))
+ {
+ nameSeen = true;
+ reader.Read();
+
+ dataVersion.Name = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("payload"u8))
+ {
+ payloadSeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ dataVersion.Payload = null;
+ }
+ else
+ {
+ dataVersion.Payload = PsmDeSerializationDispatcher.ReadData(ref reader, serializationModeKind, deserializeDerivedProperties, loggerFactory);
+ }
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!idSeen)
+ {
+ logger.LogDebug("the @id Json property was not found in the DataVersion");
+ }
+
+ if (!aliasSeen)
+ {
+ logger.LogDebug("the alias Json property was not found in the DataVersion");
+ }
+
+ if (!descriptionSeen)
+ {
+ logger.LogDebug("the description Json property was not found in the DataVersion");
+ }
+
+ if (!identitySeen)
+ {
+ logger.LogDebug("the identity Json property was not found in the DataVersion");
+ }
+
+ if (!nameSeen)
+ {
+ logger.LogDebug("the name Json property was not found in the DataVersion");
+ }
+
+ if (!payloadSeen)
+ {
+ logger.LogDebug("the payload Json property was not found in the DataVersion");
+ }
+
+ }
+
+ return dataVersion;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/DataVersionRequestDeSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/DataVersionRequestDeSerializer.cs
new file mode 100644
index 000000000..5da6fc400
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/DataVersionRequestDeSerializer.cs
@@ -0,0 +1,213 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class DataVersionRequestDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static DataVersionRequest DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("DataVersionRequestDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var dataVersionRequest = new DataVersionRequest();
+
+ var aliasSeen = false;
+ var descriptionSeen = false;
+ var identitySeen = false;
+ var nameSeen = false;
+ var payloadSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the DataVersionRequest json object.");
+ }
+
+ if (reader.ValueTextEquals("alias"u8))
+ {
+ aliasSeen = true;
+ reader.Read();
+
+ dataVersionRequest.Alias = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ dataVersionRequest.Alias.Add(reader.GetString());
+ }
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("description"u8))
+ {
+ descriptionSeen = true;
+ reader.Read();
+
+ dataVersionRequest.Description = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("identity"u8))
+ {
+ identitySeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ dataVersionRequest.Identity = null;
+ }
+ else
+ {
+ dataVersionRequest.Identity = DataIdentityRequestDeSerializer.DeSerialize(ref reader, serializationModeKind, deserializeDerivedProperties, loggerFactory);
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("name"u8))
+ {
+ nameSeen = true;
+ reader.Read();
+
+ dataVersionRequest.Name = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("payload"u8))
+ {
+ payloadSeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ dataVersionRequest.Payload = null;
+ }
+ else
+ {
+ dataVersionRequest.Payload = PsmDeSerializationDispatcher.ReadDataRequest(ref reader, serializationModeKind, deserializeDerivedProperties, loggerFactory);
+ }
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!aliasSeen)
+ {
+ logger.LogDebug("the alias Json property was not found in the DataVersionRequest");
+ }
+
+ if (!descriptionSeen)
+ {
+ logger.LogDebug("the description Json property was not found in the DataVersionRequest");
+ }
+
+ if (!identitySeen)
+ {
+ logger.LogDebug("the identity Json property was not found in the DataVersionRequest");
+ }
+
+ if (!nameSeen)
+ {
+ logger.LogDebug("the name Json property was not found in the DataVersionRequest");
+ }
+
+ if (!payloadSeen)
+ {
+ logger.LogDebug("the payload Json property was not found in the DataVersionRequest");
+ }
+
+ }
+
+ return dataVersionRequest;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ErrorDeSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ErrorDeSerializer.cs
new file mode 100644
index 000000000..975ba7346
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ErrorDeSerializer.cs
@@ -0,0 +1,125 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class ErrorDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static Error DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("ErrorDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var error = new Error();
+
+ var descriptionSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the Error json object.");
+ }
+
+ if (reader.ValueTextEquals("description"u8))
+ {
+ descriptionSeen = true;
+ reader.Read();
+
+ error.Description = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!descriptionSeen)
+ {
+ logger.LogDebug("the description Json property was not found in the Error");
+ }
+
+ }
+
+ return error;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ExternalDataDeSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ExternalDataDeSerializer.cs
new file mode 100644
index 000000000..065994cbd
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ExternalDataDeSerializer.cs
@@ -0,0 +1,146 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class ExternalDataDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static ExternalData DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("ExternalDataDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var externalData = new ExternalData();
+
+ var idSeen = false;
+ var resourceIdentifierSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the ExternalData json object.");
+ }
+
+ if (reader.ValueTextEquals("@id"u8))
+ {
+ idSeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ throw new JsonException("The @id property is null, the ExternalData cannot be deserialized");
+ }
+
+ externalData.Id = Utf8JsonReaderHelper.ReadGuid(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("resourceIdentifier"u8))
+ {
+ resourceIdentifierSeen = true;
+ reader.Read();
+
+ externalData.ResourceIdentifier = Utf8JsonReaderHelper.ReadUriOrNull(ref reader);
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!idSeen)
+ {
+ logger.LogDebug("the @id Json property was not found in the ExternalData");
+ }
+
+ if (!resourceIdentifierSeen)
+ {
+ logger.LogDebug("the resourceIdentifier Json property was not found in the ExternalData");
+ }
+
+ }
+
+ return externalData;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ExternalDataRequestDeSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ExternalDataRequestDeSerializer.cs
new file mode 100644
index 000000000..551ba2eab
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ExternalDataRequestDeSerializer.cs
@@ -0,0 +1,146 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class ExternalDataRequestDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static ExternalDataRequest DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("ExternalDataRequestDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var externalDataRequest = new ExternalDataRequest();
+
+ var idSeen = false;
+ var resourceIdentifierSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the ExternalDataRequest json object.");
+ }
+
+ if (reader.ValueTextEquals("@id"u8))
+ {
+ idSeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ throw new JsonException("The @id property is null, the ExternalDataRequest cannot be deserialized");
+ }
+
+ externalDataRequest.Id = Utf8JsonReaderHelper.ReadGuid(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("resourceIdentifier"u8))
+ {
+ resourceIdentifierSeen = true;
+ reader.Read();
+
+ externalDataRequest.ResourceIdentifier = Utf8JsonReaderHelper.ReadUriOrNull(ref reader);
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!idSeen)
+ {
+ logger.LogDebug("the @id Json property was not found in the ExternalDataRequest");
+ }
+
+ if (!resourceIdentifierSeen)
+ {
+ logger.LogDebug("the resourceIdentifier Json property was not found in the ExternalDataRequest");
+ }
+
+ }
+
+ return externalDataRequest;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ExternalRelationshipDeSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ExternalRelationshipDeSerializer.cs
new file mode 100644
index 000000000..3a9f5ef4a
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ExternalRelationshipDeSerializer.cs
@@ -0,0 +1,208 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class ExternalRelationshipDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static ExternalRelationship DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("ExternalRelationshipDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var externalRelationship = new ExternalRelationship();
+
+ var idSeen = false;
+ var elementEndSeen = false;
+ var externalDataEndSeen = false;
+ var languageSeen = false;
+ var specificationSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the ExternalRelationship json object.");
+ }
+
+ if (reader.ValueTextEquals("@id"u8))
+ {
+ idSeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ throw new JsonException("The @id property is null, the ExternalRelationship cannot be deserialized");
+ }
+
+ externalRelationship.Id = Utf8JsonReaderHelper.ReadGuid(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("elementEnd"u8))
+ {
+ elementEndSeen = true;
+ reader.Read();
+
+ if (Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var elementEndValue))
+ {
+ externalRelationship.ElementEnd = elementEndValue;
+ }
+ else if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the ExternalRelationship.elementEnd reference is null, the value is left at Guid.Empty");
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("externalDataEnd"u8))
+ {
+ externalDataEndSeen = true;
+ reader.Read();
+
+ if (Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var externalDataEndValue))
+ {
+ externalRelationship.ExternalDataEnd = externalDataEndValue;
+ }
+ else if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the ExternalRelationship.externalDataEnd reference is null, the value is left at Guid.Empty");
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("language"u8))
+ {
+ languageSeen = true;
+ reader.Read();
+
+ externalRelationship.Language = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("specification"u8))
+ {
+ specificationSeen = true;
+ reader.Read();
+
+ externalRelationship.Specification = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!idSeen)
+ {
+ logger.LogDebug("the @id Json property was not found in the ExternalRelationship");
+ }
+
+ if (!elementEndSeen)
+ {
+ logger.LogDebug("the elementEnd Json property was not found in the ExternalRelationship");
+ }
+
+ if (!externalDataEndSeen)
+ {
+ logger.LogDebug("the externalDataEnd Json property was not found in the ExternalRelationship");
+ }
+
+ if (!languageSeen)
+ {
+ logger.LogDebug("the language Json property was not found in the ExternalRelationship");
+ }
+
+ if (!specificationSeen)
+ {
+ logger.LogDebug("the specification Json property was not found in the ExternalRelationship");
+ }
+
+ }
+
+ return externalRelationship;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ExternalRelationshipRequestDeSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ExternalRelationshipRequestDeSerializer.cs
new file mode 100644
index 000000000..cfbd2662e
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ExternalRelationshipRequestDeSerializer.cs
@@ -0,0 +1,208 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class ExternalRelationshipRequestDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static ExternalRelationshipRequest DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("ExternalRelationshipRequestDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var externalRelationshipRequest = new ExternalRelationshipRequest();
+
+ var idSeen = false;
+ var elementEndSeen = false;
+ var externalDataEndSeen = false;
+ var languageSeen = false;
+ var specificationSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the ExternalRelationshipRequest json object.");
+ }
+
+ if (reader.ValueTextEquals("@id"u8))
+ {
+ idSeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ throw new JsonException("The @id property is null, the ExternalRelationshipRequest cannot be deserialized");
+ }
+
+ externalRelationshipRequest.Id = Utf8JsonReaderHelper.ReadGuid(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("elementEnd"u8))
+ {
+ elementEndSeen = true;
+ reader.Read();
+
+ if (Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var elementEndValue))
+ {
+ externalRelationshipRequest.ElementEnd = elementEndValue;
+ }
+ else
+ {
+ externalRelationshipRequest.ElementEnd = null;
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("externalDataEnd"u8))
+ {
+ externalDataEndSeen = true;
+ reader.Read();
+
+ if (Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var externalDataEndValue))
+ {
+ externalRelationshipRequest.ExternalDataEnd = externalDataEndValue;
+ }
+ else
+ {
+ externalRelationshipRequest.ExternalDataEnd = null;
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("language"u8))
+ {
+ languageSeen = true;
+ reader.Read();
+
+ externalRelationshipRequest.Language = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("specification"u8))
+ {
+ specificationSeen = true;
+ reader.Read();
+
+ externalRelationshipRequest.Specification = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!idSeen)
+ {
+ logger.LogDebug("the @id Json property was not found in the ExternalRelationshipRequest");
+ }
+
+ if (!elementEndSeen)
+ {
+ logger.LogDebug("the elementEnd Json property was not found in the ExternalRelationshipRequest");
+ }
+
+ if (!externalDataEndSeen)
+ {
+ logger.LogDebug("the externalDataEnd Json property was not found in the ExternalRelationshipRequest");
+ }
+
+ if (!languageSeen)
+ {
+ logger.LogDebug("the language Json property was not found in the ExternalRelationshipRequest");
+ }
+
+ if (!specificationSeen)
+ {
+ logger.LogDebug("the specification Json property was not found in the ExternalRelationshipRequest");
+ }
+
+ }
+
+ return externalRelationshipRequest;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/PrimitiveConstraintDeSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/PrimitiveConstraintDeSerializer.cs
new file mode 100644
index 000000000..34089fb25
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/PrimitiveConstraintDeSerializer.cs
@@ -0,0 +1,183 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class PrimitiveConstraintDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static PrimitiveConstraint DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("PrimitiveConstraintDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var primitiveConstraint = new PrimitiveConstraint();
+
+ var inverseSeen = false;
+ var operatorSeen = false;
+ var propertySeen = false;
+ var valueSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the PrimitiveConstraint json object.");
+ }
+
+ if (reader.ValueTextEquals("inverse"u8))
+ {
+ inverseSeen = true;
+ reader.Read();
+
+ primitiveConstraint.Inverse = Utf8JsonReaderHelper.ReadBoolOrNull(ref reader) ?? false;
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("operator"u8))
+ {
+ operatorSeen = true;
+ reader.Read();
+
+ primitiveConstraint.Operator = PrimitiveConstraintOperatorProvider.Parse(Utf8JsonReaderHelper.ReadStringOrNull(ref reader).AsSpan());
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("property"u8))
+ {
+ propertySeen = true;
+ reader.Read();
+
+ primitiveConstraint.Property = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("value"u8))
+ {
+ valueSeen = true;
+ reader.Read();
+
+ primitiveConstraint.Value = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ primitiveConstraint.Value.Add(ConstraintValueReader.Read(ref reader));
+ }
+ }
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!inverseSeen)
+ {
+ logger.LogDebug("the inverse Json property was not found in the PrimitiveConstraint");
+ }
+
+ if (!operatorSeen)
+ {
+ logger.LogDebug("the operator Json property was not found in the PrimitiveConstraint");
+ }
+
+ if (!propertySeen)
+ {
+ logger.LogDebug("the property Json property was not found in the PrimitiveConstraint");
+ }
+
+ if (!valueSeen)
+ {
+ logger.LogDebug("the value Json property was not found in the PrimitiveConstraint");
+ }
+
+ }
+
+ return primitiveConstraint;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/PrimitiveConstraintRequestDeSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/PrimitiveConstraintRequestDeSerializer.cs
new file mode 100644
index 000000000..f53c950a3
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/PrimitiveConstraintRequestDeSerializer.cs
@@ -0,0 +1,183 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class PrimitiveConstraintRequestDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static PrimitiveConstraintRequest DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("PrimitiveConstraintRequestDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var primitiveConstraintRequest = new PrimitiveConstraintRequest();
+
+ var inverseSeen = false;
+ var operatorSeen = false;
+ var propertySeen = false;
+ var valueSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the PrimitiveConstraintRequest json object.");
+ }
+
+ if (reader.ValueTextEquals("inverse"u8))
+ {
+ inverseSeen = true;
+ reader.Read();
+
+ primitiveConstraintRequest.Inverse = Utf8JsonReaderHelper.ReadBoolOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("operator"u8))
+ {
+ operatorSeen = true;
+ reader.Read();
+
+ primitiveConstraintRequest.Operator = PrimitiveConstraintRequestOperatorProvider.Parse(Utf8JsonReaderHelper.ReadStringOrNull(ref reader).AsSpan());
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("property"u8))
+ {
+ propertySeen = true;
+ reader.Read();
+
+ primitiveConstraintRequest.Property = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("value"u8))
+ {
+ valueSeen = true;
+ reader.Read();
+
+ primitiveConstraintRequest.Value = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ primitiveConstraintRequest.Value.Add(ConstraintValueReader.Read(ref reader));
+ }
+ }
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!inverseSeen)
+ {
+ logger.LogDebug("the inverse Json property was not found in the PrimitiveConstraintRequest");
+ }
+
+ if (!operatorSeen)
+ {
+ logger.LogDebug("the operator Json property was not found in the PrimitiveConstraintRequest");
+ }
+
+ if (!propertySeen)
+ {
+ logger.LogDebug("the property Json property was not found in the PrimitiveConstraintRequest");
+ }
+
+ if (!valueSeen)
+ {
+ logger.LogDebug("the value Json property was not found in the PrimitiveConstraintRequest");
+ }
+
+ }
+
+ return primitiveConstraintRequest;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ProjectDeSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ProjectDeSerializer.cs
new file mode 100644
index 000000000..5ad8691f9
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ProjectDeSerializer.cs
@@ -0,0 +1,227 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class ProjectDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static Project DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("ProjectDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var project = new Project();
+
+ var idSeen = false;
+ var aliasSeen = false;
+ var createdSeen = false;
+ var defaultBranchSeen = false;
+ var descriptionSeen = false;
+ var nameSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the Project json object.");
+ }
+
+ if (reader.ValueTextEquals("@id"u8))
+ {
+ idSeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ throw new JsonException("The @id property is null, the Project cannot be deserialized");
+ }
+
+ project.Id = Utf8JsonReaderHelper.ReadGuid(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("alias"u8))
+ {
+ aliasSeen = true;
+ reader.Read();
+
+ project.Alias = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ project.Alias.Add(reader.GetString());
+ }
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("created"u8))
+ {
+ createdSeen = true;
+ reader.Read();
+
+ project.Created = Utf8JsonReaderHelper.ReadDateTimeIso8601(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("defaultBranch"u8))
+ {
+ defaultBranchSeen = true;
+ reader.Read();
+
+ if (Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var defaultBranchValue))
+ {
+ project.DefaultBranch = defaultBranchValue;
+ }
+ else if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the Project.defaultBranch reference is null, the value is left at Guid.Empty");
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("description"u8))
+ {
+ descriptionSeen = true;
+ reader.Read();
+
+ project.Description = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("name"u8))
+ {
+ nameSeen = true;
+ reader.Read();
+
+ project.Name = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!idSeen)
+ {
+ logger.LogDebug("the @id Json property was not found in the Project");
+ }
+
+ if (!aliasSeen)
+ {
+ logger.LogDebug("the alias Json property was not found in the Project");
+ }
+
+ if (!createdSeen)
+ {
+ logger.LogDebug("the created Json property was not found in the Project");
+ }
+
+ if (!defaultBranchSeen)
+ {
+ logger.LogDebug("the defaultBranch Json property was not found in the Project");
+ }
+
+ if (!descriptionSeen)
+ {
+ logger.LogDebug("the description Json property was not found in the Project");
+ }
+
+ if (!nameSeen)
+ {
+ logger.LogDebug("the name Json property was not found in the Project");
+ }
+
+ }
+
+ return project;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ProjectRequestDeSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ProjectRequestDeSerializer.cs
new file mode 100644
index 000000000..28a7fe996
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ProjectRequestDeSerializer.cs
@@ -0,0 +1,190 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class ProjectRequestDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static ProjectRequest DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("ProjectRequestDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var projectRequest = new ProjectRequest();
+
+ var aliasSeen = false;
+ var defaultBranchSeen = false;
+ var descriptionSeen = false;
+ var nameSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the ProjectRequest json object.");
+ }
+
+ if (reader.ValueTextEquals("alias"u8))
+ {
+ aliasSeen = true;
+ reader.Read();
+
+ projectRequest.Alias = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ projectRequest.Alias.Add(reader.GetString());
+ }
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("defaultBranch"u8))
+ {
+ defaultBranchSeen = true;
+ reader.Read();
+
+ if (Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var defaultBranchValue))
+ {
+ projectRequest.DefaultBranch = defaultBranchValue;
+ }
+ else
+ {
+ projectRequest.DefaultBranch = null;
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("description"u8))
+ {
+ descriptionSeen = true;
+ reader.Read();
+
+ projectRequest.Description = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("name"u8))
+ {
+ nameSeen = true;
+ reader.Read();
+
+ projectRequest.Name = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!aliasSeen)
+ {
+ logger.LogDebug("the alias Json property was not found in the ProjectRequest");
+ }
+
+ if (!defaultBranchSeen)
+ {
+ logger.LogDebug("the defaultBranch Json property was not found in the ProjectRequest");
+ }
+
+ if (!descriptionSeen)
+ {
+ logger.LogDebug("the description Json property was not found in the ProjectRequest");
+ }
+
+ if (!nameSeen)
+ {
+ logger.LogDebug("the name Json property was not found in the ProjectRequest");
+ }
+
+ }
+
+ return projectRequest;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ProjectUsageDeSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ProjectUsageDeSerializer.cs
new file mode 100644
index 000000000..dd92ae2eb
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ProjectUsageDeSerializer.cs
@@ -0,0 +1,176 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class ProjectUsageDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static ProjectUsage DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("ProjectUsageDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var projectUsage = new ProjectUsage();
+
+ var idSeen = false;
+ var usedCommitSeen = false;
+ var usedProjectSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the ProjectUsage json object.");
+ }
+
+ if (reader.ValueTextEquals("@id"u8))
+ {
+ idSeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ throw new JsonException("The @id property is null, the ProjectUsage cannot be deserialized");
+ }
+
+ projectUsage.Id = Utf8JsonReaderHelper.ReadGuid(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("usedCommit"u8))
+ {
+ usedCommitSeen = true;
+ reader.Read();
+
+ if (Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var usedCommitValue))
+ {
+ projectUsage.UsedCommit = usedCommitValue;
+ }
+ else if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the ProjectUsage.usedCommit reference is null, the value is left at Guid.Empty");
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("usedProject"u8))
+ {
+ usedProjectSeen = true;
+ reader.Read();
+
+ if (Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var usedProjectValue))
+ {
+ projectUsage.UsedProject = usedProjectValue;
+ }
+ else if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the ProjectUsage.usedProject reference is null, the value is left at Guid.Empty");
+ }
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!idSeen)
+ {
+ logger.LogDebug("the @id Json property was not found in the ProjectUsage");
+ }
+
+ if (!usedCommitSeen)
+ {
+ logger.LogDebug("the usedCommit Json property was not found in the ProjectUsage");
+ }
+
+ if (!usedProjectSeen)
+ {
+ logger.LogDebug("the usedProject Json property was not found in the ProjectUsage");
+ }
+
+ }
+
+ return projectUsage;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ProjectUsageRequestDeSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ProjectUsageRequestDeSerializer.cs
new file mode 100644
index 000000000..de69bd23f
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ProjectUsageRequestDeSerializer.cs
@@ -0,0 +1,176 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class ProjectUsageRequestDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static ProjectUsageRequest DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("ProjectUsageRequestDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var projectUsageRequest = new ProjectUsageRequest();
+
+ var idSeen = false;
+ var usedCommitSeen = false;
+ var usedProjectSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the ProjectUsageRequest json object.");
+ }
+
+ if (reader.ValueTextEquals("@id"u8))
+ {
+ idSeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ throw new JsonException("The @id property is null, the ProjectUsageRequest cannot be deserialized");
+ }
+
+ projectUsageRequest.Id = Utf8JsonReaderHelper.ReadGuid(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("usedCommit"u8))
+ {
+ usedCommitSeen = true;
+ reader.Read();
+
+ if (Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var usedCommitValue))
+ {
+ projectUsageRequest.UsedCommit = usedCommitValue;
+ }
+ else
+ {
+ projectUsageRequest.UsedCommit = null;
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("usedProject"u8))
+ {
+ usedProjectSeen = true;
+ reader.Read();
+
+ if (Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var usedProjectValue))
+ {
+ projectUsageRequest.UsedProject = usedProjectValue;
+ }
+ else
+ {
+ projectUsageRequest.UsedProject = null;
+ }
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!idSeen)
+ {
+ logger.LogDebug("the @id Json property was not found in the ProjectUsageRequest");
+ }
+
+ if (!usedCommitSeen)
+ {
+ logger.LogDebug("the usedCommit Json property was not found in the ProjectUsageRequest");
+ }
+
+ if (!usedProjectSeen)
+ {
+ logger.LogDebug("the usedProject Json property was not found in the ProjectUsageRequest");
+ }
+
+ }
+
+ return projectUsageRequest;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/QueryDeSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/QueryDeSerializer.cs
new file mode 100644
index 000000000..b7a809ec1
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/QueryDeSerializer.cs
@@ -0,0 +1,260 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class QueryDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static Query DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("QueryDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var query = new Query();
+
+ var idSeen = false;
+ var aliasSeen = false;
+ var descriptionSeen = false;
+ var nameSeen = false;
+ var owningProjectSeen = false;
+ var selectSeen = false;
+ var whereSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the Query json object.");
+ }
+
+ if (reader.ValueTextEquals("@id"u8))
+ {
+ idSeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ throw new JsonException("The @id property is null, the Query cannot be deserialized");
+ }
+
+ query.Id = Utf8JsonReaderHelper.ReadGuid(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("alias"u8))
+ {
+ aliasSeen = true;
+ reader.Read();
+
+ query.Alias = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ query.Alias.Add(reader.GetString());
+ }
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("description"u8))
+ {
+ descriptionSeen = true;
+ reader.Read();
+
+ query.Description = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("name"u8))
+ {
+ nameSeen = true;
+ reader.Read();
+
+ query.Name = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("owningProject"u8))
+ {
+ owningProjectSeen = true;
+ reader.Read();
+
+ if (Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var owningProjectValue))
+ {
+ query.OwningProject = owningProjectValue;
+ }
+ else if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the Query.owningProject reference is null, the value is left at Guid.Empty");
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("select"u8))
+ {
+ selectSeen = true;
+ reader.Read();
+
+ query.Select = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ query.Select.Add(reader.GetString());
+ }
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("where"u8))
+ {
+ whereSeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ query.Where = null;
+ }
+ else
+ {
+ query.Where = (IConstraint)PsmDeSerializationDispatcher.ReadResponse(ref reader, serializationModeKind, deserializeDerivedProperties, loggerFactory);
+ }
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!idSeen)
+ {
+ logger.LogDebug("the @id Json property was not found in the Query");
+ }
+
+ if (!aliasSeen)
+ {
+ logger.LogDebug("the alias Json property was not found in the Query");
+ }
+
+ if (!descriptionSeen)
+ {
+ logger.LogDebug("the description Json property was not found in the Query");
+ }
+
+ if (!nameSeen)
+ {
+ logger.LogDebug("the name Json property was not found in the Query");
+ }
+
+ if (!owningProjectSeen)
+ {
+ logger.LogDebug("the owningProject Json property was not found in the Query");
+ }
+
+ if (!selectSeen)
+ {
+ logger.LogDebug("the select Json property was not found in the Query");
+ }
+
+ if (!whereSeen)
+ {
+ logger.LogDebug("the where Json property was not found in the Query");
+ }
+
+ }
+
+ return query;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/QueryRequestDeSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/QueryRequestDeSerializer.cs
new file mode 100644
index 000000000..4cfb85b6c
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/QueryRequestDeSerializer.cs
@@ -0,0 +1,216 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class QueryRequestDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static QueryRequest DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("QueryRequestDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var queryRequest = new QueryRequest();
+
+ var aliasSeen = false;
+ var descriptionSeen = false;
+ var nameSeen = false;
+ var selectSeen = false;
+ var whereSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the QueryRequest json object.");
+ }
+
+ if (reader.ValueTextEquals("alias"u8))
+ {
+ aliasSeen = true;
+ reader.Read();
+
+ queryRequest.Alias = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ queryRequest.Alias.Add(reader.GetString());
+ }
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("description"u8))
+ {
+ descriptionSeen = true;
+ reader.Read();
+
+ queryRequest.Description = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("name"u8))
+ {
+ nameSeen = true;
+ reader.Read();
+
+ queryRequest.Name = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("select"u8))
+ {
+ selectSeen = true;
+ reader.Read();
+
+ queryRequest.Select = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ queryRequest.Select.Add(reader.GetString());
+ }
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("where"u8))
+ {
+ whereSeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ queryRequest.Where = null;
+ }
+ else
+ {
+ queryRequest.Where = (IConstraintRequest)PsmDeSerializationDispatcher.ReadRequest(ref reader, serializationModeKind, deserializeDerivedProperties, loggerFactory);
+ }
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!aliasSeen)
+ {
+ logger.LogDebug("the alias Json property was not found in the QueryRequest");
+ }
+
+ if (!descriptionSeen)
+ {
+ logger.LogDebug("the description Json property was not found in the QueryRequest");
+ }
+
+ if (!nameSeen)
+ {
+ logger.LogDebug("the name Json property was not found in the QueryRequest");
+ }
+
+ if (!selectSeen)
+ {
+ logger.LogDebug("the select Json property was not found in the QueryRequest");
+ }
+
+ if (!whereSeen)
+ {
+ logger.LogDebug("the where Json property was not found in the QueryRequest");
+ }
+
+ }
+
+ return queryRequest;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/RequestDeSerializationProvider.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/RequestDeSerializationProvider.cs
new file mode 100644
index 000000000..f7ff483eb
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/RequestDeSerializationProvider.cs
@@ -0,0 +1,99 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+
+ ///
+ /// Delegate provider for the appropriate deserialization method to deserialize a
+ ///
+ ///
+ /// A request and its counterpart in the other family share a @type discriminator, so the caller
+ /// states which family it expects rather than the payload declaring it.
+ ///
+ internal static class RequestDeSerializationProvider
+ {
+ ///
+ /// Caches the for the @type that is to be deserialized
+ ///
+ private static readonly Dictionary DeSerializerActionMap =
+ new Dictionary(StringComparer.OrdinalIgnoreCase)
+ {
+ { "Branch", BranchRequestDeSerializer.DeSerialize },
+ { "Commit", CommitRequestDeSerializer.DeSerialize },
+ { "CompositeConstraint", CompositeConstraintRequestDeSerializer.DeSerialize },
+ { "DataIdentity", DataIdentityRequestDeSerializer.DeSerialize },
+ { "DataVersion", DataVersionRequestDeSerializer.DeSerialize },
+ { "ExternalData", ExternalDataRequestDeSerializer.DeSerialize },
+ { "ExternalRelationship", ExternalRelationshipRequestDeSerializer.DeSerialize },
+ { "PrimitiveConstraint", PrimitiveConstraintRequestDeSerializer.DeSerialize },
+ { "Project", ProjectRequestDeSerializer.DeSerialize },
+ { "ProjectUsage", ProjectUsageRequestDeSerializer.DeSerialize },
+ { "Query", QueryRequestDeSerializer.DeSerialize },
+ { "Tag", TagRequestDeSerializer.DeSerialize },
+ };
+
+ ///
+ /// Provides the delegate that deserializes the specified @type
+ ///
+ ///
+ /// The @type that is to be deserialized
+ ///
+ ///
+ /// The delegate that deserializes the @type
+ ///
+ ///
+ /// Thrown when the @type is not supported
+ ///
+ internal static DeSerializeRequestDelegate Provide(string typeName)
+ {
+ if (!DeSerializerActionMap.TryGetValue(typeName, out var action))
+ {
+ throw new NotSupportedException($"The {typeName} is not supported by the RequestDeSerializationProvider.");
+ }
+
+ return action;
+ }
+
+ ///
+ /// Asserts whether the specified @type is supported by the provider
+ ///
+ ///
+ /// The @type for which support is asserted
+ ///
+ ///
+ /// True when the @type is supported
+ ///
+ internal static bool IsTypeSupported(string typeName)
+ {
+ return typeName != null && DeSerializerActionMap.ContainsKey(typeName);
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ResponseDeSerializationProvider.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ResponseDeSerializationProvider.cs
new file mode 100644
index 000000000..e20acb7fa
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/ResponseDeSerializationProvider.cs
@@ -0,0 +1,101 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+
+ ///
+ /// Delegate provider for the appropriate deserialization method to deserialize a
+ ///
+ ///
+ /// A response and its counterpart in the other family share a @type discriminator, so the caller
+ /// states which family it expects rather than the payload declaring it.
+ ///
+ internal static class ResponseDeSerializationProvider
+ {
+ ///
+ /// Caches the for the @type that is to be deserialized
+ ///
+ private static readonly Dictionary DeSerializerActionMap =
+ new Dictionary(StringComparer.OrdinalIgnoreCase)
+ {
+ { "Branch", BranchDeSerializer.DeSerialize },
+ { "Commit", CommitDeSerializer.DeSerialize },
+ { "CompositeConstraint", CompositeConstraintDeSerializer.DeSerialize },
+ { "DataDifference", DataDifferenceDeSerializer.DeSerialize },
+ { "DataIdentity", DataIdentityDeSerializer.DeSerialize },
+ { "DataVersion", DataVersionDeSerializer.DeSerialize },
+ { "Error", ErrorDeSerializer.DeSerialize },
+ { "ExternalData", ExternalDataDeSerializer.DeSerialize },
+ { "ExternalRelationship", ExternalRelationshipDeSerializer.DeSerialize },
+ { "PrimitiveConstraint", PrimitiveConstraintDeSerializer.DeSerialize },
+ { "Project", ProjectDeSerializer.DeSerialize },
+ { "ProjectUsage", ProjectUsageDeSerializer.DeSerialize },
+ { "Query", QueryDeSerializer.DeSerialize },
+ { "Tag", TagDeSerializer.DeSerialize },
+ };
+
+ ///
+ /// Provides the delegate that deserializes the specified @type
+ ///
+ ///
+ /// The @type that is to be deserialized
+ ///
+ ///
+ /// The delegate that deserializes the @type
+ ///
+ ///
+ /// Thrown when the @type is not supported
+ ///
+ internal static DeSerializeResponseDelegate Provide(string typeName)
+ {
+ if (!DeSerializerActionMap.TryGetValue(typeName, out var action))
+ {
+ throw new NotSupportedException($"The {typeName} is not supported by the ResponseDeSerializationProvider.");
+ }
+
+ return action;
+ }
+
+ ///
+ /// Asserts whether the specified @type is supported by the provider
+ ///
+ ///
+ /// The @type for which support is asserted
+ ///
+ ///
+ /// True when the @type is supported
+ ///
+ internal static bool IsTypeSupported(string typeName)
+ {
+ return typeName != null && DeSerializerActionMap.ContainsKey(typeName);
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/TagDeSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/TagDeSerializer.cs
new file mode 100644
index 000000000..a21dde117
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/TagDeSerializer.cs
@@ -0,0 +1,296 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class TagDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static Tag DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("TagDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var tag = new Tag();
+
+ var idSeen = false;
+ var aliasSeen = false;
+ var createdSeen = false;
+ var deletedSeen = false;
+ var descriptionSeen = false;
+ var nameSeen = false;
+ var owningProjectSeen = false;
+ var referencedCommitSeen = false;
+ var taggedCommitSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the Tag json object.");
+ }
+
+ if (reader.ValueTextEquals("@id"u8))
+ {
+ idSeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ throw new JsonException("The @id property is null, the Tag cannot be deserialized");
+ }
+
+ tag.Id = Utf8JsonReaderHelper.ReadGuid(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("alias"u8))
+ {
+ aliasSeen = true;
+ reader.Read();
+
+ tag.Alias = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ tag.Alias.Add(reader.GetString());
+ }
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("created"u8))
+ {
+ createdSeen = true;
+ reader.Read();
+
+ tag.Created = Utf8JsonReaderHelper.ReadDateTimeIso8601(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("deleted"u8))
+ {
+ deletedSeen = true;
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ tag.Deleted = null;
+ }
+ else
+ {
+ tag.Deleted = Utf8JsonReaderHelper.ReadDateTimeIso8601(ref reader);
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("description"u8))
+ {
+ descriptionSeen = true;
+ reader.Read();
+
+ tag.Description = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("name"u8))
+ {
+ nameSeen = true;
+ reader.Read();
+
+ tag.Name = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("owningProject"u8))
+ {
+ owningProjectSeen = true;
+ reader.Read();
+
+ if (Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var owningProjectValue))
+ {
+ tag.OwningProject = owningProjectValue;
+ }
+ else if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the Tag.owningProject reference is null, the value is left at Guid.Empty");
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("referencedCommit"u8))
+ {
+ referencedCommitSeen = true;
+ reader.Read();
+
+ if (Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var referencedCommitValue))
+ {
+ tag.ReferencedCommit = referencedCommitValue;
+ }
+ else if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the Tag.referencedCommit reference is null, the value is left at Guid.Empty");
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("taggedCommit"u8))
+ {
+ taggedCommitSeen = true;
+ reader.Read();
+
+ if (Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var taggedCommitValue))
+ {
+ tag.TaggedCommit = taggedCommitValue;
+ }
+ else if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the Tag.taggedCommit reference is null, the value is left at Guid.Empty");
+ }
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!idSeen)
+ {
+ logger.LogDebug("the @id Json property was not found in the Tag");
+ }
+
+ if (!aliasSeen)
+ {
+ logger.LogDebug("the alias Json property was not found in the Tag");
+ }
+
+ if (!createdSeen)
+ {
+ logger.LogDebug("the created Json property was not found in the Tag");
+ }
+
+ if (!deletedSeen)
+ {
+ logger.LogDebug("the deleted Json property was not found in the Tag");
+ }
+
+ if (!descriptionSeen)
+ {
+ logger.LogDebug("the description Json property was not found in the Tag");
+ }
+
+ if (!nameSeen)
+ {
+ logger.LogDebug("the name Json property was not found in the Tag");
+ }
+
+ if (!owningProjectSeen)
+ {
+ logger.LogDebug("the owningProject Json property was not found in the Tag");
+ }
+
+ if (!referencedCommitSeen)
+ {
+ logger.LogDebug("the referencedCommit Json property was not found in the Tag");
+ }
+
+ if (!taggedCommitSeen)
+ {
+ logger.LogDebug("the taggedCommit Json property was not found in the Tag");
+ }
+
+ }
+
+ return tag;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/TagRequestDeSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/TagRequestDeSerializer.cs
new file mode 100644
index 000000000..2dd049dd3
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenDeSerializer/TagRequestDeSerializer.cs
@@ -0,0 +1,190 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+ using Microsoft.Extensions.Logging.Abstractions;
+
+ using SysML2.NET.Extensions.PSM;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+ using SysML2.NET.Serializer.Json;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to provide deserialization capabilities
+ /// for the class
+ ///
+ internal static class TagRequestDeSerializer
+ {
+ ///
+ /// Deserializes an instance of from the provided
+ ///
+ ///
+ /// The positioned on the of the
+ /// json object. On return the reader is positioned on the matching
+ ///
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the serialization mode is not supported
+ ///
+ ///
+ /// The @type property is the discriminator that the caller dispatched on, so it is skipped rather
+ /// than re-validated here
+ ///
+ internal static TagRequest DeSerialize(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory = null)
+ {
+ if (serializationModeKind != SerializationModeKind.JSON)
+ {
+ throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
+ }
+
+ var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("TagRequestDeSerializer");
+
+ Utf8JsonReaderHelper.Expect(ref reader, JsonTokenType.StartObject);
+
+ var tagRequest = new TagRequest();
+
+ var aliasSeen = false;
+ var descriptionSeen = false;
+ var nameSeen = false;
+ var taggedCommitSeen = false;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.TokenType != JsonTokenType.PropertyName)
+ {
+ throw new JsonException("Expected a property name in the TagRequest json object.");
+ }
+
+ if (reader.ValueTextEquals("alias"u8))
+ {
+ aliasSeen = true;
+ reader.Read();
+
+ tagRequest.Alias = new List();
+
+ if (reader.TokenType != JsonTokenType.Null)
+ {
+ Utf8JsonReaderHelper.ExpectArrayStart(ref reader);
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
+ {
+ tagRequest.Alias.Add(reader.GetString());
+ }
+ }
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("description"u8))
+ {
+ descriptionSeen = true;
+ reader.Read();
+
+ tagRequest.Description = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("name"u8))
+ {
+ nameSeen = true;
+ reader.Read();
+
+ tagRequest.Name = Utf8JsonReaderHelper.ReadStringOrNull(ref reader);
+
+ continue;
+ }
+
+ if (reader.ValueTextEquals("taggedCommit"u8))
+ {
+ taggedCommitSeen = true;
+ reader.Read();
+
+ if (Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var taggedCommitValue))
+ {
+ tagRequest.TaggedCommit = taggedCommitValue;
+ }
+ else if (logger.IsEnabled(LogLevel.Debug))
+ {
+ logger.LogDebug("the TagRequest.taggedCommit reference is null, the value is left at Guid.Empty");
+ }
+
+ continue;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ if (logger.IsEnabled(LogLevel.Debug))
+ {
+ if (!aliasSeen)
+ {
+ logger.LogDebug("the alias Json property was not found in the TagRequest");
+ }
+
+ if (!descriptionSeen)
+ {
+ logger.LogDebug("the description Json property was not found in the TagRequest");
+ }
+
+ if (!nameSeen)
+ {
+ logger.LogDebug("the name Json property was not found in the TagRequest");
+ }
+
+ if (!taggedCommitSeen)
+ {
+ logger.LogDebug("the taggedCommit Json property was not found in the TagRequest");
+ }
+
+ }
+
+ return tagRequest;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
+// ------------------------------------------------------------------------------------------------
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/BranchRequestSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/BranchRequestSerializer.cs
index 60c8d3f90..a1c261412 100644
--- a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/BranchRequestSerializer.cs
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/BranchRequestSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/BranchSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/BranchSerializer.cs
index 704b4d2e3..373ab81d4 100644
--- a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/BranchSerializer.cs
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/BranchSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/CommitRequestSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/CommitRequestSerializer.cs
index 844f0fa99..c8dcba9d2 100644
--- a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/CommitRequestSerializer.cs
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/CommitRequestSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/CommitSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/CommitSerializer.cs
index 7a1246f76..87843fbb5 100644
--- a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/CommitSerializer.cs
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/CommitSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/CompositeConstraintRequestSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/CompositeConstraintRequestSerializer.cs
index 5fc1ac5a7..1f59ca794 100644
--- a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/CompositeConstraintRequestSerializer.cs
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/CompositeConstraintRequestSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
@@ -86,7 +87,7 @@ internal static void Serialize(object obj, Utf8JsonWriter writer, SerializationM
writer.WriteEndArray();
- writer.WriteString("operator"u8, compositeConstraintRequest.Operator.ToWireValue());
+ writer.WriteString("operator"u8, CompositeConstraintRequestOperatorProvider.ToUtf8Bytes(compositeConstraintRequest.Operator));
writer.WriteEndObject();
}
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/CompositeConstraintSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/CompositeConstraintSerializer.cs
index 324e9a164..7cfd84c6a 100644
--- a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/CompositeConstraintSerializer.cs
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/CompositeConstraintSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
@@ -86,7 +87,7 @@ internal static void Serialize(object obj, Utf8JsonWriter writer, SerializationM
writer.WriteEndArray();
- writer.WriteString("operator"u8, compositeConstraint.Operator.ToWireValue());
+ writer.WriteString("operator"u8, CompositeConstraintOperatorProvider.ToUtf8Bytes(compositeConstraint.Operator));
writer.WriteEndObject();
}
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/DataDifferenceSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/DataDifferenceSerializer.cs
index 655b57f46..511eae5fa 100644
--- a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/DataDifferenceSerializer.cs
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/DataDifferenceSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/DataIdentityRequestSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/DataIdentityRequestSerializer.cs
index 150babab2..2bf84f695 100644
--- a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/DataIdentityRequestSerializer.cs
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/DataIdentityRequestSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/DataIdentitySerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/DataIdentitySerializer.cs
index bd3678842..6ce27f6f9 100644
--- a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/DataIdentitySerializer.cs
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/DataIdentitySerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/DataVersionRequestSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/DataVersionRequestSerializer.cs
index 720c3a700..b1a259f2b 100644
--- a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/DataVersionRequestSerializer.cs
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/DataVersionRequestSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/DataVersionSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/DataVersionSerializer.cs
index d6626e911..2b4ed8cba 100644
--- a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/DataVersionSerializer.cs
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/DataVersionSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ErrorSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ErrorSerializer.cs
index 64dbda711..1ccda62b4 100644
--- a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ErrorSerializer.cs
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ErrorSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ExternalDataRequestSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ExternalDataRequestSerializer.cs
index 13f34cad5..7ba54693a 100644
--- a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ExternalDataRequestSerializer.cs
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ExternalDataRequestSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ExternalDataSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ExternalDataSerializer.cs
index f08509d33..f49e2e0ed 100644
--- a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ExternalDataSerializer.cs
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ExternalDataSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ExternalRelationshipRequestSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ExternalRelationshipRequestSerializer.cs
index 6ee28e9c8..97e5a058b 100644
--- a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ExternalRelationshipRequestSerializer.cs
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ExternalRelationshipRequestSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ExternalRelationshipSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ExternalRelationshipSerializer.cs
index 02633cc22..20956bcd5 100644
--- a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ExternalRelationshipSerializer.cs
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ExternalRelationshipSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/PrimitiveConstraintRequestSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/PrimitiveConstraintRequestSerializer.cs
index 527ae31bc..f11cd182f 100644
--- a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/PrimitiveConstraintRequestSerializer.cs
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/PrimitiveConstraintRequestSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
@@ -83,7 +84,7 @@ internal static void Serialize(object obj, Utf8JsonWriter writer, SerializationM
writer.WriteNull("inverse"u8);
}
- writer.WriteString("operator"u8, primitiveConstraintRequest.Operator.ToWireValue());
+ writer.WriteString("operator"u8, PrimitiveConstraintRequestOperatorProvider.ToUtf8Bytes(primitiveConstraintRequest.Operator));
writer.WriteString("property"u8, primitiveConstraintRequest.Property);
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/PrimitiveConstraintSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/PrimitiveConstraintSerializer.cs
index 951412f28..e1f67b556 100644
--- a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/PrimitiveConstraintSerializer.cs
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/PrimitiveConstraintSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
@@ -76,7 +77,7 @@ internal static void Serialize(object obj, Utf8JsonWriter writer, SerializationM
writer.WriteBoolean("inverse"u8, primitiveConstraint.Inverse);
- writer.WriteString("operator"u8, primitiveConstraint.Operator.ToWireValue());
+ writer.WriteString("operator"u8, PrimitiveConstraintOperatorProvider.ToUtf8Bytes(primitiveConstraint.Operator));
writer.WriteString("property"u8, primitiveConstraint.Property);
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ProjectRequestSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ProjectRequestSerializer.cs
index b0f5a6578..5da20bf5d 100644
--- a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ProjectRequestSerializer.cs
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ProjectRequestSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ProjectSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ProjectSerializer.cs
index 89e8c6b04..d07fc185b 100644
--- a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ProjectSerializer.cs
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ProjectSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ProjectUsageRequestSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ProjectUsageRequestSerializer.cs
index 4fb3d5b69..feb440e40 100644
--- a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ProjectUsageRequestSerializer.cs
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ProjectUsageRequestSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ProjectUsageSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ProjectUsageSerializer.cs
index bf8585582..5987b23b3 100644
--- a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ProjectUsageSerializer.cs
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ProjectUsageSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/QueryRequestSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/QueryRequestSerializer.cs
index 28b209fcf..0b9d88165 100644
--- a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/QueryRequestSerializer.cs
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/QueryRequestSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/QuerySerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/QuerySerializer.cs
index 6f0e6e57c..1c59e9c96 100644
--- a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/QuerySerializer.cs
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/QuerySerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/TagRequestSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/TagRequestSerializer.cs
index 1883145fe..9b56af865 100644
--- a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/TagRequestSerializer.cs
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/TagRequestSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
diff --git a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/TagSerializer.cs b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/TagSerializer.cs
index 295e74a41..79cc56434 100644
--- a/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/TagSerializer.cs
+++ b/SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/TagSerializer.cs
@@ -27,6 +27,7 @@ namespace SysML2.NET.Serializer.Json.PSM
using System;
using System.Text.Json;
+ using SysML2.NET.Extensions.PSM;
using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;
diff --git a/SysML2.NET.Serializer.Json/PSM/ConstraintValueReader.cs b/SysML2.NET.Serializer.Json/PSM/ConstraintValueReader.cs
new file mode 100644
index 000000000..0659e4e1c
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/ConstraintValueReader.cs
@@ -0,0 +1,77 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System.Text.Json;
+
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// The purpose of the is to read a from JSON
+ ///
+ ///
+ /// Each alternative occupies a distinct JSON token type, so the token alone discriminates.
+ ///
+ internal static class ConstraintValueReader
+ {
+ ///
+ /// Reads a from the provided
+ ///
+ ///
+ /// The positioned on the value token
+ ///
+ ///
+ /// The that the token represents
+ ///
+ ///
+ /// Thrown when the token represents none of the alternatives
+ ///
+ internal static ConstraintValue Read(ref Utf8JsonReader reader)
+ {
+ switch (reader.TokenType)
+ {
+ case JsonTokenType.Null:
+ return ConstraintValue.Null;
+
+ case JsonTokenType.True:
+ return ConstraintValue.From(true);
+
+ case JsonTokenType.False:
+ return ConstraintValue.From(false);
+
+ case JsonTokenType.Number:
+ return ConstraintValue.From(reader.GetDouble());
+
+ case JsonTokenType.String:
+ return ConstraintValue.From(reader.GetString());
+
+ case JsonTokenType.StartObject:
+ return Utf8JsonReaderHelper.TryReadReferenceIdentifier(ref reader, out var identifier)
+ ? ConstraintValue.From(identifier)
+ : ConstraintValue.Null;
+
+ default:
+ throw new JsonException($"A ConstraintValue cannot be read from a {reader.TokenType} token.");
+ }
+ }
+ }
+}
diff --git a/SysML2.NET.Serializer.Json/PSM/DeSerializeRequestDelegate.cs b/SysML2.NET.Serializer.Json/PSM/DeSerializeRequestDelegate.cs
new file mode 100644
index 000000000..9bc0a32bd
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/DeSerializeRequestDelegate.cs
@@ -0,0 +1,54 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+
+ using SysML2.NET.PSM.DTO;
+
+ ///
+ /// Deserializes a single from the provided .
+ ///
+ ///
+ /// The positioned on the of the json
+ /// object to deserialize. On return the reader is positioned on the matching
+ /// .
+ ///
+ ///
+ /// The to use.
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored.
+ ///
+ ///
+ /// The used to setup logging.
+ ///
+ ///
+ /// An instance of .
+ ///
+ ///
+ /// A named delegate is required rather than a because
+ /// cannot express a parameter.
+ ///
+ internal delegate IRequest DeSerializeRequestDelegate(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory);
+}
diff --git a/SysML2.NET.Serializer.Json/PSM/DeSerializeResponseDelegate.cs b/SysML2.NET.Serializer.Json/PSM/DeSerializeResponseDelegate.cs
new file mode 100644
index 000000000..efe92c455
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/DeSerializeResponseDelegate.cs
@@ -0,0 +1,54 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+
+ using SysML2.NET.PSM.DTO;
+
+ ///
+ /// Deserializes a single from the provided .
+ ///
+ ///
+ /// The positioned on the of the json
+ /// object to deserialize. On return the reader is positioned on the matching
+ /// .
+ ///
+ ///
+ /// The to use.
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored.
+ ///
+ ///
+ /// The used to setup logging.
+ ///
+ ///
+ /// An instance of .
+ ///
+ ///
+ /// A named delegate is required rather than a because
+ /// cannot express a parameter.
+ ///
+ internal delegate IResponse DeSerializeResponseDelegate(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory);
+}
diff --git a/SysML2.NET.Serializer.Json/PSM/PsmDeSerializationDispatcher.cs b/SysML2.NET.Serializer.Json/PSM/PsmDeSerializationDispatcher.cs
new file mode 100644
index 000000000..193721f77
--- /dev/null
+++ b/SysML2.NET.Serializer.Json/PSM/PsmDeSerializationDispatcher.cs
@@ -0,0 +1,192 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.Json.PSM
+{
+ using System.Runtime.Serialization;
+ using System.Text.Json;
+
+ using Microsoft.Extensions.Logging;
+
+ using SysML2.NET.Common;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.Serializer.Json.Utility;
+
+ ///
+ /// Resolves the deserialization method of a payload that may be a Systems Modeling API and Services data
+ /// transfer object or a SysML Core element
+ ///
+ ///
+ /// The Data union admits Element alongside the Systems Modeling API and Services types, so a payload is
+ /// resolved against both providers.
+ ///
+ internal static class PsmDeSerializationDispatcher
+ {
+ ///
+ /// Deserializes the json object that the reader is positioned on to an
+ ///
+ ///
+ /// The positioned on the of the payload
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the payload carries no @type discriminator
+ ///
+ internal static IData ReadData(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory)
+ {
+ var typeName = ReadTypeName(reader);
+
+ if (ResponseDeSerializationProvider.IsTypeSupported(typeName))
+ {
+ var response = ResponseDeSerializationProvider.Provide(typeName)(ref reader, serializationModeKind, deserializeDerivedProperties, loggerFactory);
+
+ return response as IData ?? throw new SerializationException($"A {typeName} cannot be carried as a Data payload.");
+ }
+
+ return SysML2.NET.Serializer.Json.Core.DTO.DeSerializationProvider.Provide(typeName)(ref reader, serializationModeKind, deserializeDerivedProperties, loggerFactory);
+ }
+
+ ///
+ /// Deserializes the json object that the reader is positioned on to an
+ ///
+ ///
+ /// The positioned on the of the payload
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the payload carries no @type discriminator
+ ///
+ internal static IDataRequest ReadDataRequest(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory)
+ {
+ var typeName = ReadTypeName(reader);
+
+ if (RequestDeSerializationProvider.IsTypeSupported(typeName))
+ {
+ var request = RequestDeSerializationProvider.Provide(typeName)(ref reader, serializationModeKind, deserializeDerivedProperties, loggerFactory);
+
+ return request as IDataRequest ?? throw new SerializationException($"A {typeName} cannot be carried as a DataRequest payload.");
+ }
+
+ var element = SysML2.NET.Serializer.Json.Core.DTO.DeSerializationProvider.Provide(typeName)(ref reader, serializationModeKind, deserializeDerivedProperties, loggerFactory);
+
+ return element as IDataRequest ?? throw new SerializationException($"A {typeName} cannot be carried as a DataRequest payload.");
+ }
+
+ ///
+ /// Deserializes the json object that the reader is positioned on to an
+ ///
+ ///
+ /// The positioned on the of the object
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the object carries no @type discriminator
+ ///
+ internal static IResponse ReadResponse(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory)
+ {
+ var typeName = ReadTypeName(reader);
+
+ return ResponseDeSerializationProvider.Provide(typeName)(ref reader, serializationModeKind, deserializeDerivedProperties, loggerFactory);
+ }
+
+ ///
+ /// Deserializes the json object that the reader is positioned on to an
+ ///
+ ///
+ /// The positioned on the of the object
+ ///
+ ///
+ /// enumeration specifying what kind of serialization shall be used
+ ///
+ ///
+ /// Asserts that the deserializer should deserialize derived properties if present or if they are ignored
+ ///
+ ///
+ /// The used to setup logging
+ ///
+ ///
+ /// an instance of
+ ///
+ ///
+ /// Thrown when the object carries no @type discriminator
+ ///
+ internal static IRequest ReadRequest(ref Utf8JsonReader reader, SerializationModeKind serializationModeKind, bool deserializeDerivedProperties, ILoggerFactory loggerFactory)
+ {
+ var typeName = ReadTypeName(reader);
+
+ return RequestDeSerializationProvider.Provide(typeName)(ref reader, serializationModeKind, deserializeDerivedProperties, loggerFactory);
+ }
+
+ ///
+ /// Reads ahead for the @type discriminator of the json object that the reader is positioned on
+ ///
+ ///
+ /// A copy of the , positioned on the
+ ///
+ ///
+ /// The value of the @type property
+ ///
+ ///
+ /// Thrown when the object carries no @type discriminator
+ ///
+ private static string ReadTypeName(Utf8JsonReader reader)
+ {
+ if (!Utf8JsonReaderHelper.TryPeekTypeName(reader, out var typeName) || string.IsNullOrWhiteSpace(typeName))
+ {
+ throw new SerializationException("The @type Json property is not available, the payload cannot be deserialized");
+ }
+
+ return typeName;
+ }
+ }
+}
diff --git a/SysML2.NET.Serializer.Json/SysML2.NET.Serializer.Json.csproj b/SysML2.NET.Serializer.Json/SysML2.NET.Serializer.Json.csproj
index a2f04fdae..09e955d27 100644
--- a/SysML2.NET.Serializer.Json/SysML2.NET.Serializer.Json.csproj
+++ b/SysML2.NET.Serializer.Json/SysML2.NET.Serializer.Json.csproj
@@ -1,40 +1,40 @@
-
-
-
- netstandard2.1;net10.0
- 12.0
- 0.23.0
- A .NET implementation of the OMG SysML v2 JSON serializer.
- SysML2.NET.Serializer.Json
- Starion Group S.A.
- Copyright © Starion Group S.A.
- Apache-2.0
- https://github.com/STARIONGROUP/SysML2.NET.git
- Git
- Sam Gerené
- true
-
- [Update] Deserializers rewritten to read directly from a Utf8JsonReader (#352) - no JsonDocument is materialised at any point, roughly twice as fast with half the allocation on a 100 000 element payload. Deserialized content is unchanged
- [Update] Aligned with SysML2.NET 0.23.0
-
- cdp4-icon.png
- README.md
- true
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ netstandard2.1;net10.0
+ 14.0
+ 0.23.0
+ A .NET implementation of the OMG SysML v2 JSON serializer.
+ SysML2.NET.Serializer.Json
+ Starion Group S.A.
+ Copyright © Starion Group S.A.
+ Apache-2.0
+ https://github.com/STARIONGROUP/SysML2.NET.git
+ Git
+ Sam Gerené
+ true
+
+ [Update] Deserializers rewritten to read directly from a Utf8JsonReader (#352) - no JsonDocument is materialised at any point, roughly twice as fast with half the allocation on a 100 000 element payload. Deserialized content is unchanged
+ [Update] Aligned with SysML2.NET 0.23.0
+
+ cdp4-icon.png
+ README.md
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SysML2.NET.Serializer.Json/Utility/Utf8JsonReaderHelper.cs b/SysML2.NET.Serializer.Json/Utility/Utf8JsonReaderHelper.cs
index 132b2bf92..9668e3e06 100644
--- a/SysML2.NET.Serializer.Json/Utility/Utf8JsonReaderHelper.cs
+++ b/SysML2.NET.Serializer.Json/Utility/Utf8JsonReaderHelper.cs
@@ -253,6 +253,59 @@ public static bool TryReadReferenceIdentifier(ref Utf8JsonReader reader, out Gui
return found;
}
+ ///
+ /// Reads ahead for the @type discriminator of the json object that the reader is positioned on.
+ ///
+ ///
+ /// A copy of the , positioned on the
+ /// of the json object.
+ ///
+ ///
+ /// The value of the @type property, which is null when the property is present but null.
+ ///
+ ///
+ /// true when the object carries a @type property, false otherwise.
+ ///
+ ///
+ /// Thrown when the @type property is neither a string nor null.
+ ///
+ ///
+ /// The reader is taken by value on purpose: is a struct, so the copy is a
+ /// free snapshot and the caller's reader stays parked on the .
+ /// The SysML v2 API does not guarantee that @type comes first, so the scan tolerates any position.
+ ///
+ public static bool TryPeekTypeName(Utf8JsonReader reader, out string typeName)
+ {
+ typeName = null;
+
+ while (reader.Read() && reader.TokenType != JsonTokenType.EndObject)
+ {
+ if (reader.ValueTextEquals("@type"u8))
+ {
+ reader.Read();
+
+ if (reader.TokenType == JsonTokenType.Null)
+ {
+ return true;
+ }
+
+ if (reader.TokenType != JsonTokenType.String)
+ {
+ throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{reader.TokenType}'.");
+ }
+
+ typeName = reader.GetString();
+
+ return true;
+ }
+
+ reader.Read();
+ reader.Skip();
+ }
+
+ return false;
+ }
+
///
/// Asserts that the reader is positioned on the start of an array.
///
diff --git a/SysML2.NET.Serializer.MessagePack.Tests/PsmSerializerTestFixture.cs b/SysML2.NET.Serializer.MessagePack.Tests/PsmSerializerTestFixture.cs
new file mode 100644
index 000000000..764cd0d72
--- /dev/null
+++ b/SysML2.NET.Serializer.MessagePack.Tests/PsmSerializerTestFixture.cs
@@ -0,0 +1,445 @@
+// -------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+namespace SysML2.NET.Serializer.MessagePack.Tests
+{
+ using System;
+ using System.Buffers;
+ using System.Collections.Generic;
+ using System.IO;
+ using System.Linq;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ using NUnit.Framework;
+
+ using SysML2.NET.Core.Core.Types;
+ using SysML2.NET.Core.DTO.Core.Features;
+ using SysML2.NET.PSM.DTO;
+ using SysML2.NET.PSM.Enumerations;
+
+ [TestFixture]
+ public class PsmSerializerTestFixture
+ {
+ private static readonly Guid ProjectIdentifier = Guid.Parse("9b0e1914-3241-461e-b9ee-a3ff5120de4e");
+
+ private static readonly Guid BranchIdentifier = Guid.Parse("a910a705-7fbe-415f-9cbb-624bfadf6c20");
+
+ private static readonly Guid DataVersionIdentifier = Guid.Parse("94e5b40e-741e-49ca-bd7f-f3138c071bf9");
+
+ private static readonly Guid ElementIdentifier = Guid.Parse("00a6ef10-d3dc-4741-9029-2c9978c2f083");
+
+ private MessagePack.Serializer serializer;
+
+ private MessagePack.DeSerializer deSerializer;
+
+ [SetUp]
+ public void SetUp()
+ {
+ this.serializer = new MessagePack.Serializer();
+ this.deSerializer = new MessagePack.DeSerializer();
+ }
+
+ [Test]
+ public void VerifyRoundTrip()
+ {
+ var dataVersion = new DataVersion
+ {
+ Id = DataVersionIdentifier,
+ Alias = ["first", "second"],
+ Description = "the description",
+ Name = "the name",
+ Identity = new DataIdentity { Id = ElementIdentifier, Alias = ["identity alias"], Name = "the identity" },
+ Payload = CreateCoreFeature()
+ };
+
+ var project = new Project
+ {
+ Id = ProjectIdentifier,
+ Alias = ["alias"],
+ Created = new DateTime(1976, 8, 20, 13, 45, 56, DateTimeKind.Utc),
+ DefaultBranch = BranchIdentifier,
+ Description = "the project",
+ Name = "the project name"
+ };
+
+ var constraint = new PrimitiveConstraint
+ {
+ Inverse = true,
+ Operator = PrimitiveConstraintOperator.lessthanorequalto,
+ Property = "created",
+ Value =
+ [
+ ConstraintValue.From(true),
+ ConstraintValue.From(1.5),
+ ConstraintValue.From("text"),
+ ConstraintValue.From(ProjectIdentifier),
+ ConstraintValue.Null
+ ]
+ };
+
+ var composite = new CompositeConstraint
+ {
+ Operator = CompositeConstraintOperator.and,
+ Constraint = [constraint]
+ };
+
+ List responses = [project, dataVersion, constraint, composite];
+
+ using var responseStream = new MemoryStream();
+
+ this.serializer.SerializeResponse(responses, responseStream);
+ responseStream.Position = 0;
+
+ var roundTrippedResponses = this.deSerializer.DeSerializeResponse(responseStream).ToList();
+
+ var roundTrippedDataVersion = roundTrippedResponses.OfType().Single();
+
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(roundTrippedResponses, Has.Count.EqualTo(4));
+ Assert.That(roundTrippedResponses.OfType().Single(), Is.EqualTo(project).UsingPropertiesComparer());
+ Assert.That(roundTrippedDataVersion, Is.EqualTo(dataVersion).UsingPropertiesComparer());
+ Assert.That(roundTrippedResponses.OfType().Single(), Is.EqualTo(constraint).UsingPropertiesComparer());
+ Assert.That(roundTrippedResponses.OfType().Single(), Is.EqualTo(composite).UsingPropertiesComparer());
+
+ Assert.That(roundTrippedDataVersion.Payload, Is.TypeOf());
+ Assert.That(roundTrippedDataVersion.Payload, Is.EqualTo(dataVersion.Payload).UsingPropertiesComparer());
+ Assert.That(roundTrippedDataVersion.Identity, Is.EqualTo(dataVersion.Identity).UsingPropertiesComparer());
+ }
+
+ var dataVersionRequest = new DataVersionRequest
+ {
+ Identity = new DataIdentityRequest { Alias = ["identity alias"], Name = "the identity" },
+ Payload = CreateCoreFeature()
+ };
+
+ var projectRequest = new ProjectRequest
+ {
+ Alias = ["only"],
+ DefaultBranch = BranchIdentifier,
+ Name = "the name"
+ };
+
+ List requests = [projectRequest, dataVersionRequest];
+
+ using var requestStream = new MemoryStream();
+
+ this.serializer.SerializeRequest(requests, requestStream);
+ requestStream.Position = 0;
+
+ var roundTrippedRequests = this.deSerializer.DeSerializeRequest(requestStream).ToList();
+
+ var roundTrippedDataVersionRequest = roundTrippedRequests.OfType().Single();
+
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(roundTrippedRequests, Has.Count.EqualTo(2));
+ Assert.That(roundTrippedRequests.OfType().Single(), Is.EqualTo(projectRequest).UsingPropertiesComparer());
+ Assert.That(roundTrippedDataVersionRequest, Is.EqualTo(dataVersionRequest).UsingPropertiesComparer());
+
+ Assert.That(roundTrippedDataVersionRequest.Payload, Is.TypeOf());
+ Assert.That(roundTrippedDataVersionRequest.Payload, Is.EqualTo(dataVersionRequest.Payload).UsingPropertiesComparer());
+ }
+
+ var divergent = this.deSerializer.DeSerializeResponse(this.Rewind(responses)).ToList();
+ ((Feature)divergent.OfType().Single().Payload).DeclaredName = "a different name";
+
+ var divergentIdentity = this.deSerializer.DeSerializeResponse(this.Rewind(responses)).ToList();
+ divergentIdentity.OfType().Single().Identity.Alias.Add("an extra alias");
+
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(divergent.OfType().Single(), Is.Not.EqualTo(dataVersion).UsingPropertiesComparer());
+ Assert.That(divergentIdentity.OfType().Single(), Is.Not.EqualTo(dataVersion).UsingPropertiesComparer());
+ }
+ }
+
+ [Test]
+ public async Task VerifyRoundTripAsync()
+ {
+ var project = new Project { Id = ProjectIdentifier, Name = "the name" };
+ var projectRequest = new ProjectRequest { Name = "the name" };
+
+ using var responseStream = new MemoryStream();
+
+ await this.serializer.SerializeResponseAsync([project], responseStream, CancellationToken.None);
+ responseStream.Position = 0;
+
+ var roundTrippedResponses = await this.deSerializer.DeSerializeResponseAsync(responseStream, CancellationToken.None);
+
+ using var requestStream = new MemoryStream();
+
+ await this.serializer.SerializeRequestAsync([projectRequest], requestStream, CancellationToken.None);
+ requestStream.Position = 0;
+
+ var roundTrippedRequests = await this.deSerializer.DeSerializeRequestAsync(requestStream, CancellationToken.None);
+
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(() => this.deSerializer.DeSerializeResponse(null), Throws.TypeOf());
+ Assert.That(() => this.deSerializer.DeSerializeRequest(null), Throws.TypeOf());
+ Assert.That(roundTrippedResponses.OfType().Single(), Is.EqualTo(project).UsingPropertiesComparer());
+ Assert.That(roundTrippedRequests.OfType().Single(), Is.EqualTo(projectRequest).UsingPropertiesComparer());
+ }
+ }
+
+ private static Feature CreateCoreFeature()
+ {
+ return new Feature
+ {
+ Id = ElementIdentifier,
+ AliasIds = ["core alias"],
+ DeclaredName = "the feature",
+ DeclaredShortName = "f",
+ Direction = FeatureDirectionKind.Inout,
+ ElementId = ElementIdentifier.ToString(),
+ IsAbstract = true,
+ IsUnique = false,
+ OwnedRelationship = [BranchIdentifier],
+ OwningRelationship = ProjectIdentifier
+ };
+ }
+
+ private MemoryStream Rewind(IEnumerable responses)
+ {
+ var stream = new MemoryStream();
+
+ this.serializer.SerializeResponse(responses, stream);
+ stream.Position = 0;
+
+ return stream;
+ }
+
+ [Test]
+ public void VerifySerializeResponse()
+ {
+ var project = new Project
+ {
+ Id = ProjectIdentifier,
+ Alias = ["first", "second"],
+ Created = new DateTime(1976, 8, 20, 13, 45, 56, DateTimeKind.Utc),
+ DefaultBranch = BranchIdentifier,
+ Description = "the description",
+ Name = "the name"
+ };
+
+ var constraint = new PrimitiveConstraint
+ {
+ Inverse = true,
+ Operator = PrimitiveConstraintOperator.lessthan,
+ Property = "created",
+ Value =
+ [
+ ConstraintValue.From(true),
+ ConstraintValue.From(1.5),
+ ConstraintValue.From("text"),
+ ConstraintValue.From(ProjectIdentifier),
+ ConstraintValue.Null
+ ]
+ };
+
+ var composite = new CompositeConstraint
+ {
+ Operator = CompositeConstraintOperator.and,
+ Constraint = [constraint]
+ };
+
+ using (Assert.EnterMultipleScope())
+ {
+ Assert.That(() => this.serializer.SerializeResponse(null, new MemoryStream()), Throws.TypeOf());
+ Assert.That(() => this.serializer.SerializeResponse([project], null), Throws.TypeOf