diff --git a/sessions/src/graphql.rs b/sessions/src/graphql.rs index 183ad2e..108ea91 100644 --- a/sessions/src/graphql.rs +++ b/sessions/src/graphql.rs @@ -14,7 +14,7 @@ pub type RootSchema = Schema; /// A schema builder for the service pub fn root_schema_builder() -> SchemaBuilder { - Schema::build(RootQuery, EmptyMutation, EmptySubscription) + Schema::build(RootQuery, EmptyMutation, EmptySubscription).enable_federation() } /// A Beamline Session @@ -108,4 +108,15 @@ impl RootQuery { proposal: proposal.map(Proposal), })) } + + /// Retrieves a Beamline Session + #[graphql(entity)] + async fn router_session( + &self, + ctx: &Context<'_>, + proposal: u32, + visit: u32, + ) -> Result, async_graphql::Error> { + self.session(ctx, proposal, visit).await + } } diff --git a/sessions/src/main.rs b/sessions/src/main.rs index 01c2aff..3ac1c14 100644 --- a/sessions/src/main.rs +++ b/sessions/src/main.rs @@ -17,7 +17,7 @@ use crate::{ opa::OpaClient, route_handlers::GraphQLHandler, }; -use async_graphql::{extensions::Tracing, http::GraphiQLSource}; +use async_graphql::{extensions::Tracing, http::GraphiQLSource, SDLExportOptions}; use axum::{response::Html, routing::get, Router}; use clap::Parser; use opentelemetry_otlp::WithExportConfig; @@ -92,7 +92,7 @@ async fn main() { } Cli::Schema(args) => { let schema = root_schema_builder().finish(); - let schema_string = schema.sdl(); + let schema_string = schema.sdl_with_options(SDLExportOptions::new().federation()); if let Some(path) = args.path { let mut file = File::create(path).unwrap(); file.write_all(schema_string.as_bytes()).unwrap();