Skip to content
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

[Feature Request] Types that can be converted between types that implement Serialize/Deserialize should implement Serialize and Deserialize #2250

Open
Scripter17 opened this issue Apr 17, 2024 · 2 comments

Comments

@Scripter17
Copy link

Various types in Reqwest can in theory implement Serde's Serialize and Deserialize traits but don't. This can get quite annoying when trying to let users configure various parts of HTTP requests via a JSON file. It requires many uses of #[serde(with = "...")] which gets N times more complicated when having Option<T>, HashMap<K, V>, HashSet<T>, etc.

A non-exhaustive list of Reqwest types that could implement Serialize and/or Deserialize pretty easily:

I'll see if I can do this myself, but since I'm not used to the internals of Reqwest or pull requests it might be a bit messy

@seanmonstar
Copy link
Owner

I don't currently want to implement Serialize or Deserialize on the types. I realize most of the impls would be straightforward, but I don't want to maintain that the format would stay the same.

I think an application wanting to allowing users to provide some of those as config files should define an app-specific type and format.

@Scripter17
Copy link
Author

If the implementation only uses public APIs then there's no maintenance to do that doesn't arise from those already existing public APIs breaking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants