Skip to content

Commit 1e137c0

Browse files
committed
fix swift 6 errors
1 parent e23be91 commit 1e137c0

17 files changed

Lines changed: 45 additions & 44 deletions

Package.resolved

Lines changed: 12 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ let package = Package(
1717
targets: ["JSONAPITesting"])
1818
],
1919
dependencies: [
20-
.package(url: "https://github.com/mattpolzin/Poly.git", .upToNextMajor(from: "2.8.0")),
20+
.package(url: "https://github.com/mattpolzin/Poly.git", .upToNextMajor(from: "3.0.0")),
2121
],
2222
targets: [
2323
.target(

Sources/JSONAPI/Document/APIDescription.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77

88
/// This is what the JSON API Spec calls the "JSON:API Object"
9-
public protocol APIDescriptionType: Codable, Equatable {
10-
associatedtype Meta
9+
public protocol APIDescriptionType: Codable, Equatable, Sendable {
10+
associatedtype Meta: Sendable
1111
}
1212

1313
/// This is what the JSON API Spec calls the "JSON:API Object"

Sources/JSONAPI/Document/Document.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import Poly
99

10-
public protocol DocumentBodyDataContext {
10+
public protocol DocumentBodyDataContext: Sendable {
1111
associatedtype PrimaryResourceBody: JSONAPI.EncodableResourceBody
1212
associatedtype MetaType: JSONAPI.Meta
1313
associatedtype LinksType: JSONAPI.Links
@@ -147,7 +147,7 @@ public protocol CodableJSONAPIDocument: EncodableJSONAPIDocument, Decodable wher
147147
/// API uses snake case, you will want to use
148148
/// a conversion such as the one offerred by the
149149
/// Foundation JSONEncoder/Decoder: `KeyDecodingStrategy`
150-
public struct Document<PrimaryResourceBody: JSONAPI.EncodableResourceBody, MetaType: JSONAPI.Meta, LinksType: JSONAPI.Links, IncludeType: JSONAPI.Include, APIDescription: APIDescriptionType, Error: JSONAPIError>: EncodableJSONAPIDocument, SucceedableJSONAPIDocument, FailableJSONAPIDocument {
150+
public struct Document<PrimaryResourceBody: JSONAPI.EncodableResourceBody, MetaType: JSONAPI.Meta, LinksType: JSONAPI.Links, IncludeType: JSONAPI.Include, APIDescription: APIDescriptionType, Error: JSONAPIError>: EncodableJSONAPIDocument, SucceedableJSONAPIDocument, FailableJSONAPIDocument, Sendable {
151151
public typealias Include = IncludeType
152152
public typealias BodyData = Body.Data
153153

Sources/JSONAPI/Document/Includes.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Created by Mathew Polzin on 11/10/18.
66
//
77

8-
import Poly
8+
@preconcurrency import Poly
99

1010
public typealias Include = EncodableJSONPoly
1111

@@ -19,7 +19,7 @@ public typealias Include = EncodableJSONPoly
1919
/// then you can access all `Thing1` included resources with
2020
///
2121
/// let includedThings = includes[Thing1.self]
22-
public struct Includes<I: Include>: Encodable, Equatable {
22+
public struct Includes<I: Include>: Encodable, Equatable, Sendable {
2323
public static var none: Includes { return .init(values: []) }
2424

2525
public let values: [I]

Sources/JSONAPI/Document/ResourceBody.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ extension Optional: OptionalCodablePrimaryResource where Wrapped: CodablePrimary
2929
/// An `EncodableResourceBody` is a `ResourceBody` that only supports being
3030
/// encoded. It is actually weaker than `ResourceBody`, which supports both encoding
3131
/// and decoding.
32-
public protocol EncodableResourceBody: Equatable, Encodable {
33-
associatedtype PrimaryResource
32+
public protocol EncodableResourceBody: Equatable, Encodable, Sendable {
33+
associatedtype PrimaryResource: Sendable
3434
}
3535

3636
/// A `CodableResourceBody` is a representation of the body of the JSON:API Document.
@@ -57,7 +57,7 @@ public protocol SingleResourceBodyProtocol: EncodableResourceBody {
5757
/// A type allowing for a document body containing 1 primary resource.
5858
/// If the `Entity` specialization is an `Optional` type, the body can contain
5959
/// 0 or 1 primary resources.
60-
public struct SingleResourceBody<PrimaryResource: JSONAPI.OptionalEncodablePrimaryResource>: SingleResourceBodyProtocol {
60+
public struct SingleResourceBody<PrimaryResource: JSONAPI.OptionalEncodablePrimaryResource & Sendable>: SingleResourceBodyProtocol {
6161
public let value: PrimaryResource
6262

6363
public init(resourceObject: PrimaryResource) {
@@ -72,7 +72,7 @@ public protocol ManyResourceBodyProtocol: EncodableResourceBody {
7272
}
7373

7474
/// A type allowing for a document body containing 0 or more primary resources.
75-
public struct ManyResourceBody<PrimaryResource: JSONAPI.EncodablePrimaryResource>: ManyResourceBodyProtocol, ResourceBodyAppendable {
75+
public struct ManyResourceBody<PrimaryResource: JSONAPI.EncodablePrimaryResource & Sendable>: ManyResourceBodyProtocol, ResourceBodyAppendable {
7676
public let values: [PrimaryResource]
7777

7878
public init(resourceObjects: [PrimaryResource]) {

Sources/JSONAPI/Error/BasicJSONAPIError.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77

88
/// Most of the JSON:API Spec defined Error fields.
9-
public struct BasicJSONAPIErrorPayload<IdType: Codable & Equatable>: Codable, Equatable, ErrorDictType, CustomStringConvertible {
9+
public struct BasicJSONAPIErrorPayload<IdType: Codable & Equatable & Sendable>: Codable, Equatable, ErrorDictType, CustomStringConvertible, Sendable {
1010
/// a unique identifier for this particular occurrence of the problem
1111
public let id: IdType?
1212

@@ -39,7 +39,7 @@ public struct BasicJSONAPIErrorPayload<IdType: Codable & Equatable>: Codable, Eq
3939
self.source = source
4040
}
4141

42-
public struct Source: Codable, Equatable {
42+
public struct Source: Codable, Equatable, Sendable {
4343
/// a JSON Pointer [RFC6901] to the associated entity in the request document [e.g. "/data" for a primary data object, or "/data/attributes/title" for a specific attribute].
4444
public let pointer: String?
4545
/// which URI query parameter caused the error
@@ -100,4 +100,4 @@ public struct BasicJSONAPIErrorPayload<IdType: Codable & Equatable>: Codable, Eq
100100
/// with non-nil values in a flattened way. There will be no `source` key
101101
/// but there will be `pointer` and `parameter` keys (if those values
102102
/// are non-nil).
103-
public typealias BasicJSONAPIError<IdType: Codable & Equatable> = GenericJSONAPIError<BasicJSONAPIErrorPayload<IdType>>
103+
public typealias BasicJSONAPIError<IdType: Codable & Equatable & Sendable> = GenericJSONAPIError<BasicJSONAPIErrorPayload<IdType>>

Sources/JSONAPI/Error/GenericJSONAPIError.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/// `GenericJSONAPIError` can be used to specify whatever error
99
/// payload you expect to need to parse in responses and handle any
1010
/// other payload structure as `.unknownError`.
11-
public enum GenericJSONAPIError<ErrorPayload: Codable & Equatable>: JSONAPIError, CustomStringConvertible {
11+
public enum GenericJSONAPIError<ErrorPayload: Codable & Equatable & Sendable>: JSONAPIError, CustomStringConvertible {
1212
case unknownError
1313
case error(ErrorPayload)
1414

Sources/JSONAPI/Error/JSONAPIError.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Created by Mathew Polzin on 11/10/18.
66
//
77

8-
public protocol JSONAPIError: Swift.Error, Equatable, Codable {
8+
public protocol JSONAPIError: Swift.Error, Equatable, Codable, Sendable {
99
static var unknown: Self { get }
1010
}
1111

Sources/JSONAPI/JSONAPICodingError.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
// Created by Mathew Polzin on 12/7/18.
66
//
77

8-
public enum JSONAPICodingError: Swift.Error {
8+
public enum JSONAPICodingError: Swift.Error, Sendable {
99
case typeMismatch(expected: String, found: String, path: [CodingKey])
1010
case quantityMismatch(expected: Quantity, path: [CodingKey])
1111
case illegalEncoding(String, path: [CodingKey])
1212
case illegalDecoding(String, path: [CodingKey])
1313
case missingOrMalformedMetadata(path: [CodingKey])
1414
case missingOrMalformedLinks(path: [CodingKey])
1515

16-
public enum Quantity: String, Equatable {
16+
public enum Quantity: String, Equatable, Sendable {
1717
case one
1818
case many
1919

0 commit comments

Comments
 (0)