diff --git a/src/LEGO.AsyncAPI/Models/Any/AsyncApiAny.cs b/src/LEGO.AsyncAPI/Models/Any/AsyncApiAny.cs index c9c0c926..b83d5ba9 100644 --- a/src/LEGO.AsyncAPI/Models/Any/AsyncApiAny.cs +++ b/src/LEGO.AsyncAPI/Models/Any/AsyncApiAny.cs @@ -64,7 +64,7 @@ public AsyncApiAny(JsonObject node) /// T. /// The extension. /// . - public static T FromExtension(IAsyncApiExtension extension) + public static T FromExtensionOrDefault(IAsyncApiExtension extension) { if (extension is AsyncApiAny any) { @@ -122,7 +122,6 @@ public bool TryGetValue(out T value) { try { - value = this.GetValue(); return true; } diff --git a/test/LEGO.AsyncAPI.Tests/Bindings/Sns/SnsBindings_Should.cs b/test/LEGO.AsyncAPI.Tests/Bindings/Sns/SnsBindings_Should.cs index 290ee107..dbca5966 100644 --- a/test/LEGO.AsyncAPI.Tests/Bindings/Sns/SnsBindings_Should.cs +++ b/test/LEGO.AsyncAPI.Tests/Bindings/Sns/SnsBindings_Should.cs @@ -383,7 +383,7 @@ public void SnsOperationBinding_WithFilledObject_SerializesAndDeserializes() var binding = new AsyncApiStringReader(settings).ReadFragment(actual, AsyncApiVersion.AsyncApi2_0, out _); var binding2 = new AsyncApiStringReader(settings).ReadFragment(expected, AsyncApiVersion.AsyncApi2_0, out _); binding2.Bindings.First().Value.Extensions.TryGetValue("x-bindingExtension", out IAsyncApiExtension any); - var val = AsyncApiAny.FromExtension(any); + var val = AsyncApiAny.FromExtensionOrDefault(any); // Assert Assert.AreEqual(actual, expected);