diff --git a/apollo-router/src/plugin/test/mod.rs b/apollo-router/src/plugin/test/mod.rs index 2733d06598..7957078a2a 100644 --- a/apollo-router/src/plugin/test/mod.rs +++ b/apollo-router/src/plugin/test/mod.rs @@ -9,7 +9,6 @@ use std::sync::Arc; pub use mock::subgraph::MockSubgraph; pub use service::MockExecutionService; -pub use service::MockQueryPlannerService; pub use service::MockSubgraphService; pub use service::MockSupergraphService; use tower::util::BoxService; diff --git a/apollo-router/src/plugin/test/service.rs b/apollo-router/src/plugin/test/service.rs index 95d3c81228..3b049e0868 100644 --- a/apollo-router/src/plugin/test/service.rs +++ b/apollo-router/src/plugin/test/service.rs @@ -3,8 +3,6 @@ use crate::ExecutionRequest; use crate::ExecutionResponse; -use crate::QueryPlannerRequest; -use crate::QueryPlannerResponse; use crate::SubgraphRequest; use crate::SubgraphResponse; use crate::SupergraphRequest; @@ -46,6 +44,5 @@ macro_rules! mock_service { } mock_service!(Supergraph, SupergraphRequest, SupergraphResponse); -mock_service!(QueryPlanner, QueryPlannerRequest, QueryPlannerResponse); mock_service!(Execution, ExecutionRequest, ExecutionResponse); mock_service!(Subgraph, SubgraphRequest, SubgraphResponse); diff --git a/apollo-router/src/services/mod.rs b/apollo-router/src/services/mod.rs index 4336b3040c..eec8564101 100644 --- a/apollo-router/src/services/mod.rs +++ b/apollo-router/src/services/mod.rs @@ -328,10 +328,10 @@ impl SupergraphResponse { assert_impl_all!(QueryPlannerRequest: Send); /// [`Context`] for the request. #[derive(Clone, Debug)] -pub struct QueryPlannerRequest { - pub query: String, - pub operation_name: Option, - pub context: Context, +pub(crate) struct QueryPlannerRequest { + pub(crate) query: String, + pub(crate) operation_name: Option, + pub(crate) context: Context, } #[buildstructor::buildstructor] @@ -339,7 +339,7 @@ impl QueryPlannerRequest { /// This is the constructor (or builder) to use when constructing a real QueryPlannerRequest. /// /// Required parameters are required in non-testing code to create a QueryPlannerRequest. - #[builder(visibility = "pub")] + #[builder] pub(crate) fn new( query: String, operation_name: Option, @@ -355,9 +355,9 @@ impl QueryPlannerRequest { assert_impl_all!(QueryPlannerResponse: Send); /// [`Context`] and [`QueryPlan`] for the response. -pub struct QueryPlannerResponse { +pub(crate) struct QueryPlannerResponse { pub(crate) content: QueryPlannerContent, - pub context: Context, + pub(crate) context: Context, } /// Query, QueryPlan and Introspection data. @@ -382,32 +382,6 @@ impl QueryPlannerResponse { pub(crate) fn new(content: QueryPlannerContent, context: Context) -> QueryPlannerResponse { Self { content, context } } - - /// This is the constructor (or builder) to use when constructing a QueryPlannerResponse that represents a global error. - /// It has no path and no response data. - /// This is useful for things such as authentication errors. - #[allow(unused_variables)] - #[builder(visibility = "pub")] - fn error_new( - errors: Vec, - status_code: Option, - headers: MultiMap, - context: Context, - ) -> Result { - tracing::warn!("no way to propagate error response from QueryPlanner"); - Ok(QueryPlannerResponse::new( - QueryPlannerContent::Plan { - plan: Arc::new(QueryPlan::fake_builder().build()), - query: Arc::new(Query::default()), - }, - context, - )) - } - - /// Get a reference of the query plan - pub fn query_plan(&self) -> &QueryPlannerContent { - &self.content - } } assert_impl_all!(SubgraphRequest: Send);