Skip to content

Conversation

@RobinDaugherty
Copy link

@RobinDaugherty RobinDaugherty commented Jul 28, 2021

Fixes #2396

By placing the namespace in front of any fragment struct name, we can ensure that the fragment type will be unambiguous. If the fragment is used in a query that has a node (and therefore type name) with the same name as the fragment's type name, Swift doesn't get confused about which type is being referred to.

However, the namespace is not included in the name when declaring the fragment's struct, so there's a new method that is used to get the name for its declaration.

TODO:

  • Update CHANGELOG.md* with your change (include reference to issue & this PR)
  • Make sure all of the significant new logic is covered by tests
  • Rebase your changes on master so that they can be merged easily
  • Make sure all tests and linter rules pass

*Make sure changelog entries note which project(s) has been affected. See older entries for examples on what this looks like.

@apollo-cla
Copy link

@RobinDaugherty: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/

@RobinDaugherty RobinDaugherty force-pushed the fix/fragment-struct-namespace branch 3 times, most recently from dd6232e to ff2c8e4 Compare July 28, 2021 21:19
to make sure that if the fragment is used in a query that has a node (and therefore type name) with the same name as the fragment's type name, Swift doesn't get confused about which type is being referred to.
@RobinDaugherty RobinDaugherty force-pushed the fix/fragment-struct-namespace branch from ff2c8e4 to e510713 Compare July 28, 2021 21:23
@RobinDaugherty RobinDaugherty force-pushed the fix/fragment-struct-namespace branch from bd89a4d to e510713 Compare December 1, 2021 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Swift: Query containing fragment with same name as outer query field generates variables with wrong type

2 participants