Skip to content

Commit

Permalink
fix: summary events should allow null default value in counter (#253)
Browse files Browse the repository at this point in the history
When testing dotnet client, I came across the behavior that a `null`
default value will end up in a summary event counter as the key
`"default": null`.

This isn't accepted by the test harness, even though our JSON standard
mandates that null and an omitted property be treated equivalently.

The SDK could fix this by omitting the property - but the harness should
also accept this.


-----

I'm open to hearing "no, the harness should not accept this."
  • Loading branch information
cwaldren-ld authored Oct 29, 2024
1 parent 6480865 commit 9b4d98f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions sdktests/client_side_events_summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,17 +361,19 @@ func doClientSideSummaryBasicPrereqTest(t *ldtest.T) {
)),
m.KV("contextKinds", anyContextKindsList()),
)),
m.KV(prereq2Key, m.MapOf(
m.KV("counters", m.ItemsInAnyOrder(
m.KV(prereq2Key, m.AllOf(
JSONPropertyNullOrAbsent("default"),
m.JSONProperty("counters").Should(m.ItemsInAnyOrder(
flagCounter(prereq2Result.Value, prereq2Result.Variation.Value(), prereq2Result.FlagVersion.Value(), 2),
)),
m.KV("contextKinds", anyContextKindsList()),
m.JSONProperty("contextKinds").Should(anyContextKindsList()),
)),
m.KV(prereq3Key, m.MapOf(
m.KV("counters", m.ItemsInAnyOrder(
m.KV(prereq3Key, m.AllOf(
JSONPropertyNullOrAbsent("default"),
m.JSONProperty("counters").Should(m.ItemsInAnyOrder(
flagCounter(prereq3Result.Value, prereq3Result.Variation.Value(), prereq3Result.FlagVersion.Value(), 2),
)),
m.KV("contextKinds", anyContextKindsList()),
m.JSONProperty("contextKinds").Should(anyContextKindsList()),
)),
)),
)
Expand Down

0 comments on commit 9b4d98f

Please sign in to comment.