Fix `serde::Deserialize` impl for `Url` prints confusing error message
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.6k
- Forks
- 406
- PR merge metrics
- No merged PRs in 30d
Description
When failing to deserialize a str into a Url the current implementation of Deserialize returns an error with a confusing message.
For example:
use serde_json::{json, Result};
use url::Url;
let json = json!("bad_url");
let result: Result<Url> = serde_json::from_value(json);
println!("{}", result.err().unwrap());
Actual: invalid value: string "bad_url", expected relative URL without a base
Expected: invalid value: string "bad_url", expected a string representing a URL
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the serde::Deserialize implementation for Url and reproduce the serde_json example from the issue to confirm the current error text. Update the reported expectation so invalid strings produce the clearer message, then run the relevant test suite and verify the example's output matches the expected wording.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100