diff --git a/src/LEGO.AsyncAPI/Models/Any/AsyncApiAny.cs b/src/LEGO.AsyncAPI/Models/Any/AsyncApiAny.cs index b83d5ba9..8985fed3 100644 --- a/src/LEGO.AsyncAPI/Models/Any/AsyncApiAny.cs +++ b/src/LEGO.AsyncAPI/Models/Any/AsyncApiAny.cs @@ -92,6 +92,11 @@ public static T FromExtensionOrDefault(IAsyncApiExtension extension) /// . public T GetValue() { + if (this.node is JsonValue) + { + return this.node.GetValue(); + } + return JsonSerializer.Deserialize(this.node.ToJsonString()); } diff --git a/test/LEGO.AsyncAPI.Tests/Models/AsyncApiAnyTests.cs b/test/LEGO.AsyncAPI.Tests/Models/AsyncApiAnyTests.cs index 08f1682c..598ef31f 100644 --- a/test/LEGO.AsyncAPI.Tests/Models/AsyncApiAnyTests.cs +++ b/test/LEGO.AsyncAPI.Tests/Models/AsyncApiAnyTests.cs @@ -28,7 +28,7 @@ public void GetValue_ReturnsCorrectConversions() // Assert Assert.AreEqual("string", a.GetValue()); Assert.AreEqual(1, b.GetValue()); - Assert.AreEqual(1.1, c.GetValue()); + Assert.AreEqual(1.1, c.GetValue()); Assert.AreEqual(true, d.GetValue()); Assert.NotNull(e.GetValue()); Assert.IsNotEmpty(f.GetValue>());