From 0a13cdd174fbb7ede6e8310666f090fff67ad22a Mon Sep 17 00:00:00 2001 From: "christian.lutnik" Date: Mon, 20 Jan 2025 12:19:58 +0100 Subject: [PATCH] fixup! Update in-process resolver to support flag metadata #305 Signed-off-by: christian.lutnik --- .../Resolver/InProcess/JsonEvaluator.cs | 4 ++-- .../JsonEvaluatorTest.cs | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/OpenFeature.Contrib.Providers.Flagd/Resolver/InProcess/JsonEvaluator.cs b/src/OpenFeature.Contrib.Providers.Flagd/Resolver/InProcess/JsonEvaluator.cs index 91d67206..5b449a0a 100644 --- a/src/OpenFeature.Contrib.Providers.Flagd/Resolver/InProcess/JsonEvaluator.cs +++ b/src/OpenFeature.Contrib.Providers.Flagd/Resolver/InProcess/JsonEvaluator.cs @@ -96,7 +96,7 @@ internal FlagSyncData Parse(string flagConfigurations) var value = data.Metadata[key]; if (value is long longValue) { - data.Metadata[key] = (int)longValue; + value = data.Metadata[key] = (int)longValue; } VerifyMetadataValue(key, value); @@ -115,7 +115,7 @@ internal FlagSyncData Parse(string flagConfigurations) var value = flagConfig.Value.Metadata[key]; if (value is long longValue) { - flagConfig.Value.Metadata[key] = (int)longValue; + value = flagConfig.Value.Metadata[key] = (int)longValue; } VerifyMetadataValue(key, value); diff --git a/test/OpenFeature.Contrib.Providers.Flagd.Test/JsonEvaluatorTest.cs b/test/OpenFeature.Contrib.Providers.Flagd.Test/JsonEvaluatorTest.cs index 781658eb..f1c16ebf 100644 --- a/test/OpenFeature.Contrib.Providers.Flagd.Test/JsonEvaluatorTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flagd.Test/JsonEvaluatorTest.cs @@ -376,8 +376,6 @@ public void TestJsonEvaluatorFlagMetadataOverwritesFlagSetMetadata() var result = jsonEvaluator.ResolveBooleanValueAsync("metadata-flag", false); - var a = result.FlagMetadata.GetInt("integer"); - Assert.NotNull(result.FlagMetadata); Assert.Equal("1.0.2", result.FlagMetadata.GetString("string")); Assert.Equal(2, result.FlagMetadata.GetInt("integer"));