graphql-rust / graphql-client

Typed, correct GraphQL requests and responses in Rust
Apache License 2.0
1.14k stars 157 forks source link

error[E0107]: missing generics for struct `chrono::DateTime` #445

Closed bbigras closed 1 year ago

bbigras commented 1 year ago

query

mutation Publish($id: ID!, $input: [PublicationInput!]!) {
  publishablePublish(id: $id, input: $input) {
    userErrors {
      field
      message
    }
  }
}
4  | #[derive(GraphQLQuery)]
   |          ^^^^^^^^^^^^ expected 1 generic argument
   |
note: struct defined here, with 1 generic parameter: `Tz`
  --> /home/bbigras/.cargo/registry/src/github.com-1ecc6299db9ec823/chrono-0.4.23/src/datetime/mod.rs:89:12
   |
89 | pub struct DateTime<Tz: TimeZone> {
   |            ^^^^^^^^ --
   = note: this error originates in the derive macro `GraphQLQuery` (in Nightly builds, run with -Z macro-backtrace for more info)
help: add missing generic argument
   |
4  | #[derive(GraphQLQuery<Tz>)]

I tried using #[derive(GraphQLQuery<Utc>)] but I get:

4 | #[derive(GraphQLQuery<Utc>)]
  |                      ^ expected one of `(`, `,`, `::`, or `=`
tomhoule commented 1 year ago

Have you tried defining type DateTime = chrono::DateTime<Utc> in the parent scope?

bbigras commented 1 year ago

It works. Thank you very much!