Skip to content

Commit

Permalink
fix Array JSONEncodable
Browse files Browse the repository at this point in the history
  • Loading branch information
arnauddorgans committed Nov 8, 2023
1 parent 285f865 commit ec8832d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion apollo-ios/Sources/ApolloAPI/GraphQLOperation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public protocol GraphQLOperationVariableValue {
}

extension Array: GraphQLOperationVariableValue
where Element: GraphQLOperationVariableValue & Hashable {}
where Element: GraphQLOperationVariableValue & JSONEncodable & Hashable {}

extension Dictionary: GraphQLOperationVariableValue
where Key == String, Value == GraphQLOperationVariableValue {
Expand Down
10 changes: 2 additions & 8 deletions apollo-ios/Sources/ApolloAPI/JSONStandardTypeConversions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 JSONEncodable = element {
return element._jsonValue
} else {
fatalError("Array is only JSONEncodable if Element is")
}
}
map(\._jsonValue)
}
}

0 comments on commit ec8832d

Please sign in to comment.