diff --git a/Cargo.lock b/Cargo.lock index e85a246f8b..a5a9604bfb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -107,29 +107,34 @@ checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" [[package]] name = "apollo-compiler" -version = "0.1.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "619d54da02587ebced191b1000e3d8b31060cf7c77c5800c53d33d88faaeff30" +checksum = "8469cb8f7f42ad9b062e70f1148320e6cb7d727d2e87ca46635633ca6b2e6e4d" dependencies = [ "apollo-parser", "miette 4.7.1", "ordered-float 2.10.0", + "rowan", "salsa", "thiserror", - "uuid 0.8.2", + "uuid 1.2.1", ] [[package]] name = "apollo-encoder" -version = "0.3.2" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "344a1afec31ce0273dc2061105b04e5c4ab620fe0748a76244338aa893db42f3" +checksum = "8b17d38f06e92256e9b0b271b878e20309822a587b2acfa234a60d36d92b6b43" +dependencies = [ + "apollo-parser", + "thiserror", +] [[package]] name = "apollo-parser" -version = "0.2.12" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f901785c93a542be795c2703370ddb5f84d4e38606357fc56fefa4b42ab25151" +checksum = "7a8f6cc3fa1313e045538ed2ce72ba916d52b501cd81e636a0bd5cdc703a0c73" dependencies = [ "rowan", ] @@ -276,9 +281,9 @@ dependencies = [ [[package]] name = "apollo-smith" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66fba27e21f40315a0e8abfd2998632b3d1670ae5a16d069c8ff652ea79992d" +checksum = "005d27ddeb774d8059040d00f5a5fee276458b57a22414256e74269b30b7b3ea" dependencies = [ "apollo-encoder", "apollo-parser", @@ -1841,8 +1846,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi 0.10.2+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -5578,10 +5585,6 @@ name = "uuid" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" -dependencies = [ - "getrandom", - "serde", -] [[package]] name = "uuid" @@ -5591,6 +5594,7 @@ checksum = "feb41e78f93363bb2df8b0e86a2ca30eed7806ea16ea0c790d757cf93f79be83" dependencies = [ "getrandom", "serde", + "wasm-bindgen", ] [[package]] diff --git a/apollo-router/Cargo.toml b/apollo-router/Cargo.toml index 9e4878360b..46f9dfbd8c 100644 --- a/apollo-router/Cargo.toml +++ b/apollo-router/Cargo.toml @@ -39,7 +39,7 @@ features = ["docs_rs"] access-json = "0.1.0" anyhow = "1.0.66" ansi_term = "0.12" -apollo-parser = "0.2.12" +apollo-parser = "0.3.0" async-compression = { version = "0.3.14", features = [ "tokio", "brotli", diff --git a/apollo-router/src/spec/query.rs b/apollo-router/src/spec/query.rs index 1144b6f3d2..4a48871548 100644 --- a/apollo-router/src/spec/query.rs +++ b/apollo-router/src/spec/query.rs @@ -998,22 +998,10 @@ fn parse_default_value(definition: &ast::VariableDefinition) -> Option { pub(crate) fn parse_value(value: &ast::Value) -> Option { match value { ast::Value::Variable(_) => None, - ast::Value::StringValue(s) => Some(s.to_string().into()), - ast::Value::FloatValue(f) => f.to_string().parse::().ok().map(Into::into), - ast::Value::IntValue(i) => { - let s = i.to_string(); - s.parse::() - .ok() - .map(Into::into) - .or_else(|| s.parse::().ok().map(Into::into)) - } - ast::Value::BooleanValue(b) => { - match (b.true_token().is_some(), b.false_token().is_some()) { - (true, false) => Some(Value::Bool(true)), - (false, true) => Some(Value::Bool(false)), - _ => None, - } - } + ast::Value::StringValue(s) => Some(String::from(s).into()), + ast::Value::FloatValue(f) => Some(f64::from(f).into()), + ast::Value::IntValue(i) => Some(i32::from(i).into()), + ast::Value::BooleanValue(b) => Some(bool::from(b).into()), ast::Value::NullValue(_) => Some(Value::Null), ast::Value::EnumValue(e) => e.name().map(|n| n.text().to_string().into()), ast::Value::ListValue(l) => l diff --git a/apollo-router/src/spec/query/tests.rs b/apollo-router/src/spec/query/tests.rs index 594194b405..f2344e43df 100644 --- a/apollo-router/src/spec/query/tests.rs +++ b/apollo-router/src/spec/query/tests.rs @@ -3657,7 +3657,7 @@ fn check_fragment_on_interface() { name } } - }}", + }", ) .response(json! {{ "get": { @@ -4648,7 +4648,7 @@ fn parse_introspection_query() { } } } - }}"; + }"; assert!(Query::parse(query, api_schema, &Default::default()) .unwrap() .operations diff --git a/examples/supergraph_sdl/Cargo.toml b/examples/supergraph_sdl/Cargo.toml index da23fc416f..08103699a5 100644 --- a/examples/supergraph_sdl/Cargo.toml +++ b/examples/supergraph_sdl/Cargo.toml @@ -6,8 +6,8 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] anyhow = "1" -apollo-compiler = "0.1.0" -apollo-parser = "0.2.8" +apollo-compiler = "0.3.0" +apollo-parser = "0.3.0" apollo-router = { path = "../../apollo-router" } async-trait = "0.1" futures = "0.3" diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index 47e1ae8d4d..e2df6fcb8b 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -11,8 +11,8 @@ cargo-fuzz = true [dependencies] libfuzzer-sys = "0.4" -apollo-smith = { version = "0.1.3", features = ["parser-impl"] } -apollo-parser = "0.2.12" +apollo-smith = { version = "0.1.4", features = ["parser-impl"] } +apollo-parser = "0.3.0" env_logger = "0.9.1" log = "0.4" reqwest = { version = "0.11", features = ["json", "blocking"] } diff --git a/fuzz/src/lib.rs b/fuzz/src/lib.rs index eac9c3f7e4..ed5415c334 100644 --- a/fuzz/src/lib.rs +++ b/fuzz/src/lib.rs @@ -13,7 +13,8 @@ use log::debug; pub fn generate_valid_operation(input: &[u8], schema_path: &'static str) -> Result { drop(env_logger::try_init()); - let parser = Parser::new(&fs::read_to_string(schema_path).expect("cannot read file")); + let contents = fs::read_to_string(schema_path).expect("cannot read file"); + let parser = Parser::new(&contents); let tree = parser.parse(); if tree.errors().len() > 0 {