Skip to content

Commit 0908051

Browse files
committed
Run swiftformat
1 parent 9b732b7 commit 0908051

File tree

5 files changed

+18
-16
lines changed

5 files changed

+18
-16
lines changed

Sources/AWSLambdaEvents/APIGatewayLambdaAuthorizers.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,13 @@ public struct APIGatewayLambdaAuthorizerPolicyResponse: Codable {
8686
public let resource: [String]
8787

8888
public init(action: String, effect: Effect, resource: String) {
89-
self.action = [action]
90-
self.effect = effect
91-
self.resource = [resource]
89+
self.init(
90+
action: [action],
91+
effect: effect,
92+
resource: [resource]
93+
)
9294
}
93-
95+
9496
public init(action: [String], effect: Effect, resource: [String]) {
9597
self.action = action
9698
self.effect = effect

Sources/AWSLambdaEvents/DynamoDB.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ extension DynamoDBEvent.AttributeValue: Decodable {
234234
switch key {
235235
case .binary:
236236
let encoded = try container.decode(String.self, forKey: .binary)
237-
self = .binary(try encoded.base64decoded())
237+
self = try .binary(encoded.base64decoded())
238238

239239
case .bool:
240240
let value = try container.decode(Bool.self, forKey: .bool)
@@ -324,7 +324,7 @@ extension DynamoDBEvent {
324324
}
325325
}
326326

327-
@usableFromInline internal struct _DecoderImpl: Swift.Decoder {
327+
@usableFromInline struct _DecoderImpl: Swift.Decoder {
328328
@usableFromInline let codingPath: [CodingKey]
329329
@usableFromInline let userInfo: [CodingUserInfoKey: Any]
330330

Sources/AWSLambdaEvents/Utils/HTTP.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ extension HTTPHeaders {
3535
}
3636

3737
extension String {
38-
internal func isEqualCaseInsensitiveASCIIBytes(to: String) -> Bool {
38+
func isEqualCaseInsensitiveASCIIBytes(to: String) -> Bool {
3939
self.utf8.compareCaseInsensitiveASCIIBytes(to: to.utf8)
4040
}
4141
}
@@ -48,7 +48,7 @@ extension String.UTF8View {
4848
///
4949
/// - Parameter bytes: The string constant in the form of a collection of `UInt8`
5050
/// - Returns: Whether the collection contains **EXACTLY** this array or no, but by ignoring case.
51-
internal func compareCaseInsensitiveASCIIBytes(to: String.UTF8View) -> Bool {
51+
func compareCaseInsensitiveASCIIBytes(to: String.UTF8View) -> Bool {
5252
// fast path: we can get the underlying bytes of both
5353
let maybeMaybeResult = self.withContiguousStorageIfAvailable { lhsBuffer -> Bool? in
5454
to.withContiguousStorageIfAvailable { rhsBuffer in

Tests/AWSLambdaEventsTests/APIGatewayLambdaAuthorizerTest.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class APIGatewayLambdaAuthorizerTests: XCTestCase {
171171
XCTAssertNoThrow(data = try JSONEncoder().encode(resp))
172172

173173
var stringData: String?
174-
XCTAssertNoThrow(stringData = String(data: try XCTUnwrap(data), encoding: .utf8))
174+
XCTAssertNoThrow(stringData = try String(data: XCTUnwrap(data), encoding: .utf8))
175175

176176
data = stringData?.data(using: .utf8)
177177
XCTAssertNoThrow(resp = try JSONDecoder().decode(APIGatewayLambdaAuthorizerSimpleResponse.self, from: XCTUnwrap(data)))
@@ -194,7 +194,7 @@ class APIGatewayLambdaAuthorizerTests: XCTestCase {
194194
XCTAssertNoThrow(data = try JSONEncoder().encode(resp))
195195

196196
var stringData: String?
197-
XCTAssertNoThrow(stringData = String(data: try XCTUnwrap(data), encoding: .utf8))
197+
XCTAssertNoThrow(stringData = try String(data: XCTUnwrap(data), encoding: .utf8))
198198

199199
data = stringData?.data(using: .utf8)
200200
XCTAssertNoThrow(resp = try JSONDecoder().decode(APIGatewayLambdaAuthorizerPolicyResponse.self, from: XCTUnwrap(data)))
@@ -205,13 +205,13 @@ class APIGatewayLambdaAuthorizerTests: XCTestCase {
205205
XCTAssertEqual(resp.context?.count, 2)
206206
XCTAssertEqual(resp.context?["abc1"], "xyz1")
207207
}
208-
208+
209209
func testDecodingLambdaAuthorizerPolicyResponseWithMultipleResources() {
210210
let statement = APIGatewayLambdaAuthorizerPolicyResponse.PolicyDocument.Statement(action: ["execute-api:Invoke"],
211211
effect: .allow,
212212
resource: [
213-
"arn:aws:execute-api:*:*:*/*/GET/v1/user/0123",
214-
"arn:aws:execute-api:*:*:*/*/POST/v1/user",
213+
"arn:aws:execute-api:*:*:*/*/GET/v1/user/0123",
214+
"arn:aws:execute-api:*:*:*/*/POST/v1/user",
215215
])
216216
let policy = APIGatewayLambdaAuthorizerPolicyResponse.PolicyDocument(statement: [statement])
217217
var resp = APIGatewayLambdaAuthorizerPolicyResponse(principalId: "John Appleseed",
@@ -222,7 +222,7 @@ class APIGatewayLambdaAuthorizerTests: XCTestCase {
222222
XCTAssertNoThrow(data = try JSONEncoder().encode(resp))
223223

224224
var stringData: String?
225-
XCTAssertNoThrow(stringData = String(data: try XCTUnwrap(data), encoding: .utf8))
225+
XCTAssertNoThrow(stringData = try String(data: XCTUnwrap(data), encoding: .utf8))
226226

227227
data = stringData?.data(using: .utf8)
228228
XCTAssertNoThrow(resp = try JSONDecoder().decode(APIGatewayLambdaAuthorizerPolicyResponse.self, from: XCTUnwrap(data)))
@@ -233,7 +233,7 @@ class APIGatewayLambdaAuthorizerTests: XCTestCase {
233233
XCTAssertEqual(resp.policyDocument.statement[0].resource, [
234234
"arn:aws:execute-api:*:*:*/*/GET/v1/user/0123",
235235
"arn:aws:execute-api:*:*:*/*/POST/v1/user",
236-
])
236+
])
237237
XCTAssertEqual(resp.context?.count, 2)
238238
XCTAssertEqual(resp.context?["abc1"], "xyz1")
239239
}

Tests/AWSLambdaEventsTests/CloudFormationTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class CloudFormationTests: XCTestCase {
178178
XCTAssertNoThrow(data = try encoder.encode(resp))
179179

180180
var stringData: String?
181-
XCTAssertNoThrow(stringData = String(data: try XCTUnwrap(data), encoding: .utf8))
181+
XCTAssertNoThrow(stringData = try String(data: XCTUnwrap(data), encoding: .utf8))
182182

183183
print(stringData ?? "")
184184

0 commit comments

Comments
 (0)