Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Array JSONEncodable #128

Merged
merged 2 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}
}
Loading