From 27603d0c4433bcb73ebdf8328659d2f88221d9c4 Mon Sep 17 00:00:00 2001 From: Anthony Miller Date: Fri, 2 Jun 2023 11:29:17 -0700 Subject: [PATCH 1/4] WIP: Failing Test for bug --- ...ectionSetTemplate_Initializers_Tests.swift | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplate_Initializers_Tests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplate_Initializers_Tests.swift index 1250b0bdfd..ac13a42d09 100644 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplate_Initializers_Tests.swift +++ b/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplate_Initializers_Tests.swift @@ -53,6 +53,34 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { ) } + func buildSubjectAndFragment( + named fragmentName: String = "TestFragment", + schemaNamespace: String = "TestSchema", + moduleType: ApolloCodegenConfiguration.SchemaTypesFileOutput.ModuleType = .swiftPackageManager, + operations: ApolloCodegenConfiguration.OperationsFileOutput = .inSchemaModule + ) throws -> IR.NamedFragment { + ir = try .mock(schema: schemaSDL, document: document) + let fragmentDefinition = try XCTUnwrap(ir.compilationResult[fragment: fragmentName]) + let fragment = ir.build(fragment: fragmentDefinition) + let config = ApolloCodegenConfiguration.mock( + schemaNamespace: schemaNamespace, + output: .mock(moduleType: moduleType, operations: operations), + options: .init() + ) + let mockTemplateRenderer = MockTemplateRenderer( + target: .operationFile, + template: "", + config: .init(config: config) + ) + subject = SelectionSetTemplate( + definition: .namedFragment(fragment), + generateInitializers: true, + config: ApolloCodegen.ConfigurationContext(config: config), + renderAccessControl: mockTemplateRenderer.accessControlModifier(for: .member) + ) + return fragment + } + func buildSimpleObjectSchemaAndDocument() { schemaSDL = """ type Query { @@ -1481,6 +1509,90 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { allAnimals_asPet_expected, atLine: 23, ignoringExtraLines: true)) } + /// This test verifies the fix for [#2989](https://github.com/apollographql/apollo-ios/issues/2989). + /// + /// When a fragment merges a type case from another fragment, the initializer at that type case + /// scope needs to include both the root and type case selection sets of the merged fragment. + /// + /// In this test, we are verifying that the `PredatorFragment.AsPet` selection set is included in + /// `fulfilledFragments`. + func test__render_givenNamedFragmentReferencingNamedFragmentInitializedAsTypeCaseFromChildFragment_fulfilledFragmentsIncludesChildFragmentTypeCase() throws { + // given + schemaSDL = """ + type Query { + allAnimals: [Animal!] + } + + interface Animal { + species: String! + predators: [Animal!] + } + + interface Pet { + name: String! + predators: [Animal!] + } + """ + + document = """ + query TestOperation { + allAnimals { + ...Fragment1 + } + } + + fragment Fragment1 on Animal { + predators { + ...PredatorFragment + } + } + + fragment PredatorFragment on Animal { + ... on Pet { + ...PetFragment + } + } + + fragment PetFragment on Pet { + name + } + """ + + let expected = + """ + public init( + __typename: String, + name: String + ) { + self.init(_dataDict: DataDict( + data: [ + "__typename": __typename, + "name": name, + ], + fulfilledFragments: [ + ObjectIdentifier(Self.self), + ObjectIdentifier(Fragment1.Predator.self), + ObjectIdentifier(PredatorFragment.self), + ObjectIdentifier(PredatorFragment.AsPet.self), + ObjectIdentifier(PetFragment.self) + ] + )) + } + """ + + // when + let fragment = try buildSubjectAndFragment(named: "Fragment1") + + let predators_asPet = try XCTUnwrap( + fragment[field: "predators"]?[as: "Pet"] + ) + + let actual = subject.render(inlineFragment: predators_asPet) + + // then + expect(actual).to(equalLineByLine(expected, atLine: 26, ignoringExtraLines: true)) + } + // MARK: - Include/Skip Tests func test__render_given_fieldWithInclusionCondition_rendersInitializerWithOptionalParameter() throws { From 135103fe1aa00419733fb1fd944bc730739bb0ba Mon Sep 17 00:00:00 2001 From: Anthony Miller Date: Thu, 8 Jun 2023 14:25:04 -0700 Subject: [PATCH 2/4] generated fulfilled fragments calculated using merged sources instead of just merged fragment selections --- .../Templates/SelectionSetTemplate.swift | 21 +++++++++++++------ ...ectionSetTemplate_Initializers_Tests.swift | 4 ++-- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Sources/ApolloCodegenLib/Templates/SelectionSetTemplate.swift b/Sources/ApolloCodegenLib/Templates/SelectionSetTemplate.swift index 6b962bfd8c..459b491dad 100644 --- a/Sources/ApolloCodegenLib/Templates/SelectionSetTemplate.swift +++ b/Sources/ApolloCodegenLib/Templates/SelectionSetTemplate.swift @@ -499,13 +499,22 @@ struct SelectionSetTemplate { fulfilledFragments.append(selectionSetName) } - let allFragments = IteratorSequence(selectionSet.selections.makeFragmentIterator()) - for fragment in allFragments { - if let conditions = fragment.inclusionConditions, - !selectionSet.typeInfo.scope.matches(conditions) { - continue + for source in selectionSet.selections.merged.mergedSources { + guard let fragment = source.fragment else { continue } + + var selectionSetNameComponents: [String] = [fragment.generatedDefinitionName] + fulfilledFragments.append(selectionSetNameComponents.joined(separator: ".")) + + var mergedFragmentEntityConditionPathNode = source.typeInfo.scopePath.last.value.scopePath.head + while let node = mergedFragmentEntityConditionPathNode.next { + defer { + mergedFragmentEntityConditionPathNode = node + } + selectionSetNameComponents.append( + SelectionSetNameGenerator.ConditionPath.path(for: node) + ) + fulfilledFragments.append(selectionSetNameComponents.joined(separator: ".")) } - fulfilledFragments.append(fragment.definition.name.firstUppercased) } return """ diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplate_Initializers_Tests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplate_Initializers_Tests.swift index ac13a42d09..f5427d0775 100644 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplate_Initializers_Tests.swift +++ b/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplate_Initializers_Tests.swift @@ -1572,9 +1572,9 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { fulfilledFragments: [ ObjectIdentifier(Self.self), ObjectIdentifier(Fragment1.Predator.self), + ObjectIdentifier(PetFragment.self), ObjectIdentifier(PredatorFragment.self), - ObjectIdentifier(PredatorFragment.AsPet.self), - ObjectIdentifier(PetFragment.self) + ObjectIdentifier(PredatorFragment.AsPet.self) ] )) } From bc2f3eed78bb9335d27bc248c6073749001da78f Mon Sep 17 00:00:00 2001 From: Anthony Miller Date: Thu, 8 Jun 2023 14:51:24 -0700 Subject: [PATCH 3/4] Fix formatting of root entity name when field is nested in fragment --- .../Templates/SelectionSetTemplate.swift | 51 +++++++---- ...ectionSetTemplate_Initializers_Tests.swift | 90 ++++++++++++++++++- 2 files changed, 123 insertions(+), 18 deletions(-) diff --git a/Sources/ApolloCodegenLib/Templates/SelectionSetTemplate.swift b/Sources/ApolloCodegenLib/Templates/SelectionSetTemplate.swift index 459b491dad..0efcb0cf81 100644 --- a/Sources/ApolloCodegenLib/Templates/SelectionSetTemplate.swift +++ b/Sources/ApolloCodegenLib/Templates/SelectionSetTemplate.swift @@ -500,21 +500,10 @@ struct SelectionSetTemplate { } for source in selectionSet.selections.merged.mergedSources { - guard let fragment = source.fragment else { continue } - - var selectionSetNameComponents: [String] = [fragment.generatedDefinitionName] - fulfilledFragments.append(selectionSetNameComponents.joined(separator: ".")) - - var mergedFragmentEntityConditionPathNode = source.typeInfo.scopePath.last.value.scopePath.head - while let node = mergedFragmentEntityConditionPathNode.next { - defer { - mergedFragmentEntityConditionPathNode = node - } - selectionSetNameComponents.append( - SelectionSetNameGenerator.ConditionPath.path(for: node) - ) - fulfilledFragments.append(selectionSetNameComponents.joined(separator: ".")) - } + fulfilledFragments + .append(contentsOf: source.generatedSelectionSetNamesOfFullfilledFragments( + pluralizer: config.pluralizer + )) } return """ @@ -702,6 +691,36 @@ fileprivate extension IR.MergedSelections.MergedSource { return selectionSetNameComponents.joined(separator: ".") } + func generatedSelectionSetNamesOfFullfilledFragments( + pluralizer: Pluralizer + ) -> [String] { + guard let fragment else { return [] } + + let entityRootNameInFragment = SelectionSetNameGenerator + .generatedSelectionSetName( + for: self, + to: typeInfo.scopePath.last.value.scopePath.head, + format: .fullyQualified, + pluralizer: pluralizer + ) + + var fulfilledFragments: [String] = [entityRootNameInFragment] + + var selectionSetNameComponents: [String] = [entityRootNameInFragment] + + var mergedFragmentEntityConditionPathNode = typeInfo.scopePath.last.value.scopePath.head + while let node = mergedFragmentEntityConditionPathNode.next { + defer { + mergedFragmentEntityConditionPathNode = node + } + selectionSetNameComponents.append( + SelectionSetNameGenerator.ConditionPath.path(for: node) + ) + fulfilledFragments.append(selectionSetNameComponents.joined(separator: ".")) + } + return fulfilledFragments + } + } fileprivate struct SelectionSetNameGenerator { @@ -731,11 +750,13 @@ fileprivate struct SelectionSetNameGenerator { static func generatedSelectionSetName( for mergedSource: IR.MergedSelections.MergedSource, + to toNode: LinkedList.Node? = nil, format: Format, pluralizer: Pluralizer ) -> String { generatedSelectionSetName( for: mergedSource.typeInfo, + to: toNode, format: format, pluralizer: pluralizer ) diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplate_Initializers_Tests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplate_Initializers_Tests.swift index f5427d0775..d6d68f2a5e 100644 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplate_Initializers_Tests.swift +++ b/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplate_Initializers_Tests.swift @@ -1343,8 +1343,8 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { ], fulfilledFragments: [ ObjectIdentifier(Self.self), - ObjectIdentifier(AnimalDetails.self), - ObjectIdentifier(Fragment2.self) + ObjectIdentifier(Fragment2.self), + ObjectIdentifier(AnimalDetails.self) ] )) } @@ -1509,7 +1509,7 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { allAnimals_asPet_expected, atLine: 23, ignoringExtraLines: true)) } - /// This test verifies the fix for [#2989](https://github.com/apollographql/apollo-ios/issues/2989). + /// Verifies the fix for [#2989](https://github.com/apollographql/apollo-ios/issues/2989). /// /// When a fragment merges a type case from another fragment, the initializer at that type case /// scope needs to include both the root and type case selection sets of the merged fragment. @@ -1593,6 +1593,90 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { expect(actual).to(equalLineByLine(expected, atLine: 26, ignoringExtraLines: true)) } + /// Verifies fix for [#2989](https://github.com/apollographql/apollo-ios/issues/2989). + /// + /// When a fragment merges a type case from another fragment, the initializer at that type case + /// scope needs to include both the root and type case selection sets of the merged fragment. + /// + /// In this test, we are verifying that the `PredatorFragment.Predator.AsPet` selection set is included in + /// `fulfilledFragments`. + func test__render_givenNamedFragmentWithNestedFieldMergedFromChildNamedFragmentInitializedAsTypeCaseFromChildFragment_fulfilledFragmentsIncludesChildFragmentTypeCase() throws { + // given + schemaSDL = """ + type Query { + allAnimals: [Animal!] + } + + interface Animal { + species: String! + predators: [Animal!] + } + + interface Pet { + name: String! + predators: [Animal!] + } + """ + + document = """ + query TestOperation { + allAnimals { + ...Fragment1 + } + } + + fragment Fragment1 on Animal { + ...PredatorFragment + } + + fragment PredatorFragment on Animal { + predators { + ... on Pet { + ...PetFragment + } + } + } + + fragment PetFragment on Pet { + name + } + """ + + let expected = + """ + public init( + __typename: String, + name: String + ) { + self.init(_dataDict: DataDict( + data: [ + "__typename": __typename, + "name": name, + ], + fulfilledFragments: [ + ObjectIdentifier(Self.self), + ObjectIdentifier(Fragment1.Predator.self), + ObjectIdentifier(PetFragment.self), + ObjectIdentifier(PredatorFragment.Predator.self), + ObjectIdentifier(PredatorFragment.Predator.AsPet.self) + ] + )) + } + """ + + // when + let fragment = try buildSubjectAndFragment(named: "Fragment1") + + let predators_asPet = try XCTUnwrap( + fragment[field: "predators"]?[as: "Pet"] + ) + + let actual = subject.render(inlineFragment: predators_asPet) + + // then + expect(actual).to(equalLineByLine(expected, atLine: 24, ignoringExtraLines: true)) + } + // MARK: - Include/Skip Tests func test__render_given_fieldWithInclusionCondition_rendersInitializerWithOptionalParameter() throws { From 070e27cb5c6e0e7b3a957117dba4e447a644d873 Mon Sep 17 00:00:00 2001 From: Anthony Miller Date: Thu, 8 Jun 2023 15:39:56 -0700 Subject: [PATCH 4/4] Make fulfilledFragments always use fully qualified name (removing Self.self) --- .../Templates/SelectionSetTemplate.swift | 12 ++- .../Templates/FragmentTemplateTests.swift | 6 +- .../OperationDefinitionTemplateTests.swift | 4 +- ...ectionSetTemplate_Initializers_Tests.swift | 76 ++++++++++--------- 4 files changed, 49 insertions(+), 49 deletions(-) diff --git a/Sources/ApolloCodegenLib/Templates/SelectionSetTemplate.swift b/Sources/ApolloCodegenLib/Templates/SelectionSetTemplate.swift index 0efcb0cf81..091ed6e6ab 100644 --- a/Sources/ApolloCodegenLib/Templates/SelectionSetTemplate.swift +++ b/Sources/ApolloCodegenLib/Templates/SelectionSetTemplate.swift @@ -483,15 +483,15 @@ struct SelectionSetTemplate { private func InitializerFulfilledFragments( _ selectionSet: IR.SelectionSet ) -> TemplateString { - var fulfilledFragments: [String] = ["Self"] + var fulfilledFragments: OrderedSet = [] - var next = selectionSet.scopePath.last.value.scopePath.head - while next.next != nil { - defer { next = next.next.unsafelyUnwrapped } + var currentNode = Optional(selectionSet.scopePath.last.value.scopePath.head) + while let node = currentNode { + defer { currentNode = node.next } let selectionSetName = SelectionSetNameGenerator.generatedSelectionSetName( for: selectionSet, - to: next, + to: node, format: .fullyQualified, pluralizer: config.pluralizer ) @@ -694,8 +694,6 @@ fileprivate extension IR.MergedSelections.MergedSource { func generatedSelectionSetNamesOfFullfilledFragments( pluralizer: Pluralizer ) -> [String] { - guard let fragment else { return [] } - let entityRootNameInFragment = SelectionSetNameGenerator .generatedSelectionSetName( for: self, diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/FragmentTemplateTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/FragmentTemplateTests.swift index 63fa453245..342c65c787 100644 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/FragmentTemplateTests.swift +++ b/Tests/ApolloCodegenTests/CodeGeneration/Templates/FragmentTemplateTests.swift @@ -413,7 +413,7 @@ class FragmentTemplateTests: XCTestCase { "species": species, ], fulfilledFragments: [ - ObjectIdentifier(Self.self) + ObjectIdentifier(TestFragment.self) ] )) } @@ -460,7 +460,7 @@ class FragmentTemplateTests: XCTestCase { "species": species, ], fulfilledFragments: [ - ObjectIdentifier(Self.self) + ObjectIdentifier(TestFragment.self) ] )) } @@ -567,7 +567,7 @@ class FragmentTemplateTests: XCTestCase { "species": species, ], fulfilledFragments: [ - ObjectIdentifier(Self.self) + ObjectIdentifier(TestFragment.self) ] )) } diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/OperationDefinitionTemplateTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/OperationDefinitionTemplateTests.swift index a65ccf27c2..91e9c2759d 100644 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/OperationDefinitionTemplateTests.swift +++ b/Tests/ApolloCodegenTests/CodeGeneration/Templates/OperationDefinitionTemplateTests.swift @@ -333,7 +333,7 @@ class OperationDefinitionTemplateTests: XCTestCase { "species": species, ], fulfilledFragments: [ - ObjectIdentifier(Self.self) + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) ] )) } @@ -381,7 +381,7 @@ class OperationDefinitionTemplateTests: XCTestCase { "species": species, ], fulfilledFragments: [ - ObjectIdentifier(Self.self) + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) ] )) } diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplate_Initializers_Tests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplate_Initializers_Tests.swift index d6d68f2a5e..cba5b7db9d 100644 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplate_Initializers_Tests.swift +++ b/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplate_Initializers_Tests.swift @@ -274,7 +274,7 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "species": species, ], fulfilledFragments: [ - ObjectIdentifier(Self.self) + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) ] )) } @@ -325,7 +325,7 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "species": species, ], fulfilledFragments: [ - ObjectIdentifier(Self.self) + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) ] )) } @@ -392,9 +392,9 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "species": species, ], fulfilledFragments: [ - ObjectIdentifier(Self.self), ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self), - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.AsAnimalUnion.self) + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.AsAnimalUnion.self), + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.AsAnimalUnion.AsDog.self) ] )) } @@ -457,9 +457,9 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "species": species, ], fulfilledFragments: [ - ObjectIdentifier(Self.self), ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self), - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.AsPet.self) + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.AsPet.self), + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.AsPet.AsWarmBlooded.self) ] )) } @@ -604,7 +604,7 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "nestedList_optional_optional_optional": nestedList_optional_optional_optional, ], fulfilledFragments: [ - ObjectIdentifier(Self.self) + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) ] )) } @@ -661,7 +661,7 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "fieldthree": fieldthree, ], fulfilledFragments: [ - ObjectIdentifier(Self.self) + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) ] )) } @@ -710,7 +710,7 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "aliased": aliased, ], fulfilledFragments: [ - ObjectIdentifier(Self.self) + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) ] )) } @@ -762,7 +762,7 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "friends": friends._fieldData, ], fulfilledFragments: [ - ObjectIdentifier(Self.self) + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) ] )) } @@ -814,7 +814,7 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "friends": friends._fieldData, ], fulfilledFragments: [ - ObjectIdentifier(Self.self) + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) ] )) } @@ -866,7 +866,7 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "friends": friends._fieldData, ], fulfilledFragments: [ - ObjectIdentifier(Self.self) + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) ] )) } @@ -918,7 +918,7 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "friend": friend._fieldData, ], fulfilledFragments: [ - ObjectIdentifier(Self.self) + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) ] )) } @@ -976,7 +976,7 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "__typename": __typename, ], fulfilledFragments: [ - ObjectIdentifier(Self.self) + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) ] )) } @@ -1028,7 +1028,7 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "friends": friends._fieldData, ], fulfilledFragments: [ - ObjectIdentifier(Self.self) + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) ] )) } @@ -1080,7 +1080,7 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "friend": friend._fieldData, ], fulfilledFragments: [ - ObjectIdentifier(Self.self) + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) ] )) } @@ -1143,8 +1143,8 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "age": age, ], fulfilledFragments: [ - ObjectIdentifier(Self.self), - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self), + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.AsPet.self) ] )) } @@ -1221,7 +1221,9 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "feet": feet, ], fulfilledFragments: [ - ObjectIdentifier(Self.self) + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.AsCat.Height.self), + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.Height.self), + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.AsPet.Height.self) ] )) } @@ -1278,7 +1280,7 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "species": species, ], fulfilledFragments: [ - ObjectIdentifier(Self.self), + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self), ObjectIdentifier(AnimalDetails.self) ] )) @@ -1342,7 +1344,7 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "species": species, ], fulfilledFragments: [ - ObjectIdentifier(Self.self), + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self), ObjectIdentifier(Fragment2.self), ObjectIdentifier(AnimalDetails.self) ] @@ -1405,8 +1407,8 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "species": species, ], fulfilledFragments: [ - ObjectIdentifier(Self.self), ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self), + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.AsPet.self), ObjectIdentifier(AnimalDetails.self) ] )) @@ -1464,7 +1466,7 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "__typename": __typename, ], fulfilledFragments: [ - ObjectIdentifier(Self.self) + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) ] )) } @@ -1482,8 +1484,8 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "species": species, ], fulfilledFragments: [ - ObjectIdentifier(Self.self), ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self), + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.AsPet.self), ObjectIdentifier(AnimalDetails.self) ] )) @@ -1570,8 +1572,8 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "name": name, ], fulfilledFragments: [ - ObjectIdentifier(Self.self), ObjectIdentifier(Fragment1.Predator.self), + ObjectIdentifier(Fragment1.Predator.AsPet.self), ObjectIdentifier(PetFragment.self), ObjectIdentifier(PredatorFragment.self), ObjectIdentifier(PredatorFragment.AsPet.self) @@ -1654,8 +1656,8 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "name": name, ], fulfilledFragments: [ - ObjectIdentifier(Self.self), ObjectIdentifier(Fragment1.Predator.self), + ObjectIdentifier(Fragment1.Predator.AsPet.self), ObjectIdentifier(PetFragment.self), ObjectIdentifier(PredatorFragment.Predator.self), ObjectIdentifier(PredatorFragment.Predator.AsPet.self) @@ -1711,7 +1713,7 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "name": name, ], fulfilledFragments: [ - ObjectIdentifier(Self.self) + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) ] )) } @@ -1769,8 +1771,8 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "friend": friend._fieldData, ], fulfilledFragments: [ - ObjectIdentifier(Self.self), - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self), + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.IfA.self) ] )) } @@ -1828,8 +1830,8 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "friend": friend._fieldData, ], fulfilledFragments: [ - ObjectIdentifier(Self.self), - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self), + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.IfAAndNotB.self) ] )) } @@ -1889,9 +1891,9 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "friend": friend._fieldData, ], fulfilledFragments: [ - ObjectIdentifier(Self.self), ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self), - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.IfA.self) + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.IfA.self), + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.IfA.IfNotB.self) ] )) } @@ -1951,8 +1953,8 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "species": species, ], fulfilledFragments: [ - ObjectIdentifier(Self.self), - ObjectIdentifier(TestOperationQuery.Data.AllAnimal.IfA.Friend.self) + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.IfA.Friend.self), + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.IfA.Friend.IfNotB.self) ] )) } @@ -2011,7 +2013,7 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "__typename": __typename, ], fulfilledFragments: [ - ObjectIdentifier(Self.self) + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self) ] )) } @@ -2029,8 +2031,8 @@ class SelectionSetTemplate_Initializers_Tests: XCTestCase { "species": species, ], fulfilledFragments: [ - ObjectIdentifier(Self.self), ObjectIdentifier(TestOperationQuery.Data.AllAnimal.self), + ObjectIdentifier(TestOperationQuery.Data.AllAnimal.IfA.self), ObjectIdentifier(AnimalDetails.self) ] ))