-
Notifications
You must be signed in to change notification settings - Fork 58
feat: demo null value defaulting #1358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@@ -60,6 +60,16 @@ describe('OFREPProvider should', () => { | |||
); | |||
}); | |||
|
|||
it.each([true, false])('returns default if value is null', async (defaultValue) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test runs with 2 different defaults, and gets the default value both times since we send back a nullish value
in OFREP
const reason = key.includes('null-value') | ||
? StandardResolutionReasons.DEFAULT | ||
: requestBody.context?.targetingKey | ||
? StandardResolutionReasons.TARGETING_MATCH | ||
: StandardResolutionReasons.STATIC; | ||
|
||
const value = key.includes('null-value') ? null : true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Send back a value=null
, variant=null
and reason=DEFAULT
, this is my preferred proposal for implementing a "defer to code default" evaluation in flagd. I think this would be non-breaking for other implementations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would we need to send a variant at all?
Signed-off-by: Todd Baert <[email protected]>
6d39f15
to
2578068
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is exactly how I imagined it :)
Demo only.