pub(super) fn create_root_node<RequestCtx>(c: &Configuration) -> Result<RootRef<RequestCtx>, Error>
where
    RequestCtx: RequestContext,
{
    // Runtime performance could be optimized by generating the entirety of the
    // schema in one loop iteration over the configuration. In fact, that's how
    // the first iteration of the code worked. However, doing so adds code
    // complexity, as all the schema objects built from any given
    // Type are built at once. This implementation opts for clarity
    // over runtime efficiency, given that the number of configuration items
    // is lkely to be small.

    let nthm = generate_schema(c)?;
    let nts = Arc::new(nthm);
    let root_mutation_info = Info::new("Mutation".to_string(), nts.clone());
    let root_query_info = Info::new("Query".to_string(), nts.clone());
    let root_subscription_info = Info::new("Subscription".to_string(), nts);
    catch_unwind(|| {
        Arc::new(RootNode::new_with_info(
            Node::new("Query".to_string(), HashMap::new()),
            Node::new("Mutation".to_string(), HashMap::new()),
            Node::new("Subscription".to_string(), HashMap::new()),
            root_query_info,
            root_mutation_info,
            root_subscription_info,
        ))
    })
    .map_err(|e| {
        e.downcast::<Error>()
            .map(|e| *e)
            .unwrap_or_else(|e| Error::SchemaItemNotFound {
                name: format!("{:#?}", e),
            })
    })
}
/// Takes a Warpgrapher configuration and returns the Juniper RootNode for a
/// GraphQL schema that matches the Warpgrapher configuration.
///
/// # Errors
/// Returns an [`Error`] of kind [`CouldNotResolveType`] if
/// there is an error in the configuration, specifically if the
/// configuration of type A references type B, but type B cannot be found.
///
/// [`Error`]: ../error/struct.Error.html
/// [`CouldNotResolveType`]: ../error/enum.ErrorKind.html#variant.CouldNotResolveType
///
Takes a Warpgrapher configuration and returns the Juniper RootNode for a
GraphQL schema that matches the Warpgrapher configuration.
Takes a Warpgrapher configuration and returns the Juniper RootNode for a GraphQL schema that matches the Warpgrapher configuration .
pub(super) fn create_root_node<RequestCtx>(c: &Configuration) -> Result<RootRef<RequestCtx>, Error>
where
    RequestCtx: RequestContext,
{
    // Runtime performance could be optimized by generating the entirety of the
    // schema in one loop iteration over the configuration. In fact, that's how
    // the first iteration of the code worked. However, doing so adds code
    // complexity, as all the schema objects built from any given
    // Type are built at once. This implementation opts for clarity
    // over runtime efficiency, given that the number of configuration items
    // is lkely to be small.
    let nthm = generate_schema(c)?;
    let nts = Arc::new(nthm);
    let root_mutation_info = Info::new("Mutation".to_string(), nts.clone());
    let root_query_info = Info::new("Query".to_string(), nts.clone());
    let root_subscription_info = Info::new("Subscription".to_string(), nts);
    catch_unwind(|| {
        Arc::new(RootNode::new_with_info(
            Node::new("Query".to_string(), HashMap::new()),
            Node::new("Mutation".to_string(), HashMap::new()),
            Node::new("Subscription".to_string(), HashMap::new()),
            root_query_info,
            root_mutation_info,
            root_subscription_info,
        ))
    })
    .map_err(|e| {
        e.downcast::<Error>()
            .map(|e| *e)
            .unwrap_or_else(|e| Error::SchemaItemNotFound {
                name: format!("{:#?}", e),
            })
    })
}
pub ( super ) fn create_root_node < RequestCtx > ( c : & Configuration ) -> Result < RootRef < RequestCtx > , Error > where RequestCtx : RequestContext , { // Runtime performance could be optimized by generating the entirety of the // schema in one loop iteration over the configuration. In fact, that's how // the first iteration of the code worked. However, doing so adds code // complexity, as all the schema objects built from any given // Type are built at once. This implementation opts for clarity // over runtime efficiency, given that the number of configuration items // is lkely to be small. let nthm = generate_schema ( c ) ? ; let nts = Arc :: new ( nthm ) ; let root_mutation_info = Info :: new ( " " . to_string ( ) , nts . clone ( ) ) ; let root_query_info = Info :: new ( " " . to_string ( ) , nts . clone ( ) ) ; let root_subscription_info = Info :: new ( " " . to_string ( ) , nts ) ; catch_unwind ( | | { Arc :: new ( RootNode :: new_with_info ( Node :: new ( " " . to_string ( ) , HashMap :: new ( ) ) , Node :: new ( " " . to_string ( ) , HashMap :: new ( ) ) , Node :: new ( " " . to_string ( ) , HashMap :: new ( ) ) , root_query_info , root_mutation_info , root_subscription_info , ) ) } ) . map_err ( | e | { e . downcast :: < Error > ( ) . map ( | e | * e ) . unwrap_or_else ( | e | Error :: SchemaItemNotFound { name : format ! ( " " e ) , } ) } ) }
Takes a Warpgrapher configuration and returns the Juniper RootNode for a
GraphQL schema that matches the Warpgrapher configuration.
Takes a Warpgrapher configuration and returns the Juniper RootNode for a GraphQL schema that matches the Warpgrapher configuration .
c
&Configuration
c
&Configuration
errors
Returns an [`Error`] of kind [`CouldNotResolveType`] if
there is an error in the configuration, specifically if the
configuration of type A references type B, but type B cannot be found.

[`Error`]: ../error/struct.Error.html
[`CouldNotResolveType`]: ../error/enum.ErrorKind.html#variant.CouldNotResolveType
Returns an [ ` Error ` ] of kind [ ` CouldNotResolveType ` ] if there is an error in the configuration specifically if the configuration of type A references type B but type B cannot be found . [ ` Error ` ] : .. / error / struct . Error . html [ ` CouldNotResolveType ` ] : .. / error / enum . ErrorKind . html#variant . CouldNotResolveType