sui_gql_schema/lib.rs
1#![cfg_attr(all(doc, not(doctest)), feature(doc_auto_cfg))]
2
3//! Sui's GraphQL schema to use with `cynic`. Synchronized at `testnet-v1.42.0.`
4//!
5//! Read more about schemas in <https://cynic-rs.dev/schemas> and why this crate is separate in
6//! <https://cynic-rs.dev/large-apis>.
7//!
8//! The types in the [`scalars`](crate::scalars) module may be specially useful.
9
10#[cfg(feature = "scalars")]
11pub mod scalars;
12
13#[cfg(feature = "build")]
14#[doc(hidden)]
15/// The Sui schema SDL file as a string.
16pub const SCHEMA_SUI: &str = include_str!("../schemas/sui.graphql");
17
18#[cfg(feature = "build")]
19/// Register all the schemas.
20///
21/// Currently only does so for the `sui` schema, which it tries to register as the default.
22///
23/// # Panics
24///
25/// If either building the schema from the SDL or registering it as the default fails.
26pub fn register_schemas() {
27 cynic_codegen::register_schema("sui")
28 .from_sdl(SCHEMA_SUI)
29 .expect("Fine to panic in build scripts")
30 .as_default()
31 .expect("Same as above");
32}
33
34/// Sui's GraphQL schema generated by [cynic]
35#[doc(hidden)]
36#[allow(clippy::use_self)]
37#[cynic::schema("sui")]
38pub mod schema {}