LoginSignup
0
0

More than 1 year has passed since last update.

RustのschemarsでDateTimeでエラーになる場合の対処

Posted at

対処方法

chronoパッケージのchronoフィーチャーフラグを有効にします。

Cargo.toml
[dependencies]
schemars = { version = "0.8", features = ["chrono"] }

エラー全文

error[E0277]: the trait bound `DateTime<Utc>: JsonSchema` is not satisfied
  --> src/main.rs:22:48
   |
22 | #[derive(Deserialize, Serialize, Clone, Debug, JsonSchema)]
   |                                                ^^^^^^^^^^ the trait `JsonSchema` is not implemented for `DateTime<Utc>`
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0