GREsau / GREsau/okapi

The trait bound `rocket::fs::TempFile<'_>: rocket_okapi::JsonSchema` is not satisfied [E0277]

Open
#158 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
740
Forks
127
PR merge metrics
No merged PRs in 30d

Description

I am trying to make an endpoint that receives a file in a multipart formdata, but when I try to put the type for the argument in the function I get the following error:

> Error
```
the trait bound `rocket::fs::TempFile<'_>: rocket_okapi::JsonSchema` is not satisfied [E0277] the trait `rocket_okapi::JsonSchema` is not implemented for `rocket::fs::TempFile<'_>`, which is required by `rocket::form::Form>: rocket_okapi::request::OpenApiFromData<'_>` Help: the following other types implement trait `rocket_okapi::JsonSchema`: &'a T &'a mut T () (T0, T1) (T0, T1, T2) (T0, T1, T2, T3) (T0, T1, T2, T3, T4) (T0, T1, T2, T3, T4, T5) and 164 others Note: required for `rocket::form::Form>` to implement `rocket_okapi::request::OpenApiFromData<'_>`
```

> Code
```rust
#[openapi(tag = "User")]
#[patch("/change-profile-picture", data = "")]
pub async fn change_profile_picture(
conn: Connection<'_, Db>, jwt_guard: JwtGuard, file: Form>, minio: &State,
) -> Result {
// Rust code...
}
```

```toml
rocket = { version = "0.5.1", features = ["serde_json", "secrets", "json"] }
schemars = { version = "0.8.21", features = ["uuid1", "impl_json_schema", "chrono", "derive_json_schema", "derive"] }
rocket_okapi = { version = "0.9.0", features = ["secrets", "rapidoc", "rocket_db_pools", "uuid"] }
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.