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

Mountable not implemented for actix_files::Files even when actix-files feature is enabled #365

Open
TobiasDeBruijn opened this issue Dec 3, 2021 · 3 comments

Comments

@TobiasDeBruijn
Copy link
Contributor

Hi there,

When using paperclip 0.6.1 with the actix_files feature and actix_files version 0.5, the Mountable trait from paperclip is not implemented for actix_files::Files, making it unusable. I think it should be implemented when the actix-files feature is enabled, but unfortunately it is not.

Here's the relevant compiler error:

error[E0277]: the trait bound `Files: Mountable` is not satisfied
  --> src/main.rs:75:22
   |
75 |               .service(Files::new("", "./")
   |  ______________-------_^
   | |              |
   | |              required by a bound introduced by this call
76 | |                 .prefer_utf8(true)
77 | |                 .show_files_listing()))
   | |_____________________________________^ the trait `Mountable` is not implemented for `Files`

Relevant parts of Cargo.toml:

[dependencies]
actix-web = "3.3.2"
actix-files = "0.5"

[dependencies.paperclip]
version = "0.6.1"
features = ["actix", "actix-files"]

Thanks.

@tiagolobocastro
Copy link
Collaborator

Looks like actix-files "support" was added on #277
What do you actually want us to do for the Files, what would/should show up on the OpenApi?
(If you just want to use it you can add it before the wrap_api call and it will go straight to actix)

@TobiasDeBruijn
Copy link
Contributor Author

I didn't know that was possible actually!

That would be the most appropriate solution I think. Otherwhise you'd have to go through the Files folder to discover all files there, which seems like unnecessary. The use case for me is serving the frontend with the same webserver as the API.

So it should not show up at all in the spec, so your proposed solution seems correct. Should this be included in the docs potentialyl?

@tiagolobocastro
Copy link
Collaborator

Yeah probably, basically you can use actix as you would and only need to add the routes that you want to be present in the openapi.

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