juniper
juniper copied to clipboard
Feature: merge object definitions
File one
graphql_object!(QueryRoot: Pool<ConnectionManager<PgConnection>> |&self| {
field constant(&executor, id: String) -> FieldResult<Option<Constant>> {
......
}
});
File two
graphql_object!(QueryRoot: Pool<ConnectionManager<PgConnection>> |&self| {
field ssssss(&executor) -> FieldResult<Vec<Constant>> {
.....
}
});
Combining file
use juniper::RootNode;
pub struct QueryRoot;
pub struct MutationRoot;
pub type Schema = RootNode<'static, QueryRoot, MutationRoot>;
pub fn create_schema() -> Schema {
Schema::new(QueryRoot {}, MutationRoot {})
}
Obviously this aint working because of conflicting implementation
of QueryRoot
. Any suggestion how to go around this? I do not really want a super huge Schema file with all objects in it ! :/