Closed cwaldren-ld closed 5 months ago
This pull request has been linked to Shortcut Story #203949: Treat omitted JSON values as if they were null.
Did a more deep audit of the code. I'm seeing an (un-contract-tested) problem in the handling of variations where null
evaluation result will result in entering the type-check branch and return a WRONG_TYPE
error.
That's not correct. So this PR shouldn't be merged yet until I make some contract tests that cover this (and fix it.)
I'm going to merge this as it's a good defensive change in case the SDK is sent bad/malformed data. I've created a ticket to investigate whether a null
flag value is possible or not, and if we need to have contract tests to cover this.
Background When the client-side SDK is deserializing an evaluation result, it may encounter a
null
evaluation value for a particular flag. That is, the value is literallynull
in JSON.It might also receive an evaliuation result with an omitted value. Some server-side SDKs may produce this because they don't treat null/missing as equivalent.
Problem In that case, the client-side SDK would throw a schema error. This isn't correct since producing a null/omitted value is legitimate.
Solution The deserialization code now takes into account the equivalence of null/omission and doesn't throw an error.