From afd91c39309ce17d6791c391bb0115b610904762 Mon Sep 17 00:00:00 2001 From: Calvin Cestari <146856+calvincestari@users.noreply.github.com> Date: Tue, 28 Jan 2025 14:09:22 -0800 Subject: [PATCH] Improves inline documentation --- .../Sources/IR/GraphQLCompositeType+Identifiable.swift | 1 + apollo-ios-codegen/Sources/IR/IR+ComputedSelectionSet.swift | 3 ++- apollo-ios-codegen/Sources/IR/IR+NamedFragment.swift | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apollo-ios-codegen/Sources/IR/GraphQLCompositeType+Identifiable.swift b/apollo-ios-codegen/Sources/IR/GraphQLCompositeType+Identifiable.swift index 8f6ea03c2..508400ea4 100644 --- a/apollo-ios-codegen/Sources/IR/GraphQLCompositeType+Identifiable.swift +++ b/apollo-ios-codegen/Sources/IR/GraphQLCompositeType+Identifiable.swift @@ -1,6 +1,7 @@ import GraphQLCompiler extension GraphQLCompositeType { + /// Indicates if the type has a single keyField named `id`. var isIdentifiable: Bool { switch(self) { case let interface as GraphQLInterfaceType: diff --git a/apollo-ios-codegen/Sources/IR/IR+ComputedSelectionSet.swift b/apollo-ios-codegen/Sources/IR/IR+ComputedSelectionSet.swift index b1388a7a2..fea78a70d 100644 --- a/apollo-ios-codegen/Sources/IR/IR+ComputedSelectionSet.swift +++ b/apollo-ios-codegen/Sources/IR/IR+ComputedSelectionSet.swift @@ -20,7 +20,8 @@ public struct ComputedSelectionSet { /// The `TypeInfo` for the selection set of the computed selections public let typeInfo: IR.SelectionSet.TypeInfo - /// Indicates if the parent type has a single keyField named `id`. + /// Indicates if a field named `id` is selected as well as requiring that the parent type + /// be identifiable. public var isIdentifiable: Bool { guard direct?.fields["id"] != nil || merged.fields["id"] != nil else { return false diff --git a/apollo-ios-codegen/Sources/IR/IR+NamedFragment.swift b/apollo-ios-codegen/Sources/IR/IR+NamedFragment.swift index db125c329..a94a7a0a0 100644 --- a/apollo-ios-codegen/Sources/IR/IR+NamedFragment.swift +++ b/apollo-ios-codegen/Sources/IR/IR+NamedFragment.swift @@ -23,7 +23,8 @@ public class NamedFragment: Definition, Hashable, CustomDebugStringConvertible { public var type: GraphQLCompositeType { definition.type } public var isLocalCacheMutation: Bool { definition.isLocalCacheMutation } - /// Indicates if the parent type has a single keyField named `id`. + /// Indicates if a field named `id` is selected as well as requiring that the parent type + /// be identifiable. public var isIdentifiable: Bool { guard definition.selectionSet.selections.contains(where: { guard case .field(let field) = $0 else { return false }