You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm just getting started trying to use the generated test mocks capability with Apollo but have run into issues with linking. Our generated GQL files are embedded in our main target and we've set up a framework to hold the mocks. Our config looks like this:
We're running into issues with the mocks attempting to import our main (app) target hiatus.
This issue would go away if we created a separate framework to store our generated GQL files. Is that the only way to get this working or is it possible to leave our generated code in our main target?
The text was updated successfully, but these errors were encountered:
We're running into issues with the mocks attempting to import our main (app) target hiatus.
The generated test mocks are additive to the generated schema code, so the test mock module has to be able to import the target/package/module that contains the generated schema code.
The JSON config shows that you're generating the schema code with an access modifier of internal which makes sense since it's in your main target, but that then requires you to manually add @testable to the import hiatus statement to be able to access it (looks like you've done this). The test mock module will also need a dependency link on the hiatus target for this still to work though. It's important to note that the generated test mock files do not support custom edits so the next time you execute code generation any custom edits you made will be overwritten. The alternative to this is generating the schema code with the public access modifier, or putting the generated schema code into it's own module which necessitates them having an access modifier of public anyways.
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.
Question
I'm just getting started trying to use the generated test mocks capability with Apollo but have run into issues with linking. Our generated GQL files are embedded in our main target and we've set up a framework to hold the mocks. Our config looks like this:
We're running into issues with the mocks attempting to import our main (app) target
hiatus
.This issue would go away if we created a separate framework to store our generated GQL files. Is that the only way to get this working or is it possible to leave our generated code in our main target?
The text was updated successfully, but these errors were encountered: