-
Notifications
You must be signed in to change notification settings - Fork 717
-
Notifications
You must be signed in to change notification settings - Fork 717
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
Documentation for @import directive. #3373
Comments
Making matters difficult is when i try to test this out, i run into this crash
|
Hi @scottasoutherland - I agree with should get some specific documentation up for this, I thought we had some already. We'll likely need a new place in the documentation where we can describe custom directives. That directive is quite easy to use though:
Note that this is not intended to be a way to link schemas though, so any target/module you want to import into the operation file must have been part of the code generation execution that generated the operation in question. |
If you remove |
So in our case we have 1 schema, and we have 3 different libraries we build that each have their own queries against that schema. We use some fragments in all 3 of them but currently we just copy the files so we end up with LibraryOne.myFragment, LibraryTwo.myFragment, LibraryThree.myFragment which are all effectively the same type but not actually interchangeable. What we'd like to do is import LibraryOne into LibraryTwo & LibraryThree and use LibraryOne.MyFragment everywhere. If this is not what this is for, can you explain the use case for the directive ? In what case would you need to import a library that has nothing to do with the generated code ?
After messing with it, the problem was not the imports, the problem was the missing fragments that i moved. It appears to be a volume of errors or something because if only one fragment is missing it flags that correctly but when i removed all of the re-used fragments it crashes instead. |
Yes, this sounds like what it was intended for. |
There is documentation of that directive here. Perhaps this docs page is too difficult to discover right now? |
Thanks @AnthonyMDev. @scottasoutherland I'm going to close this issue now as there doesn't seem to be anything actionable. If you have further issues getting |
Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo iOS usage and allow us to serve you better. |
Thank you @calvincestari and @AnthonyMDev , i did search the docs for that directive but was unable to find it. Thanks for pointing it out and for the swift replies! Will try it out again today and see if I can make it work. |
Use case
I'm looking to understand how to use the @import directive added here: apollographql/apollo-ios-dev#245
But it's unclear to me.
What i'm hoping to do is have a one graphQL library import another and re-use the fragments there, but I cannot find any documentation on this or how to use it. We currently are copying files and including multiple copies of the same fragments, and building 3 separate graphql libraries which is unideal. I assume the codegen would need to know about all 3 libraries which are are currently built separately ?
Describe the solution you'd like
No response
The text was updated successfully, but these errors were encountered: