swift: Fix codegen with empty input objects / arrays#1589
Merged
jbaxleyiii merged 1 commit intoapollographql:masterfrom Oct 17, 2019
Merged
swift: Fix codegen with empty input objects / arrays#1589jbaxleyiii merged 1 commit intoapollographql:masterfrom
jbaxleyiii merged 1 commit intoapollographql:masterfrom
Conversation
1ba3610 to
5bab071
Compare
The codegen was omitting the `[:]` and `[]` tokens entirely. Fixes apollographql/apollo-ios#838
5bab071 to
3f3d260
Compare
Contributor
|
@abernix Any idea what's going on with the failure on Node 8? Seems unrelated. @lilyball Thanks for this - @cltnschlosser When you have a chance can you confirm this fixes your issue please? I believe you should be able to pull the updated CLI zip from the artifacts tab of the |
Contributor
|
@designatednerd Couldn't find the correct artifact, but I pulled @lilyball 's branch and confirmed that it fixes the issue. Thanks for the quick work! |
Contributor
|
Great - kicked the build again, @abernix wasn't really sure what the hell was going on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The codegen was omitting the
[:]and[]tokens entirely.Fixes apollographql/apollo-ios#838
The root cause of missing
[:]was there was some code relying on the truthy value of strings, but the conversion toSwiftSourcecaused even empty sources to become truthy. I'm actually surprised TypeScript happily acceptssomeObject || someStrand evaluates it as the object type with no warnings (I mean, it will always be the object type, but the|| someStris now dead code).Empty arrays I'm pretty sure were always broken even before
SwiftSourcedue to the counterintuitive behavior ofwrap(namely,wrap("[", "", "]") == ""instead of returning"[]"). I didn't want to deviate too much from the underlyingwrapbehavior (since the behavior is relied-upon in places) so I just made it returnundefinedinstead of an empty source object, which forced us to handle that at the call sites.TODO:
*Make sure changelog entries note which project(s) has been affected. See older entries for examples on what this looks like.