Skip to content

Allow to share fragments #413

@Sytten

Description

@Sytten
Contributor

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"
)]

Activity

NobbZ

NobbZ commented on Mar 24, 2023

@NobbZ

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.

DirkRusche

DirkRusche commented on Apr 3, 2025

@DirkRusche

Is #312 something that might help to resolve first, so this issue here becomes easier?

tomhoule

tomhoule commented on Apr 3, 2025

@tomhoule
Member

I think it's the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @NobbZ@Sytten@DirkRusche@tomhoule

        Issue actions

          Allow to share fragments · Issue #413 · graphql-rust/graphql-client