-
Notifications
You must be signed in to change notification settings - Fork 14
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
feat: Add get_applicable_variants as expt endpoint #210
Conversation
4bea480
to
5cae429
Compare
02832c3
to
a9afdb9
Compare
Ok(HttpResponse::Ok().json(variants)) | ||
} | ||
|
||
fn decide_variant( |
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.
move to helper.rs
5cae429
to
99c74ff
Compare
99c74ff
to
d0acdb5
Compare
if is_empty { | ||
Some(exp.clone()) | ||
} else { | ||
match jsonlogic::partial_apply( |
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.
why partial apply ?
} | ||
} | ||
|
||
impl FromRequest for ApplicableVariantsQuery { |
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.
Ideally we should not use fromrequest for individual types , as actix_web already has fromrequest implementation
for all http request data type
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.
We can use try_from in the handler , and expect query param as HashMap<String,String>
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.
doing it manually, it becomes quite flaky and something which is like the dev has to separately ensure the safety of the type and not the system
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.
But then everyone will add from_request impl for all the types
None | ||
} | ||
}) | ||
.ok_or_else(|| { |
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.
shouldn't toss be optional and default should be -1 ?
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.
get_applicable_variant is based on toss itself, toss is mandatory here
59afb0a
to
8ff9c81
Compare
8ff9c81
to
d86191c
Compare
Problem
get_applicable_variants only exist as a functionality inside client
Solution
Add get_applicable_variants as an endpoint in experimentation
API changes
Vec<Variants>
Possible Issues in the future
Code duplication