graphql-rust/graphql-client

Allow to share fragments

Sytten opened this issue · 1 comments

Currently all operations need to be in the same file if you want to be able to share fragments.
I would be nice if we could specify a list of files in the derive arguments to specify shared things.
Something like:

#[graphql(
    schema_path = "../schema.graphql",
    query_path = "tests/common/operations/mutations.graphql",
    shared_paths = "tests/common/operations/fragments.graphql, tests/common/operations/other.graphql",
    response_derives = "Debug"
)]
NobbZ commented

Can't we alternatively allow magic comments similar to the import statements in apollo + webpack?

https://www.apollographql.com/docs/react/data/fragments/#importing-fragments-when-using-webpack

I would prefer such an explicit import in the GraphQL file over something only mentioned in the rust files.