-
Notifications
You must be signed in to change notification settings - Fork 730
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
Add Namespace for ApolloAPI types in Generated Code #2581
Comments
Oh, that's a good point. We've actually done this for a ton of other things already, we just didn't consider I think we will likely go with your option 1 for solving this actually. Keep an eye out for a fix in 1.0.2 soon! |
I'm sorry to report that the fix still doesn't help with my issue. Reason being that |
Thanks for letting us know @matijakregarGH, are you able to put together a sample project demonstrating the build error? |
I could, but it will take a while. There is a naming clash between |
That's what the fix in #2585 is meant to resolve, hmm. Are you able to share the codegen configuration you're using then I can create a sample project on my end to try replicate. Are you not using a CocoaPods dependency configuration? |
Thanks for helping out! I am using CocoaPods. This is my codegen config:
All the generated objects are "wrapped" in enum Hope this helps enough ... |
I'll see if I can replicate, thanks for the config details. |
I have the exact same problem :( |
I think I glossed over this when @matijakregarGH first shared the config but looking again I believe the problem is being caused by the If you're using a dependency manager that is not SwiftPM then you want to use the |
@prokhorovxo I suggest taking a second look at your configuration, along with the documentation, and verify it's set up for the output your project needs. If after that you still cannot resolve the problem then post it here and we can take a look. |
@calvincestari I have used the Is there any other way to achieve this through the config file? Now I'm having naming clashes with |
@matijakregarGH - are you able to put together a small sample project demonstrating this? It doesn't need to be your full schema, just make sure the relevant types causing the conflict are there to replicate the build errors. |
I thought we fixed DocumentType? Can you verify you’re on 1.0.3? This was a known bug in 1.0.0. |
@AnthonyMDev I'm sure I have 1.0.3. @calvincestari I'll prepare a small sample project. Hopefully I can find the time today. |
A sample project demonstrating the DocumentType naming conflict in the generated operations file(s). Pods and generated files are included in the repo. The fix mentioned a few times above solves the build issues. |
I have exactly the same problem as I wrote it about in the Apollo community: |
OK, I've figured out the issue here and got a PR lined up for the fix. Thanks for the sample repo @matijakregarGH! |
OK, the fix for this is merged and will go out in |
@calvincestari Thanks for the fix. I can also confirm that it works with 1.0.4. Cheers 🤟 |
@calvincestari thank you, confirm. 🙏 |
I have a conflict in my schema with |
Feature request
There is a high probability of naming clashes in client app codebase and Apollo types. Name-spacing or prefixing would solve this issue.
Motivation
There is an actual problem that I'm facing.
I wanted to have
DocumentType
as enum in my app, however all generated operation files contain the following line:public static let document: DocumentType = .notPersisted( ...
that causes a build error.Proposed solution
There are a few solutions that I can think of:
public static let document: Apollo.DocumentType = .notPersisted( ...
. This one is more of a quick fix, but it would solve this particular problem.Outstanding Questions
Perhaps there's another way of getting around this issue. If I'm missing something I'd appreciate further instructions 🙂
The text was updated successfully, but these errors were encountered: