-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[selenium manager]: fix edge artifact deserialisation #14859
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨No code suggestions found for the PR. |
What if they switch again to uppercase? Shouldn't we make this case-insensitive? Is there any way we can make the fix work for previous versions of selenium? Could we contact the MSEdge team and tell them they break Selenium, so that they can un-break it, until we have a newer version that handles case-insensitive attribute names? |
Can we make this work for the key name with case-insensitive? |
I am not sure if it's a good idea. Plus I don't believe Edge API will break now. |
Since via response, all of the keys are not synced in the same standard. Assume one day they are going to change their mind to update the camel case for all other parent keys, we can not guard that. |
Do we know all possible options from which they can change into? If yes then maybe we can work upon that. |
I agree with @Fman77 and @VietND96. I believe the best solution for this issue will be to make this parsing case-insensitive (i.e., accept both @Delta456: Can you please look at the Rust code to make this case insensitive? Also, I reported this problem to the EdgeWebDriver issue tracker: MicrosoftEdge/EdgeWebDriver#178 However, the MS Edge WebDriver team is not very responsive to this tracker. It is not the first time I have reported something there (see here), and I didn't have any response, so probably this time will be the same. |
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.
Can we make this case-insentive?
I do not know the best way to make this case insensitive. What preferred way would you suggest? I also believe the other Struct fields can be renamed with time so we have to make that for all. |
If we are only going with #[derive(Serialize, Deserialize, Debug)]
pub struct Artifact {
#[serde(rename = "ArtifactName", alias = "artifactName")]
pub artifact_name: String,
#[serde(rename = "Location", alias = "location")]
pub location: String,
#[serde(rename = "Hash", alias = "hash")]
pub hash: String,
#[serde(rename = "HashAlgorithm", alias = "hashAlgorithm")]
pub hash_algorithm: String,
#[serde(rename = "SizeInBytes", alias = "sizeInBytes")]
pub size_in_bytes: u32,
} @bonigarcia what do you think? |
I've analyzed the required code for this. Indeed, doing this parsing case-insensitive is not straightforward with Rust's serde. In theory, it should be possible to use a custom deserializer and |
@bonigarcia should I also add an alias for |
I hope that change will not happen in the future. At least, the Microsoft team is now aware that that kind of change can break the clients of their API. But, yes, just in case, we can include a camel-case alias for all the members in those structs - thanks. |
Sure, I will do that in a while! |
78975b2
to
6d6381a
Compare
759e0d3
to
1f4fa3a
Compare
Thanks, @Delta456! |
User description
Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.
Description
Fixes #14851
Motivation and Context
The latest API of Microsoft Edge product updates now has renamed some fields which causes a lot of tests and selenium manager to fail.
API: https://edgeupdates.microsoft.com/api/products/
Previous:
Now:
Types of changes
Checklist
PR Type
Bug fix
Description
Artifact
struct to match the latest API response from Microsoft.Changes walkthrough 📝
edge.rs
Update field names in `Artifact` struct for Edge API compatibility
rust/src/edge.rs
Artifact
struct to match the new APIresponse.
ArtifactName
toartifactName
.Location
tolocation
.Hash
tohash
.HashAlgorithm
tohashAlgorithm
.SizeInBytes
tosizeInBytes
.