graphql-client icon indicating copy to clipboard operation
graphql-client copied to clipboard

Allow to share fragments

Open Sytten opened this issue 3 years ago • 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"
)]

Sytten avatar Mar 24 '22 18:03 Sytten

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.

NobbZ avatar Mar 24 '23 19:03 NobbZ