Skip to main content

apollo_router/
lib.rs

1//! Components of a federated GraphQL Server.
2//!
3//! Most of these modules are of varying interest to different audiences.
4//!
5//! If your interests are confined to developing plugins, then the following modules
6//! are likely to be of most interest to you:
7//!
8//! * [`self`] - this module (apollo_router) contains high level building blocks for a federated GraphQL router
9//!
10//! * [`graphql`] - graphql specific functionality for requests, responses, errors
11//!
12//! * [`layers`] - examples of tower layers used to implement plugins
13//!
14//! * [`plugin`] - various APIs for implementing a plugin
15//!
16//! * [`services`] - the various services handling a GraphQL requests,
17//!   and APIs for plugins to intercept them
18
19#![cfg_attr(feature = "failfast", allow(unreachable_code))]
20#![warn(unreachable_pub)]
21#![warn(missing_docs)]
22
23macro_rules! failfast_debug {
24    ($($tokens:tt)+) => {{
25        tracing::debug!($($tokens)+);
26        #[cfg(feature = "failfast")]
27        panic!(
28            "failfast triggered. \
29            Please remove the feature failfast if you don't want to see these panics"
30        );
31    }};
32}
33
34macro_rules! failfast_error {
35    ($($tokens:tt)+) => {{
36        tracing::error!($($tokens)+);
37        #[cfg(feature = "failfast")]
38        panic!(
39            "failfast triggered. \
40            Please remove the feature failfast if you don't want to see these panics"
41        );
42    }};
43}
44
45#[macro_use]
46mod json_ext;
47#[macro_use]
48pub mod plugin;
49
50#[macro_use]
51pub(crate) mod metrics;
52
53mod ageing_priority_queue;
54mod apollo_studio_interop;
55pub(crate) mod axum_factory;
56mod batching;
57mod cache;
58mod compute_job;
59mod configuration;
60mod context;
61mod error;
62mod executable;
63mod files;
64pub mod graphql;
65mod http_ext;
66mod http_server_factory;
67mod introspection;
68pub mod layers;
69pub(crate) mod logging;
70pub(crate) mod notification;
71mod orbiter;
72mod plugins;
73pub(crate) mod protocols;
74mod query_planner;
75mod router;
76mod router_factory;
77pub mod services;
78pub(crate) mod spec;
79mod state_machine;
80pub mod test_harness;
81pub mod tracer;
82mod uplink;
83
84pub use crate::axum_factory::unsupported_set_axum_router_callback;
85pub use crate::configuration::Configuration;
86pub use crate::configuration::ListenAddr;
87pub use crate::context::Context;
88pub use crate::context::extensions::Extensions;
89pub use crate::context::extensions::sync::ExtensionsMutex;
90pub use crate::executable::Executable;
91pub use crate::executable::main;
92pub use crate::notification::Notify;
93pub use crate::router::ApolloRouterError;
94pub use crate::router::ConfigurationSource;
95pub use crate::router::LicenseSource;
96pub use crate::router::RouterHttpServer;
97pub use crate::router::SchemaSource;
98pub use crate::router::ShutdownSource;
99pub use crate::router_factory::Endpoint;
100pub use crate::test_harness::MockedSubgraphs;
101pub use crate::test_harness::TestHarness;
102pub use crate::test_harness::make_fake_batch;
103pub use crate::uplink::UplinkConfig;
104
105/// Not part of the public API
106#[doc(hidden)]
107pub mod _private {
108    // Reexports for macros
109    pub use linkme;
110    pub use once_cell;
111    pub use serde_json;
112
113    pub use crate::plugin::PLUGINS;
114    pub use crate::plugin::PluginFactory;
115    // For tests
116    pub use crate::router_factory::create_test_service_factory_from_yaml;
117}