Async-graphql: Breaking change in 2.6/2.7?

Created on 1 Apr 2021  路  2Comments  路  Source: async-graphql/async-graphql

After updating to v2.7.x from v2.5.x I now get the following compiler errors:

error[E0277]: the trait bound `NaiveDateTime: async_graphql::Type` is not satisfied
 --> src/models/users.rs:8:24
  |
8 | #[derive(Debug, Clone, SimpleObject, Queryable, Deserialize, Serialize)]
  |                        ^^^^^^^^^^^^ the trait `async_graphql::Type` is not implemented for `NaiveDateTime`
  |
  = note: required by `create_type_info`
  = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `NaiveDateTime: OutputType` is not satisfied
  --> src/models/users.rs:8:24
   |
8  | #[derive(Debug, Clone, SimpleObject, Queryable, Deserialize, Serialize)]
   |                        ^^^^^^^^^^^^ the trait `OutputType` is not implemented for `NaiveDateTime`
   |
  ::: /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/async-graphql-2.7.2/src/base.rs:60:14
   |
60 |     async fn resolve(
   |              ------- required by this bound in `resolve`
   |
   = note: required because of the requirements on the impl of `OutputType` for `&NaiveDateTime`
   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)

I'm using rust stable and this is the relevant struct:

#[derive(Debug, Clone, SimpleObject, Queryable, Deserialize, Serialize)]
pub struct User {
    pub id: Uuid,
    // ...
    pub created_at: NaiveDateTime,
    pub updated_at: Option<NaiveDateTime>,
}

The code worked perfectly until v2.5.14. Is there a mismatch with chrono or did I miss something?

question

All 2 comments

Now all features are not activated by default.

Oh I missed that, thanks so much! :)

And thanks for providing this repo! Appreciate all of it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

phungleson picture phungleson  路  4Comments

leebenson picture leebenson  路  4Comments

AurelienFT picture AurelienFT  路  5Comments

Weasy666 picture Weasy666  路  4Comments

Weasy666 picture Weasy666  路  4Comments