juniper icon indicating copy to clipboard operation
juniper copied to clipboard

Feature: merge object definitions

Open trsh opened this issue 6 years ago • 12 comments

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 ! :/

trsh avatar May 16 '18 08:05 trsh