Open p4checo opened 1 year ago
Thanks for the bug report @p4checo. I'd prefer not to add yet another configuration option, there are already too many. I'd rather opt for a consistent "Fragment" suffix on the filename. I'll see if there are any other options.
Hey, I've also run into this issue. Is "Fragment" suffix solution available in configuration? Cheers
@SzymonMatysik, no fix available yet. The work is slated for the 1.1
release, we're currently working on issues for the next patch release - 1.0.6
.
I am also having this issue after migrating to the new codegen cli now that we switched from cocoapods to SPM. Is there any work around so we don't have to rename 50+ files after generating them?
Hi @jostster - the only options currently are:
Yea for now I created a bash script to generate then rename all the files. Is there a flag or option to have all the generated files be combined into a single file? Since they are generated and shouldn't be edited this could also ease the burden and help larger projects not have a bunch of different generated files.
Is there a flag or option to have all the generated files be combined into a single file?
No, the legacy (0.x) versions used to have that option but it was removed in 1.0 to support modular architectures. It was also a poor performance option re. Xcode when it was an unwieldily large file.
This will be fixed by #3283.
Bug report
In our setup we define fragments with the same name as the schema types, e.g.:
While this wasn't an issue with the previous single-file codegen, in the current multi-file codegen of Apollo 1.0.x this is causing an issue because two files with the same
ProductImage.graphql.swift
name are generated (one in/Schema/Objects
and another in/Fragments
). This causes compilation fail with an error like this:The generated types themselves are properly namespaced so they don't collide, it's only the filenames themselves cause the problem:
Fragment
Object
While we can rename all our fragments to not have the same name as the type, we feel that this could also be fixed at the codegen phase, by adding a Fragment suffix to the file (e.g.
Foo.Fragment.graphql.swift
) instead of relying only on the folder structure (which can possibly cause other similar collisions). Would it make sense? Could also be added as a parameter of the config.Versions
Please fill in the versions you're currently using:
apollo-ios
SDK version: 1.0.1Steps to reproduce