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

Use of an @import directive #25

Open
emahuni opened this issue Aug 9, 2019 · 3 comments
Open

Use of an @import directive #25

emahuni opened this issue Aug 9, 2019 · 3 comments

Comments

@emahuni
Copy link

emahuni commented Aug 9, 2019

There are 2 proposed ways of importing graphql files into one another and the 1st one is covered by this loader. The other one is through the use of an import directive

profile {
   ...profileFields @import (from: "./file.graphql")
}

This is probably something that will be used in the future of Graphql as it is similar to how Graphql specification is written. It could become a spec, so supporting it could be great.

In addition to supporting this, there could also be an export of this so that the developer can use it in their schema for other graphql tools to correctly lint it or something.

eg: import { importDirective } from 'webpack-graphql-loader';

@amonks
Copy link

amonks commented Aug 9, 2019

do other tools in the ecosystem support this syntax?

@emahuni
Copy link
Author

emahuni commented Aug 10, 2019

take a look at this: graphql/graphql-spec#410

then there are other tools that have implemented this or are considering implementing these, just do a google search.

@amonks
Copy link

amonks commented Aug 15, 2019

A ha! thank you for pointing me to that issue, and for the suggestion! 😄

An (admittedly cursory) google for "graphql import directive" does not seem to indicate to me that other tools support this yet, although it's quite possible I'm searching for the wrong thing or looking in the wrong place 😬. I don't think we are likely to merge support for this directive until we see stronger community consensus around it.

I think if this import directive proposal moves forward, or if many other tools support it, then we will be interested in supporting it also 👍.

I'll subscribe to that graphql-spec proposal 👀.

Thanks again for the tip 🎉.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants