diff --git a/BO4E/BO/BusinessObject.cs b/BO4E/BO/BusinessObject.cs index 48e1621d..b2b0fdb3 100644 --- a/BO4E/BO/BusinessObject.cs +++ b/BO4E/BO/BusinessObject.cs @@ -6,6 +6,7 @@ using System.Text.Json.Serialization; using BO4E.COM; using BO4E.meta; +using BO4E.meta.LenientConverters; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Schema; @@ -147,6 +148,7 @@ public string? BoTyp [JsonPropertyName("versionStruktur")] [JsonPropertyOrder(2)] [ProtoMember(2)] + [System.Text.Json.Serialization.JsonConverter(typeof(AutoNumberToStringConverter))] public string? VersionStruktur { get; set; } /// diff --git a/BO4ETestProject/TestAutoNumberConverter.cs b/BO4ETestProject/TestAutoNumberConverter.cs index 6c4c0f1a..a117409a 100644 --- a/BO4ETestProject/TestAutoNumberConverter.cs +++ b/BO4ETestProject/TestAutoNumberConverter.cs @@ -1,6 +1,7 @@ using System.IO; using BO4E.BO; using BO4E.meta.LenientConverters; +using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using JsonSerializer = System.Text.Json.JsonSerializer; @@ -23,4 +24,13 @@ public void TestConverter() var vertrag = JsonSerializer.Deserialize(jsonString, options); Assert.IsNotNull(vertrag); } + + [TestMethod] + [DataRow("{\"versionStruktur\": \"12\"}")] + [DataRow("{\"versionStruktur\": 12}")] + public void Test_Annotation_STJ(string jsonString) + { + var malo = System.Text.Json.JsonSerializer.Deserialize(jsonString); + malo.Should().NotBeNull().And.Subject.As().VersionStruktur.Should().Be("12"); + } }