Skip to content

Commit d35e827

Browse files
authored
Remove extension for JSONEncoder and JSONDecoder (#257)
motivation: we should not publicly extend types we do not own change: remove extensions which are largely API sugar that is not directly related to Lambda
1 parent 3c3529b commit d35e827

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

Sources/AWSLambdaRuntime/Lambda+Codable.swift

-14
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,3 @@ extension JSONEncoder: LambdaCodableEncoder {
7676
return buffer
7777
}
7878
}
79-
80-
extension JSONEncoder {
81-
/// Convenience method to allow encoding json directly into a `String`. It can be used to encode a payload into an `APIGateway.V2.Response`'s body.
82-
public func encodeAsString<T: Encodable>(_ value: T) throws -> String {
83-
try String(decoding: self.encode(value), as: Unicode.UTF8.self)
84-
}
85-
}
86-
87-
extension JSONDecoder {
88-
/// Convenience method to allow decoding json directly from a `String`. It can be used to decode a payload from an `APIGateway.V2.Request`'s body.
89-
public func decode<T: Decodable>(_ type: T.Type, from string: String) throws -> T {
90-
try self.decode(type, from: Data(string.utf8))
91-
}
92-
}

0 commit comments

Comments
 (0)