sui_gql_schema/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#![cfg_attr(all(doc, not(doctest)), feature(doc_auto_cfg))]

//! Sui's GraphQL schema to use with `cynic`. Synchronized at `testnet-v1.40.2.`
//!
//! Read more about schemas in <https://cynic-rs.dev/schemas> and why this crate is separate in
//! <https://cynic-rs.dev/large-apis>.
//!
//! The types in the [`scalars`](crate::scalars) module may be specially useful.

#[cfg(feature = "scalars")]
pub mod scalars;

#[cfg(feature = "build")]
#[doc(hidden)]
/// The Sui schema SDL file as a string.
pub const SCHEMA_SUI: &str = include_str!("../schemas/sui.graphql");

#[cfg(feature = "build")]
/// Register all the schemas.
///
/// Currently only does so for the `sui` schema, which it tries to register as the default.
///
/// # Panics
///
/// If either building the schema from the SDL or registering it as the default fails.
pub fn register_schemas() {
    cynic_codegen::register_schema("sui")
        .from_sdl(SCHEMA_SUI)
        .expect("Fine to panic in build scripts")
        .as_default()
        .expect("Same as above");
}

/// Sui's GraphQL schema generated by [cynic]
#[doc(hidden)]
#[allow(clippy::use_self)]
#[cynic::schema("sui")]
pub mod schema {}