Repository navigation
Conversation
Adds Condition 2.2.11 for providers with separate integer and float accessors. A value that can't be represented exactly in the requested type must be reported as TYPE_MISMATCH instead of being rounded or truncated, and a value that can (10.0 as an integer, 10 as a float) should be converted. Fixes open-feature#430 Signed-off-by: Srinivas Chippagiri <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR
Takes option 1 from #430. For providers with separate integer and float accessors, a numeric value that can't be represented exactly in the requested type (a fraction asked for as an integer, or out of range) MUST come back as
TYPE_MISMATCH, and a value that can (10.0 as an integer, 10 as a float) SHOULD be converted. That's the same rule as flagd's coercion ADR and the@numeric-coercionscenarios in the provider TCK.I made the lossy half a MUST since silently returning 0 for 0.5 is the failure the issue is about, and kept the lossless half a SHOULD so a strict provider that rejects every cross-type request isn't non-conformant.
Related Issues
Fixes #430
Notes
I put it at the end of 2.2 as Condition 2.2.11 so nothing gets renumbered. I left the TCK README alone for now, it still says
@numeric-coercionisn't backed by a requirement, happy to update that here or in a follow-up once the wording settles. #433 is the wider question for untyped backends and this doesn't try to answer it.