From 2e6af98a5e55e06e80174a2a9d5ba9dd028e60a3 Mon Sep 17 00:00:00 2001 From: Anthony Miller Date: Thu, 22 Aug 2024 15:15:42 -0700 Subject: [PATCH] Bring back deprecated CodingKey for localCacheMutation in selectionSetInitializers --- ...polloCodegenConfigurationCodableTests.swift | 18 ++++++++++++++++++ .../ApolloCodegenConfiguration.swift | 4 ++++ 2 files changed, 22 insertions(+) diff --git a/Tests/ApolloCodegenTests/ApolloCodegenConfigurationCodableTests.swift b/Tests/ApolloCodegenTests/ApolloCodegenConfigurationCodableTests.swift index 2563a1f38..aee606c90 100644 --- a/Tests/ApolloCodegenTests/ApolloCodegenConfigurationCodableTests.swift +++ b/Tests/ApolloCodegenTests/ApolloCodegenConfigurationCodableTests.swift @@ -602,6 +602,24 @@ class ApolloCodegenConfigurationCodableTests: XCTestCase { expect(decoded).to(equal(expected)) } + func test__decode_selectionSetInitializers__givenLocalCacheMutations_shouldReturnIgnoreOption() throws { + // given + let subject = """ + { + "localCacheMutations": true + } + """.asData + + // when + let decoded = try JSONDecoder().decode( + ApolloCodegenConfiguration.SelectionSetInitializers.self, + from: subject + ) + + // then + expect(decoded).to(equal([])) + } + // MARK: - OperationDocumentFormat Tests func encodedValue(_ case: ApolloCodegenConfiguration.OperationDocumentFormat) -> String { diff --git a/apollo-ios-codegen/Sources/ApolloCodegenLib/ApolloCodegenConfiguration.swift b/apollo-ios-codegen/Sources/ApolloCodegenLib/ApolloCodegenConfiguration.swift index 512f2d69a..3219bd6af 100644 --- a/apollo-ios-codegen/Sources/ApolloCodegenLib/ApolloCodegenConfiguration.swift +++ b/apollo-ios-codegen/Sources/ApolloCodegenLib/ApolloCodegenConfiguration.swift @@ -1263,6 +1263,10 @@ extension ApolloCodegenConfiguration.SelectionSetInitializers { case operations case namedFragments case definitionsNamed + + /// Deprecated + /// Local Cache Mutations will now always have initializers generated. + case localCacheMutations } public init(from decoder: any Decoder) throws {