paperclip icon indicating copy to clipboard operation
paperclip copied to clipboard

[Suggestion] Actix Plugin: Support a range of actix_web versions

Open FFdhorkin opened this issue 5 years ago • 1 comments

This merged PR broke the ability to compile paperclip for me: https://github.com/wafflespeanut/paperclip/pull/154

The problem is we're using an older version of actix_web (1.0.9) and you're using 2.0.0 now.

According to your documentation,

While it's not feature complete, you can rely on it to not break your actix-web flow.

Unfortunately, it won't compile with two versions of actix-web, and thus this is breaking my actix-web flow:

#14 349.5 error[E0308]: mismatched types #14 349.5 --> api/src/faux_filename1.rs:44:9 #14 349.5 | #14 349.5 44 | async_response() #14 349.5 | ^^^^^^^^^^^^^^^^ expected struct actix_http::response::Response, found a different struct actix_http::response::Response #14 349.5 | #14 349.5 ::: api/src/faux_filename1.rs:252:76 #14 349.5 | #14 349.5 252 | pub fn create_async(state: SyncData, path: Path<Uuid>, payload: String) -> Result<HttpResponse> { #14 349.5 | -------------------- expected std::result::Result<actix_http::response::Response, actix_http::error::Error> because of return type #14 349.5 253 | let id = *path; #14 349.5 254 | do_async!(state, id, path, &payload, &create, CreateParams) #14 349.5 | ---------------------------------------------------------------- in this macro invocation #14 349.5 | #14 349.5 = note: expected enum std::result::Result<actix_http::response::Response, _> (struct actix_http::response::Response) #14 349.5 found enum std::result::Result<actix_http::response::Response, _> (struct actix_http::response::Response) #14 349.5 = note: perhaps two different versions of crate actix_http are being used?

And I can't override it:

$ cargo update --package actix-web:2.0.0 --precise 1.0.9 Updating crates.io index error: failed to select a version for the requirement actix-web = "^2.0" candidate versions found which didn't match: 1.0.9 location searched: crates.io index required by package paperclip-actix v0.1.0 (https://github.com/wafflespeanut/paperclip.git#093ed30b) ... which is depended on by paperclip v0.3.0 (https://github.com/wafflespeanut/paperclip.git#093ed30b) ... which is depended on by api v0.5.1 (/Users/FFdhorkin/repo/.....) ... which is depended on by app v0.5.1 (/Users/FFdhorkin/repo/.....)

I have a local copy of paperclip that reverts the above merge (but is otherwise up to date with your latest), and that's allowing me to continue making some progress getting this working, but it doesn't seem like a great long-term option. I have tried getting our codebase working with actix_web 2.0.0, but that looks like it's going to be its own can of worms.

I don't know enough about what paperclip is doing behind the scenes to know how tightly tied it is to a particular version of actix_web, but it would be nice if it could somehow wrap the interface of actix_web without requiring the package to be a specific version (with the understanding some versions might not compile)

FFdhorkin avatar Mar 06 '20 19:03 FFdhorkin

While it's not feature complete, you can rely on it to not break your actix-web flow.

What I meant by this is that if your actix-web code is replaced with paperclip, it should just work. Since paperclip is still in 0.x, there's no guarantees on existing features. They could break.

[...] it would be nice if it could somehow wrap the interface of actix_web without requiring the package to be a specific version (with the understanding some versions might not compile)

It's just that I'm doing this on my spare time and there's already a number of things to implement. Maintaining another version of a plugin is a long-term task getting into the pile. As of now, I'd always want to support the latest version, but I guess with actix-web (given that it has reached 1.0, which will probably be maintained for a while before EOL), I'll make an exclusion. I'll add a feature gate for supporting actix-web 1.x

wafflespeanut avatar Mar 09 '20 05:03 wafflespeanut