-
Notifications
You must be signed in to change notification settings - Fork 83
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
Solution_id is integer #3071
Solution_id is integer #3071
Conversation
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.
LGTM
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.
Nice change!!
where | ||
D: serde::Deserializer<'de>, | ||
{ | ||
struct SolutionIdVisitor; |
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.
Alternatively this can also be implemented using a helper enum. Might be a bit more self explanatory.
fn deserialize_solution_id<'de, D>(deserializer: D) -> Result<u64, D::Error>
where
D: serde::Deserializer<'de>,
{
#[serde_as]
#[derive(Deserialize, Debug)]
#[serde(untagged)]
enum StringOrInt {
String(#[serde_as(as = "DisplayFromStr")] u64),
Int(u64)
}
let result = match StringOrInt::deserialize(deserializer)? {
StringOrInt::String(id) => id,
StringOrInt::Int(id) => id
};
Ok(result)
}
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 one is nice as well. But I guess it's ok keeping the current version since it will be removed in one week from now.
Description
Related to #3064
This PR enables driver to send either string or integer for
solution_id
.This PR marks the start of transition period. Once the PR is merged, external solvers will be asked to:
solution_id
as integer in/solve
response.solution_id
on/reveal
and on/settle
.Once done, backend will have a follow up where we will definitely switch to using integers in all three endpoints and #3064 will be fixed.
How to test
Manually checked that both versions are properly serialized/deserialized.