diff --git a/Cargo.toml b/Cargo.toml index f1889e6d..f029d03c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "async-graphql" -version = "4.0.0-alpha.0" +version = "4.0.0-alpha.1" authors = ["sunli ", "Koxiaet"] edition = "2021" description = "A GraphQL server library implemented in Rust" @@ -27,9 +27,9 @@ password-strength-validator = ["zxcvbn"] tokio-sync = ["tokio"] [dependencies] -async-graphql-derive = { path = "derive", version = "4.0.0-alpha.0" } -async-graphql-value = { path = "value", version = "4.0.0-alpha.0" } -async-graphql-parser = { path = "parser", version = "4.0.0-alpha.0" } +async-graphql-derive = { path = "derive", version = "4.0.0-alpha.1" } +async-graphql-value = { path = "value", version = "4.0.0-alpha.1" } +async-graphql-parser = { path = "parser", version = "4.0.0-alpha.1" } async-stream = "0.3.0" async-trait = "0.1.48" diff --git a/derive/Cargo.toml b/derive/Cargo.toml index 51094308..f0517e67 100644 --- a/derive/Cargo.toml +++ b/derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "async-graphql-derive" -version = "4.0.0-alpha.0" +version = "4.0.0-alpha.1" authors = ["sunli ", "Koxiaet"] edition = "2021" description = "Macros for async-graphql" @@ -15,9 +15,14 @@ categories = ["network-programming", "asynchronous"] proc-macro = true [dependencies] -async-graphql-parser = { path = "../parser", version = "4.0.0-alpha.0" } +async-graphql-parser = { path = "../parser", version = "4.0.0-alpha.1" } proc-macro2 = "1.0.24" -syn = { version = "1.0.64", features = ["full", "extra-traits", "visit-mut", "visit"] } +syn = { version = "1.0.64", features = [ + "full", + "extra-traits", + "visit-mut", + "visit", +] } quote = "1.0.9" Inflector = "0.11.4" proc-macro-crate = "1.0.0" diff --git a/integrations/actix-web/Cargo.toml b/integrations/actix-web/Cargo.toml index 64559ab1..db3d49ca 100644 --- a/integrations/actix-web/Cargo.toml +++ b/integrations/actix-web/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "async-graphql-actix-web" -version = "4.0.0-alpha.0" +version = "4.0.0-alpha.1" authors = ["sunli ", "Koxiaet"] edition = "2021" description = "async-graphql for actix-web" @@ -12,7 +12,7 @@ keywords = ["futures", "async", "graphql"] categories = ["network-programming", "asynchronous"] [dependencies] -async-graphql = { path = "../..", version = "4.0.0-alpha.0" } +async-graphql = { path = "../..", version = "4.0.0-alpha.1" } actix = "0.13.0" actix-http = "3.0.1" diff --git a/integrations/axum/Cargo.toml b/integrations/axum/Cargo.toml index 53cf33f9..250f9a13 100644 --- a/integrations/axum/Cargo.toml +++ b/integrations/axum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "async-graphql-axum" -version = "4.0.0-alpha.0" +version = "4.0.0-alpha.1" authors = ["sunli "] edition = "2021" description = "async-graphql for axum" @@ -12,7 +12,7 @@ keywords = ["futures", "async", "graphql", "axum"] categories = ["network-programming", "asynchronous"] [dependencies] -async-graphql = { path = "../..", version = "4.0.0-alpha.0" } +async-graphql = { path = "../..", version = "4.0.0-alpha.1" } async-trait = "0.1.51" axum = { version = "0.5.1", features = ["ws", "headers"] } diff --git a/integrations/poem/Cargo.toml b/integrations/poem/Cargo.toml index fbca87b3..a2146f6c 100644 --- a/integrations/poem/Cargo.toml +++ b/integrations/poem/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "async-graphql-poem" -version = "4.0.0-alpha.0" +version = "4.0.0-alpha.1" authors = ["sunli "] edition = "2021" description = "async-graphql for poem" @@ -12,10 +12,9 @@ keywords = ["futures", "async", "graphql", "poem"] categories = ["network-programming", "asynchronous"] [dependencies] -async-graphql = { path = "../..", version = "4.0.0-alpha.0" } +async-graphql = { path = "../..", version = "4.0.0-alpha.1" } poem = { version = "1.2.2", features = ["websocket"] } futures-util = { version = "0.3.0", default-features = false } serde_json = "1.0.66" tokio-util = { version = "0.6.7", features = ["compat"] } - diff --git a/integrations/rocket/Cargo.toml b/integrations/rocket/Cargo.toml index 01bb2e35..2037e89e 100644 --- a/integrations/rocket/Cargo.toml +++ b/integrations/rocket/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "async-graphql-rocket" -version = "4.0.0-alpha.0" +version = "4.0.0-alpha.1" authors = ["Daniel Wiesenberg "] edition = "2021" description = "async-graphql for Rocket.rs" @@ -12,9 +12,11 @@ keywords = ["futures", "async", "graphql", "rocket"] categories = ["network-programming", "asynchronous"] [dependencies] -async-graphql = { path = "../..", version = "4.0.0-alpha.0" } +async-graphql = { path = "../..", version = "4.0.0-alpha.1" } rocket = { version = "0.5.0-rc.1", default-features = false } serde = "1.0.126" serde_json = "1.0.64" -tokio-util = { version = "0.6.7", default-features = false, features = ["compat"] } +tokio-util = { version = "0.6.7", default-features = false, features = [ + "compat", +] } diff --git a/integrations/tide/Cargo.toml b/integrations/tide/Cargo.toml index 3432fc79..99382065 100644 --- a/integrations/tide/Cargo.toml +++ b/integrations/tide/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "async-graphql-tide" -version = "4.0.0-alpha.0" +version = "4.0.0-alpha.1" authors = ["vkill ", "sunli "] edition = "2021" description = "async-graphql for tide" @@ -16,17 +16,22 @@ default = ["websocket"] websocket = ["tide-websockets"] [dependencies] -async-graphql = { path = "../..", version = "4.0.0-alpha.0" } +async-graphql = { path = "../..", version = "4.0.0-alpha.1" } async-trait = "0.1.48" futures-util = "0.3.0" serde_json = "1.0.64" -tide = { version = "0.16.0", default-features = false, features = ["h1-server"] } +tide = { version = "0.16.0", default-features = false, features = [ + "h1-server", +] } tide-websockets = { version = "0.4.0", optional = true } [dev-dependencies] # Surf lacks multipart support -reqwest = { version = "0.11.2", default-features = false, features = ["json", "multipart"] } +reqwest = { version = "0.11.2", default-features = false, features = [ + "json", + "multipart", +] } async-std = { version = "1.9.0", features = ["attributes", "tokio1"] } serde_json = "1.0.64" diff --git a/integrations/warp/Cargo.toml b/integrations/warp/Cargo.toml index 799aaba5..b56b4afc 100644 --- a/integrations/warp/Cargo.toml +++ b/integrations/warp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "async-graphql-warp" -version = "4.0.0-alpha.0" +version = "4.0.0-alpha.1" authors = ["sunli ", "Koxiaet"] edition = "2021" description = "async-graphql for warp" @@ -12,12 +12,18 @@ keywords = ["futures", "async", "graphql"] categories = ["network-programming", "asynchronous"] [dependencies] -async-graphql = { path = "../..", version = "4.0.0-alpha.0" } +async-graphql = { path = "../..", version = "4.0.0-alpha.1" } warp = { version = "0.3.0", default-features = false, features = ["websocket"] } -futures-util = { version = "0.3.0", default-features = false, features = ["sink"] } +futures-util = { version = "0.3.0", default-features = false, features = [ + "sink", +] } serde_json = "1.0.64" [dev-dependencies] -tokio = { version = "1.4.0", default-features = false, features = ["macros", "rt-multi-thread", "time"] } +tokio = { version = "1.4.0", default-features = false, features = [ + "macros", + "rt-multi-thread", + "time", +] } async-stream = "0.3.0" diff --git a/parser/Cargo.toml b/parser/Cargo.toml index 20f04581..a3000e07 100644 --- a/parser/Cargo.toml +++ b/parser/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "async-graphql-parser" -version = "4.0.0-alpha.0" +version = "4.0.0-alpha.1" authors = ["sunli ", "Koxiaet"] edition = "2021" description = "GraphQL query parser for async-graphql" @@ -12,7 +12,7 @@ keywords = ["futures", "async", "graphql"] categories = ["network-programming", "asynchronous"] [dependencies] -async-graphql-value = { path = "../value", version = "4.0.0-alpha.0" } +async-graphql-value = { path = "../value", version = "4.0.0-alpha.1" } pest = "2.1.3" serde_json = "1.0.64" serde = { version = "1.0.125", features = ["derive"] } diff --git a/src/types/external/mod.rs b/src/types/external/mod.rs index 52441e79..7a696fc9 100644 --- a/src/types/external/mod.rs +++ b/src/types/external/mod.rs @@ -39,5 +39,7 @@ mod time_offset_date_time; mod time_primitive_date_time; #[cfg(feature = "url")] mod url; -#[cfg(any(feature = "uuid", feature = "uuid08"))] +#[cfg(feature = "uuid")] mod uuid; +#[cfg(feature = "uuid08")] +mod uuid08; diff --git a/src/types/external/uuid.rs b/src/types/external/uuid.rs index 61d32bfd..f9e7d8de 100644 --- a/src/types/external/uuid.rs +++ b/src/types/external/uuid.rs @@ -1,7 +1,4 @@ -#[cfg(feature = "uuid")] use uuid::Uuid; -#[cfg(feature = "uuid08")] -use uuid08::Uuid; use crate::{InputValueError, InputValueResult, Scalar, ScalarType, Value}; diff --git a/src/types/external/uuid08.rs b/src/types/external/uuid08.rs new file mode 100644 index 00000000..ffcc15d2 --- /dev/null +++ b/src/types/external/uuid08.rs @@ -0,0 +1,29 @@ +use uuid08::Uuid; + +use crate::{InputValueError, InputValueResult, Scalar, ScalarType, Value}; + +#[Scalar( + internal, + name = "UUID", + specified_by_url = "http://tools.ietf.org/html/rfc4122" +)] +/// A UUID is a unique 128-bit number, stored as 16 octets. UUIDs are parsed as +/// Strings within GraphQL. UUIDs are used to assign unique identifiers to +/// entities without requiring a central allocating authority. +/// +/// # References +/// +/// * [Wikipedia: Universally Unique Identifier](http://en.wikipedia.org/wiki/Universally_unique_identifier) +/// * [RFC4122: A Universally Unique IDentifier (UUID) URN Namespace](http://tools.ietf.org/html/rfc4122) +impl ScalarType for Uuid { + fn parse(value: Value) -> InputValueResult { + match value { + Value::String(s) => Ok(Uuid::parse_str(&s)?), + _ => Err(InputValueError::expected_type(value)), + } + } + + fn to_value(&self) -> Value { + Value::String(self.to_string()) + } +} diff --git a/value/Cargo.toml b/value/Cargo.toml index e51b2e14..31f20637 100644 --- a/value/Cargo.toml +++ b/value/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "async-graphql-value" -version = "4.0.0-alpha.0" +version = "4.0.0-alpha.1" authors = ["sunli ", "Koxiaet"] edition = "2021" description = "GraphQL value for async-graphql"