Skip to content

Commit

Permalink
fix Array JSONEncodable (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
arnauddorgans authored and gh-action-runner committed Jul 29, 2024
1 parent fc1f1d2 commit 745fdc9
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 @@ -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 {
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 any JSONEncodable = element {
return element._jsonValue
} else {
fatalError("Array is only JSONEncodable if Element is")
}
}
map(\._jsonValue)
}
}

0 comments on commit 745fdc9

Please sign in to comment.