diff --git a/Cargo.lock b/Cargo.lock index e55d81f838..b8e7a7a518 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -174,9 +174,9 @@ checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "apollo-compiler" -version = "1.0.0-beta.24" +version = "1.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71153ad85c85f7aa63f0e0a5868912c220bb48e4c764556f5841d37fc17b0103" +checksum = "2d810db7b42773a4082426bcd58658cb9b311c5b74febd255130a9dcfc13109d" dependencies = [ "ahash", "apollo-parser", @@ -245,9 +245,9 @@ dependencies = [ [[package]] name = "apollo-parser" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b64257011a999f2e22275cf7a118f651e58dc9170e11b775d435de768fad0387" +checksum = "c8f05cbc7da3c2e3bb2f86e985aad5f72571d2e2cd26faf8caa7782131576f84" dependencies = [ "memchr", "rowan", @@ -470,9 +470,9 @@ dependencies = [ [[package]] name = "apollo-smith" -version = "0.14.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d89479524886fdbe62b124d3825879778680e0147304d1a6d32164418f8089a2" +checksum = "95a04f64d4d4f0048201967b8064257de212ab240fd74e2b153691b39b0e8721" dependencies = [ "apollo-compiler", "apollo-parser", @@ -499,9 +499,9 @@ checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" [[package]] name = "ariadne" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44055e597c674aef7cb903b2b9f6e4cba1277ed0d2d61dae7cd52d7ffa81f8e2" +checksum = "31beedec3ce83ae6da3a79592b3d8d7afd146a5b15bb9bb940279aced60faa89" dependencies = [ "concolor", "unicode-width", @@ -4041,15 +4041,6 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" -[[package]] -name = "memoffset" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" -dependencies = [ - "autocfg", -] - [[package]] name = "memory-stats" version = "1.2.0" @@ -5584,13 +5575,12 @@ dependencies = [ [[package]] name = "rowan" -version = "0.15.15" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a58fa8a7ccff2aec4f39cc45bf5f985cec7125ab271cf681c279fd00192b49" +checksum = "417a3a9f582e349834051b8a10c8d71ca88da4211e4093528e36b9845f6b5f21" dependencies = [ "countme", "hashbrown 0.14.5", - "memoffset", "rustc-hash", "text-size", ] diff --git a/Cargo.toml b/Cargo.toml index c492b05480..25fd043d7c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,9 +49,9 @@ debug = 1 # Dependencies used in more than one place are specified here in order to keep versions in sync: # https://doc.rust-lang.org/cargo/reference/workspaces.html#the-dependencies-table [workspace.dependencies] -apollo-compiler = "=1.0.0-beta.24" -apollo-parser = "0.8.3" -apollo-smith = "0.14.0" +apollo-compiler = "1.25.0" +apollo-parser = "0.8.4" +apollo-smith = "0.15.0" async-trait = "0.1.77" hex = { version = "0.4.3", features = ["serde"] } http = "0.2.11" diff --git a/apollo-federation/src/operation/tests/mod.rs b/apollo-federation/src/operation/tests/mod.rs index dd90422494..8dfbf599d4 100644 --- a/apollo-federation/src/operation/tests/mod.rs +++ b/apollo-federation/src/operation/tests/mod.rs @@ -1,5 +1,6 @@ use apollo_compiler::collections::IndexSet; use apollo_compiler::name; +use apollo_compiler::parser::Parser; use apollo_compiler::schema::Schema; use apollo_compiler::ExecutableDocument; @@ -29,8 +30,9 @@ macro_rules! assert_normalized { pub(super) fn parse_schema_and_operation( schema_and_operation: &str, ) -> (ValidFederationSchema, ExecutableDocument) { - let (schema, executable_document) = - apollo_compiler::parse_mixed_validate(schema_and_operation, "document.graphql").unwrap(); + let (schema, executable_document) = Parser::new() + .parse_mixed_validate(schema_and_operation, "document.graphql") + .unwrap(); let executable_document = executable_document.into_inner(); let schema = ValidFederationSchema::new(schema).unwrap(); (schema, executable_document) diff --git a/apollo-federation/src/query_graph/path_tree.rs b/apollo-federation/src/query_graph/path_tree.rs index b8564f90ed..b8f59ef2c2 100644 --- a/apollo-federation/src/query_graph/path_tree.rs +++ b/apollo-federation/src/query_graph/path_tree.rs @@ -563,6 +563,7 @@ where mod tests { use std::sync::Arc; + use apollo_compiler::parser::Parser; use apollo_compiler::ExecutableDocument; use petgraph::stable_graph::NodeIndex; use petgraph::visit::EdgeRef; @@ -585,9 +586,9 @@ mod tests { fn parse_schema_and_operation( schema_and_operation: &str, ) -> (ValidFederationSchema, ExecutableDocument) { - let (schema, executable_document) = - apollo_compiler::parse_mixed_validate(schema_and_operation, "document.graphql") - .unwrap(); + let (schema, executable_document) = Parser::new() + .parse_mixed_validate(schema_and_operation, "document.graphql") + .unwrap(); let executable_document = executable_document.into_inner(); let schema = ValidFederationSchema::new(schema).unwrap(); (schema, executable_document) diff --git a/apollo-federation/src/subgraph/mod.rs b/apollo-federation/src/subgraph/mod.rs index d36382e73d..3a79de9aba 100644 --- a/apollo-federation/src/subgraph/mod.rs +++ b/apollo-federation/src/subgraph/mod.rs @@ -119,7 +119,7 @@ impl Subgraph { .schema_definition .make_mut() .directives - .push(defaults.applied_link_directive().into()); + .push(defaults.applied_link_directive()); defaults } }; @@ -136,7 +136,7 @@ impl Subgraph { .schema_definition .make_mut() .directives - .push(defaults.applied_link_directive().into()); + .push(defaults.applied_link_directive()); defaults } }; diff --git a/apollo-router/src/error.rs b/apollo-router/src/error.rs index d20f35cc39..d8000b99cf 100644 --- a/apollo-router/src/error.rs +++ b/apollo-router/src/error.rs @@ -343,7 +343,7 @@ impl IntoGraphQLErrors for FederationErrorBridge { } } -impl IntoGraphQLErrors for Vec { +impl IntoGraphQLErrors for Vec { fn into_graphql_errors(self) -> Result, Self> { Ok(self .into_iter() @@ -550,7 +550,7 @@ impl IntoGraphQLErrors for ParseErrors { /// Collection of schema validation errors. #[derive(Debug, Clone, Serialize, Deserialize)] pub(crate) struct ValidationErrors { - pub(crate) errors: Vec, + pub(crate) errors: Vec, } impl ValidationErrors { diff --git a/apollo-router/src/graphql/mod.rs b/apollo-router/src/graphql/mod.rs index 0ac60d3f69..939a3eb338 100644 --- a/apollo-router/src/graphql/mod.rs +++ b/apollo-router/src/graphql/mod.rs @@ -7,8 +7,8 @@ mod visitor; use std::fmt; use std::pin::Pin; -use apollo_compiler::execution::GraphQLError as CompilerExecutionError; -use apollo_compiler::execution::ResponseDataPathElement; +use apollo_compiler::response::GraphQLError as CompilerExecutionError; +use apollo_compiler::response::ResponseDataPathSegment; use futures::Stream; use heck::ToShoutySnakeCase; pub use request::Request; @@ -233,10 +233,10 @@ impl From for Error { let elements = path .into_iter() .map(|element| match element { - ResponseDataPathElement::Field(name) => { + ResponseDataPathSegment::Field(name) => { JsonPathElement::Key(name.as_str().to_owned(), None) } - ResponseDataPathElement::ListIndex(i) => JsonPathElement::Index(i), + ResponseDataPathSegment::ListIndex(i) => JsonPathElement::Index(i), }) .collect(); Some(Path(elements)) diff --git a/apollo-router/src/graphql/response.rs b/apollo-router/src/graphql/response.rs index 1f710e7add..4c153f694b 100644 --- a/apollo-router/src/graphql/response.rs +++ b/apollo-router/src/graphql/response.rs @@ -1,6 +1,7 @@ #![allow(missing_docs)] // FIXME use std::time::Instant; +use apollo_compiler::response::ExecutionResponse; use bytes::Bytes; use serde::Deserialize; use serde::Serialize; @@ -245,25 +246,13 @@ impl IncrementalResponse { } } -impl From for Response { - fn from(response: apollo_compiler::execution::Response) -> Response { - let apollo_compiler::execution::Response { - errors, - data, - extensions, - } = response; +impl From for Response { + fn from(response: ExecutionResponse) -> Response { + let ExecutionResponse { errors, data } = response; Self { errors: errors.into_graphql_errors().unwrap(), - data: match data { - apollo_compiler::execution::ResponseData::Object(map) => { - Some(serde_json_bytes::Value::Object(map)) - } - apollo_compiler::execution::ResponseData::Null => { - Some(serde_json_bytes::Value::Null) - } - apollo_compiler::execution::ResponseData::Absent => None, - }, - extensions, + data: data.map(serde_json_bytes::Value::Object), + extensions: Default::default(), label: None, path: None, has_next: None, diff --git a/apollo-router/src/introspection.rs b/apollo-router/src/introspection.rs index 20098af96b..29870d9741 100644 --- a/apollo-router/src/introspection.rs +++ b/apollo-router/src/introspection.rs @@ -147,23 +147,26 @@ impl IntrospectionCache { } fn execute_introspection(schema: &spec::Schema, doc: &ParsedDocument) -> graphql::Response { - let schema = schema.api_schema(); + let api_schema = schema.api_schema(); let operation = &doc.operation; let variable_values = Default::default(); - match apollo_compiler::execution::coerce_variable_values( - schema, + match apollo_compiler::request::coerce_variable_values( + api_schema, operation, &variable_values, - ) { - Ok(variable_values) => apollo_compiler::execution::execute_introspection_only_query( - schema, + ) + .and_then(|variable_values| { + apollo_compiler::introspection::partial_execute( + api_schema, + &schema.implementers_map, &doc.executable, operation, &variable_values, ) - .into(), + }) { + Ok(response) => response.into(), Err(e) => { - let error = e.into_graphql_error(&doc.executable.sources); + let error = e.to_graphql_error(&doc.executable.sources); graphql::Response::builder().error(error).build() } } diff --git a/apollo-router/src/services/supergraph/snapshots/apollo_router__services__supergraph__tests__invalid_input_enum.snap b/apollo-router/src/services/supergraph/snapshots/apollo_router__services__supergraph__tests__invalid_input_enum.snap index 0e2dd5d122..d0c6e66d41 100644 --- a/apollo-router/src/services/supergraph/snapshots/apollo_router__services__supergraph__tests__invalid_input_enum.snap +++ b/apollo-router/src/services/supergraph/snapshots/apollo_router__services__supergraph__tests__invalid_input_enum.snap @@ -5,7 +5,7 @@ expression: response { "errors": [ { - "message": "Value \"C does not exist in \"InputEnum\" enum.", + "message": "Value \"C\" does not exist in \"InputEnum\" enum.", "locations": [ { "line": 1, diff --git a/apollo-router/src/spec/query/transform.rs b/apollo-router/src/spec/query/transform.rs index 47b93c75e3..d9da27dde0 100644 --- a/apollo-router/src/spec/query/transform.rs +++ b/apollo-router/src/spec/query/transform.rs @@ -569,13 +569,10 @@ mod tests { def: &ast::Field, ) -> Result, BoxError> { Ok(field(self, field_def, def)?.map(|mut new| { - new.directives.push( - ast::Directive { - name: apollo_compiler::name!("added"), - arguments: Vec::new(), - } - .into(), - ); + new.directives.push(ast::Directive { + name: apollo_compiler::name!("added"), + arguments: Vec::new(), + }); new })) } diff --git a/examples/supergraph-sdl/rust/Cargo.toml b/examples/supergraph-sdl/rust/Cargo.toml index 827e44ed5d..49157427b5 100644 --- a/examples/supergraph-sdl/rust/Cargo.toml +++ b/examples/supergraph-sdl/rust/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [dependencies] anyhow = "1" -apollo-compiler = "=1.0.0-beta.24" +apollo-compiler = "1.25.0" apollo-router = { path = "../../../apollo-router" } async-trait = "0.1" tower = { version = "0.4", features = ["full"] }