-
Notifications
You must be signed in to change notification settings - Fork 470
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
Swift Codegen Not Respecting --mergeInFieldsFromFragmentSpreads Flag #537
Comments
@alex-king-ck, I previously had this flag set as --merge-in-fields-from-fragment-spreads false, after the --output API.swift, to avoid the code bloat that you speak of. I feel like the syntax has changed, can you tell me what your current syntax is? I get an error if I include it at all now. Previously I had something like: but it appears that the flag name has changed to camelcase, and that output has been removed. Have you figured out of you can set this flag to false or is one only supposed to use it for the positive? Thanks, Chris |
@chrisco314 I think that @alex-king-ck has indeed been using the flag with camel case I have the same issue and cannot seem to set the flag to false. Tried with and without the flag, and also I run |
Thanks, @namnguyens . I had upgraded from Apollo iOS framework version 0.8 to 0.9.2 to fix a crash bug in GraphQLError from force unwrapping a dictionary result. I hit the problems of this post - project became unworkable, an so rolled back to 0.8.0 again, and coded around my error (error.message -> error["message"]). For what it's worth, you can get clean internal models even with fragments, if you unwrap as needed, in the model level protocol extensions. Not as idea as plain old Swift objects, but workable... Example:
This then affords you a clean, Uncle-Bob compliant app that does not leak Apollo innards and lead to vendor lock-in.
|
This should be fixed in Apollo iOS 0.9.3 (which depends on the Apollo CLI 1.8.x). |
…n flag isn't specified Compare #537. See apollographql/apollo-kotlin#1042.
Using CLI version 0.2.0 (The latest version supported by apollo-ios)
The same issue is present when using 0.6.0 (latest current version)
We're trying to upgrade our version of apollo-ios. This means updating our version of the CLI (coming from apollo-codegen v0.17). Generating our API.swift file with all of our queries produced a 180MB file. We had seen this previously and the resolution was to disable merging fields from fragment spreads. However, the output of apollo-cli 0.2.0 doesn't change when we use the
--mergeInFieldsFromFragmentSpreads
flag.Here is a small sample query that can be used to illustrate the issue:
Generating using apollo-cli v0.6.0 with and without
--mergeInFieldsFromFragmentSpreads
produced the following output:API.swift.txt
Here is the expected output, generated with apollo-codegen v0.17:
API.swift.txt
The text was updated successfully, but these errors were encountered: