Skip to content

Commit

Permalink
Fix Fulfilled fragment references not being fully qualified
Browse files Browse the repository at this point in the history
Additional error noted in closed ticket 2949
#2949 (comment)
  • Loading branch information
AnthonyMDev committed May 31, 2023
1 parent 8419ffb commit 2f77379
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 21 deletions.
12 changes: 4 additions & 8 deletions Sources/ApolloCodegenLib/Templates/SelectionSetTemplate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -484,13 +484,10 @@ struct SelectionSetTemplate {
while next.next != nil {
defer { next = next.next.unsafelyUnwrapped }

let selectionSetName = SelectionSetNameGenerator.generatedSelectionSetName(
from: selectionSet.scopePath.head,
to: next,
withFieldPath: selectionSet.entity.fieldPath.head,
removingFirst: selectionSet.scopePath.head.value.type.isRootFieldType,
pluralizer: config.pluralizer
)
let selectionSetName = fullyQualifiedGeneratedSelectionSetName(
for: selectionSet.typeInfo,
to: next
)

fulfilledFragments.append(selectionSetName)
}
Expand Down Expand Up @@ -546,7 +543,6 @@ struct SelectionSetTemplate {
from: typeInfo.scopePath.head,
to: toNode,
withFieldPath: typeInfo.entity.fieldPath.head,
removingFirst: false,
pluralizer: config.pluralizer
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,8 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase {
],
fulfilledFragments: [
ObjectIdentifier(Self.self),
ObjectIdentifier(AllAnimal.self),
ObjectIdentifier(AllAnimal.AsAnimalUnion.self)
ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self),
ObjectIdentifier(TestOperationQuery.Data.AllAnimal.AsAnimalUnion.self)
]
))
}
Expand Down Expand Up @@ -430,8 +430,8 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase {
],
fulfilledFragments: [
ObjectIdentifier(Self.self),
ObjectIdentifier(AllAnimal.self),
ObjectIdentifier(AllAnimal.AsPet.self)
ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self),
ObjectIdentifier(TestOperationQuery.Data.AllAnimal.AsPet.self)
]
))
}
Expand Down Expand Up @@ -1116,7 +1116,7 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase {
],
fulfilledFragments: [
ObjectIdentifier(Self.self),
ObjectIdentifier(AllAnimal.self)
ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self)
]
))
}
Expand Down Expand Up @@ -1378,7 +1378,7 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase {
],
fulfilledFragments: [
ObjectIdentifier(Self.self),
ObjectIdentifier(AllAnimal.self),
ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self),
ObjectIdentifier(AnimalDetails.self)
]
))
Expand Down Expand Up @@ -1455,7 +1455,7 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase {
],
fulfilledFragments: [
ObjectIdentifier(Self.self),
ObjectIdentifier(AllAnimal.self),
ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self),
ObjectIdentifier(AnimalDetails.self)
]
))
Expand Down Expand Up @@ -1574,7 +1574,7 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase {
],
fulfilledFragments: [
ObjectIdentifier(Self.self),
ObjectIdentifier(AllAnimal.self)
ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self)
]
))
}
Expand Down Expand Up @@ -1633,7 +1633,7 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase {
],
fulfilledFragments: [
ObjectIdentifier(Self.self),
ObjectIdentifier(AllAnimal.self)
ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self)
]
))
}
Expand Down Expand Up @@ -1694,8 +1694,8 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase {
],
fulfilledFragments: [
ObjectIdentifier(Self.self),
ObjectIdentifier(AllAnimal.self),
ObjectIdentifier(AllAnimal.IfA.self)
ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self),
ObjectIdentifier(TestOperationQuery.Data.AllAnimal.IfA.self)
]
))
}
Expand Down Expand Up @@ -1756,7 +1756,7 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase {
],
fulfilledFragments: [
ObjectIdentifier(Self.self),
ObjectIdentifier(AllAnimal.IfA.Friend.self)
ObjectIdentifier(TestOperationQuery.Data.AllAnimal.IfA.Friend.self)
]
))
}
Expand Down Expand Up @@ -1834,7 +1834,7 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase {
],
fulfilledFragments: [
ObjectIdentifier(Self.self),
ObjectIdentifier(AllAnimal.self),
ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self),
ObjectIdentifier(AnimalDetails.self)
]
))
Expand Down

0 comments on commit 2f77379

Please sign in to comment.