Skip to content

Commit

Permalink
Squashed 'apollo-ios/' changes from 39098c59..9d0bb802
Browse files Browse the repository at this point in the history
9d0bb802 fix Array JSONEncodable (#128)

git-subtree-dir: apollo-ios
git-subtree-split: 9d0bb802d9eb8aaa9ede384461824779807dff0b
  • Loading branch information
gh-action-runner authored and gh-action-runner committed Jul 29, 2024
1 parent deac509 commit 17df440
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion 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 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 17df440

Please sign in to comment.