Skip to content

Can't use uuid #378

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

Closed
asciiu opened this issue Jun 22, 2019 · 3 comments
Closed

Can't use uuid #378

asciiu opened this issue Jun 22, 2019 · 3 comments
Labels

Comments

@asciiu
Copy link

asciiu commented Jun 22, 2019

I can't get my project to compile with uuid.

#[derive(juniper::GraphQLObject)]
#[derive(Queryable)]
pub struct User {
    pub id: Uuid,
    pub email: String,
    pub email_verified: bool,
    pub username: String,
    pub password_hash: String,
    pub created_on: NaiveDateTime,
    pub updated_on: NaiveDateTime,
    pub deleted_on: Option<NaiveDateTime>,
}
[dependencies]
...
diesel = { version = "1.4.2", features = ["postgres", "uuid", "chrono", "r2d2"] }
#juniper = "0.11" 
# using suggestion from ticket #237  which grabs juniper v0.12
juniper = { git = "https://github.com/graphql-rust/juniper.git"}
uuid = { version = "0.6", features = ["serde", "v4"] }
...

The output I experience is:

#[derive(juniper::GraphQLObject)]
  |          ^^^^^^^^^^^^^^^^^^^^^^ the trait `juniper::types::base::GraphQLType<__S>` is not implemented for `uuid::Uuid`

What am I missing? Is this because I need to use uuid v0.7? If so that would be a bummer as diesel does not support v0.7.

@theduke
Copy link
Member

theduke commented Jun 22, 2019

Juniper only supports uuid version 0.7.
You are using 0.6.

Diesel supports uuid 0.7 with the uuidv07 feature, so if you change both the diesel feature and the uuid version in your Cargo.toml it will work.

[dependencies]
...
diesel = { version = "1.4.2", features = ["postgres", "uuidv07", "chrono", "r2d2"] }
#juniper = "0.11" 
# using suggestion from ticket #237  which grabs juniper v0.12
juniper = { git = "https://github.com/graphql-rust/juniper.git"}
uuid = { version = "0.7", features = ["serde", "v4"] }
...

@theduke theduke closed this as completed Jun 22, 2019
@asciiu
Copy link
Author

asciiu commented Jun 22, 2019

Ooooh, I see. Thanks!

@LeoBorai
Copy link

Juniper only supports uuid version 0.7.
You are using 0.6.

Diesel supports uuid 0.7 with the uuidv07 feature, so if you change both the diesel feature and the uuid version in your Cargo.toml it will work.

[dependencies]
...
diesel = { version = "1.4.2", features = ["postgres", "uuidv07", "chrono", "r2d2"] }
#juniper = "0.11" 
# using suggestion from ticket #237  which grabs juniper v0.12
juniper = { git = "https://github.com/graphql-rust/juniper.git"}
uuid = { version = "0.7", features = ["serde", "v4"] }
...

Worked for me!
The following is my Cargo.toml:

#...
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
# ...
diesel = { version = "1.4.0", features = ["postgres", "r2d2", "uuidv07", "chrono"] }
juniper = "0.14.2"
# ...
uuid = { version = "0.7", features = ["serde", "v4"] }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants