diff --git a/apollo-ios/Sources/ApolloAPI/GraphQLOperation.swift b/apollo-ios/Sources/ApolloAPI/GraphQLOperation.swift index 68dae8b91..068c11802 100644 --- a/apollo-ios/Sources/ApolloAPI/GraphQLOperation.swift +++ b/apollo-ios/Sources/ApolloAPI/GraphQLOperation.swift @@ -153,7 +153,7 @@ public protocol GraphQLOperationVariableValue { } extension Array: GraphQLOperationVariableValue -where Element: GraphQLOperationVariableValue & Hashable {} +where Element: GraphQLOperationVariableValue & JSONEncodable & Hashable {} extension Dictionary: GraphQLOperationVariableValue where Key == String, Value == any GraphQLOperationVariableValue { diff --git a/apollo-ios/Sources/ApolloAPI/JSONStandardTypeConversions.swift b/apollo-ios/Sources/ApolloAPI/JSONStandardTypeConversions.swift index a531fee4b..39079643e 100644 --- a/apollo-ios/Sources/ApolloAPI/JSONStandardTypeConversions.swift +++ b/apollo-ios/Sources/ApolloAPI/JSONStandardTypeConversions.swift @@ -147,14 +147,8 @@ extension JSONObject: JSONDecodable { } } -extension Array: JSONEncodable { +extension Array: JSONEncodable where Element: JSONEncodable { @inlinable public var _jsonValue: JSONValue { - return map { element -> JSONValue in - if case let element as any JSONEncodable = element { - return element._jsonValue - } else { - fatalError("Array is only JSONEncodable if Element is") - } - } + map(\._jsonValue) } }