From cebdea8c4072fcf725a18bb9bb72e7d8bb67e9af Mon Sep 17 00:00:00 2001 From: Paul Toffoloni Date: Mon, 23 Sep 2024 18:26:17 +0200 Subject: [PATCH] Update CI --- .github/workflows/test.yml | 2 +- Sources/JWTKit/Claims/LocaleClaim.swift | 6 ++--- .../Utilities/CustomizedJSONCoders.swift | 24 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dbe790f5..0bad457e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,7 +30,7 @@ jobs: uses: vapor/ci/.github/workflows/run-unit-tests.yml@main with: with_api_check: ${{ github.event_name == 'pull_request' }} - extra_flags: -Xswiftc -warnings-as-errors + warnings_as_errors: true secrets: inherit ios-tests: diff --git a/Sources/JWTKit/Claims/LocaleClaim.swift b/Sources/JWTKit/Claims/LocaleClaim.swift index 42542ce1..e358afd1 100644 --- a/Sources/JWTKit/Claims/LocaleClaim.swift +++ b/Sources/JWTKit/Claims/LocaleClaim.swift @@ -1,7 +1,7 @@ #if compiler(<6.0) && !canImport(Darwin) -@preconcurrency import Foundation + @preconcurrency import Foundation #else -import Foundation + import Foundation #endif public struct LocaleClaim: JWTClaim, Equatable, ExpressibleByStringLiteral { @@ -26,6 +26,6 @@ public struct LocaleClaim: JWTClaim, Equatable, ExpressibleByStringLiteral { /// See `Encodable`. public func encode(to encoder: Encoder) throws { var container = encoder.singleValueContainer() - try container.encode(self.value.identifier) + try container.encode(value.identifier) } } diff --git a/Sources/JWTKit/Utilities/CustomizedJSONCoders.swift b/Sources/JWTKit/Utilities/CustomizedJSONCoders.swift index b68bc182..1855fb53 100644 --- a/Sources/JWTKit/Utilities/CustomizedJSONCoders.swift +++ b/Sources/JWTKit/Utilities/CustomizedJSONCoders.swift @@ -9,15 +9,15 @@ public protocol JWTJSONEncoder: Sendable { } #if compiler(<6.0) && !canImport(Darwin) -extension JSONDecoder: JWTJSONDecoder, @unchecked Sendable {} -extension JSONEncoder: JWTJSONEncoder, @unchecked Sendable {} + extension JSONDecoder: JWTJSONDecoder, @unchecked Sendable {} + extension JSONEncoder: JWTJSONEncoder, @unchecked Sendable {} #else -extension JSONDecoder: JWTJSONDecoder {} -extension JSONEncoder: JWTJSONEncoder {} + extension JSONDecoder: JWTJSONDecoder {} + extension JSONEncoder: JWTJSONEncoder {} #endif -public extension JSONDecoder.DateDecodingStrategy { - static var integerSecondsSince1970: Self { +extension JSONDecoder.DateDecodingStrategy { + public static var integerSecondsSince1970: Self { .custom { decoder in let container = try decoder.singleValueContainer() return try Date(timeIntervalSince1970: Double(container.decode(Int.self))) @@ -25,8 +25,8 @@ public extension JSONDecoder.DateDecodingStrategy { } } -public extension JSONEncoder.DateEncodingStrategy { - static var integerSecondsSince1970: Self { +extension JSONEncoder.DateEncodingStrategy { + public static var integerSecondsSince1970: Self { .custom { date, encoder in var container = encoder.singleValueContainer() try container.encode(Int(date.timeIntervalSince1970.rounded(.towardZero))) @@ -34,16 +34,16 @@ public extension JSONEncoder.DateEncodingStrategy { } } -public extension JWTJSONEncoder where Self == JSONEncoder { - static var defaultForJWT: any JWTJSONEncoder { +extension JWTJSONEncoder where Self == JSONEncoder { + public static var defaultForJWT: any JWTJSONEncoder { let encoder = JSONEncoder() encoder.dateEncodingStrategy = .secondsSince1970 return encoder } } -public extension JWTJSONDecoder where Self == JSONDecoder { - static var defaultForJWT: any JWTJSONDecoder { +extension JWTJSONDecoder where Self == JSONDecoder { + public static var defaultForJWT: any JWTJSONDecoder { let decoder = JSONDecoder() decoder.dateDecodingStrategy = .secondsSince1970 return decoder