-
Notifications
You must be signed in to change notification settings - Fork 57
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
feat(apollo-ios-codegen): Stable sort schema types for SchemaMetadata #514
feat(apollo-ios-codegen): Stable sort schema types for SchemaMetadata #514
Conversation
In some cases, the order of parsed types come out differently on different systems (unclear why). This creates problems in some situations where we're checking in the generated SchemaMetadata files, as we continuously flip back and forth between two orderings, generating git diffs. By sorting the parsed types, we guarantee that their order is stable and no unnecessary diffs are introduced.
👷 Deploy request for eclectic-pie-88a2ba pending review.Visit the deploys page to approve it
|
✅ Docs Preview ReadyNo new or changed pages found. |
👷 Deploy request for apollo-ios-docc pending review.Visit the deploys page to approve it
|
I'm not sure what's going on here, and I'm struggling to produce a minimal repo. But I have two machines that consistently produce a different ordering of the types in the schema loaded by the frontend (compilationResult.referencedTypes) in IRBuilder. |
I'm surprised this issue hasn't been raised before, can you provide more info about the 2 machines where you see the differences? Such as processor type, os versions, maybe xcode versions between the machines etc? Would be useful to help understand the underlying cause of the issue. I'm not opposed to having this be sorted though, would make that file more readable, not sure if there are any potential complications of this you can think of @AnthonyMDev ? I supposed this would cause a change for diff purposes for all users the first time they ran it. |
Yeah, it's very odd that this is happening, but I'm not opposed to sorting the types before generation. Yes, there will be a diff for existing users, but it won't be a breaking change. |
Unclear, I mainly observed a diff between my Macbook and our internal CI system where I don't have full clarity on the environment. But I found some other devs with slightly different hardware that get the alternate type order. I can see if I can do a more thorough comparison between the systems. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks good, thanks for the contribution!
378929ba feat(apollo-ios-codegen): Stable sort schema types for SchemaMetadata (#514) git-subtree-dir: apollo-ios-codegen git-subtree-split: 378929baa366b1e607fe70fb61834be036432312
…e sort schema types for SchemaMetadata git-subtree-dir: apollo-ios-codegen git-subtree-mainline: d336f36 git-subtree-split: 378929baa366b1e607fe70fb61834be036432312
In some cases, the order of parsed types come out differently on different systems (unclear why). This creates problems in some situations where we're checking in the generated SchemaMetadata files, as we continuously flip back and forth between two orderings, generating git diffs.
By sorting the parsed types, we guarantee that their order is stable and no unnecessary diffs are introduced.