Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Scope Fragments by file #279

Open
KlausJokisuo opened this issue May 9, 2023 · 2 comments
Open

Feature request: Scope Fragments by file #279

KlausJokisuo opened this issue May 9, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@KlausJokisuo
Copy link

Currently, if I have a Fragment called User in multiple places in my project, the generated code can import incorrect fragments.

Would it be possible to just import those fragments which are in the same file where Query/Mutation is or maybe just prioritize importing the "nearest" fragment?

Related issue graphql/graphql-spec#802

Thanks🙏

@github-actions
Copy link

github-actions bot commented May 9, 2023

👋 @KlausJokisuo
Thank you for raising an issue. I will investigate the issue and get back to you as soon as possible.
Please make sure you have provided enough context.

This library is created and maintained by me, @budde377. Please consider supporting my work and ensure our survival by donating here.

@KlausJokisuo KlausJokisuo changed the title Feature request: Scope Fragments by fike Feature request: Scope Fragments by file May 9, 2023
@budde377
Copy link
Contributor

This is a reoccurring problem. I would always advise that you come up with a proper naming scheme, e.g. naming the fragments after widgets.

We could look into something like:

# import "../User.graphql"

To resolve ambiguity.

@budde377 budde377 added the enhancement New feature or request label May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants