reactive_graph_server/server/graphql_schema/
mod.rs

1use crate::server::graphql_schema::commands::GraphqlSchemaCommands;
2use reactive_graph_runtime_impl::RuntimeBuilder;
3use std::process::exit;
4
5pub mod args;
6pub mod commands;
7
8pub async fn print_graphql_schema_and_exit(commands: &GraphqlSchemaCommands) {
9    let runtime = RuntimeBuilder::new().ignore_config_files().get();
10    let sdl = match commands {
11        GraphqlSchemaCommands::ReactiveGraphSchema => runtime.get_graphql_schema_manager().get_schema().sdl(),
12        GraphqlSchemaCommands::DynamicGraphSchema => runtime
13            .get_dynamic_graph_schema_manager()
14            .get_dynamic_schema()
15            .await
16            .map(|schema| schema.sdl())
17            .unwrap_or_default(),
18        GraphqlSchemaCommands::ReactiveGraphPluginSchema => runtime.get_plugin_schema_manager().get_schema().sdl(),
19        GraphqlSchemaCommands::ReactiveGraphRuntimeSchema => runtime.get_runtime_schema_manager().get_schema().sdl(),
20    };
21    println!("{sdl}");
22    exit(0);
23}