Skip to main content

sova_graphql/
lib.rs

1//! GraphQL for Sova — client + optional schema server mount.
2//!
3//! ```ignore
4//! use sova_graphql::{FakeGraphql, GraphQl, GraphQlExt};
5//! use serde_json::json;
6//!
7//! let fake = FakeGraphql::new().stub("hello", json!({ "hello": "world" }));
8//! app.install(GraphQl::fake(fake.clone()));
9//!
10//! // in a handler:
11//! let v = req.graphql().query("query { hello }").data().await?;
12//! assert_eq!(v["hello"], "world");
13//! ```
14
15mod bound;
16mod client;
17#[cfg(feature = "server")]
18mod context;
19mod error;
20mod fake;
21mod plugin;
22#[cfg(feature = "server")]
23mod server;
24#[cfg(feature = "server")]
25mod subscription;
26
27pub use bound::{GraphQlBound, GraphQlExt};
28pub use client::{GraphQlClient, GraphqlResponse};
29pub use error::GraphqlError;
30pub use fake::{FakeGraphql, GraphqlCall};
31pub use plugin::GraphQl;
32
33#[cfg(feature = "server")]
34pub use bound::GraphqlServerExt;
35#[cfg(feature = "server")]
36pub use context::GraphqlContext;
37#[cfg(feature = "server")]
38pub use server::{execute_request, GraphqlJsonRequest, SchemaHandle};
39
40#[cfg(feature = "server")]
41pub use async_graphql;