Skip to content

Commit 07503f2

Browse files
committed
a few less controversial changes for starters
1 parent 8c15b78 commit 07503f2

6 files changed

Lines changed: 13 additions & 9 deletions

File tree

Sources/JSONAPI/Error/BasicJSONAPIError.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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
@@ -70,6 +70,8 @@ public struct BasicJSONAPIErrorPayload<IdType: Codable & Equatable>: Codable, Eq
7070
}
7171
}
7272

73+
extension BasicJSONAPIErrorPayload: Sendable where IdType: Sendable {}
74+
7375
/// `BasicJSONAPIError` optionally decodes many possible fields
7476
/// specified by the JSON:API 1.0 Spec. It gives no type-guarantees of what
7577
/// will be non-nil, but could provide good diagnostic information when
@@ -100,4 +102,4 @@ public struct BasicJSONAPIErrorPayload<IdType: Codable & Equatable>: Codable, Eq
100102
/// with non-nil values in a flattened way. There will be no `source` key
101103
/// but there will be `pointer` and `parameter` keys (if those values
102104
/// are non-nil).
103-
public typealias BasicJSONAPIError<IdType: Codable & Equatable> = GenericJSONAPIError<BasicJSONAPIErrorPayload<IdType>>
105+
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/JSONAPICodingError.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public enum JSONAPICodingError: Swift.Error {
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

Sources/JSONAPI/Resource/Id.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ extension String: RawIdType {}
3131
/// A type that can be used as the `MaybeRawId` for a `ResourceObject` that does not
3232
/// have an Id (most likely because it was created by a client and the server will be responsible
3333
/// for assigning it an Id).
34-
public struct Unidentified: MaybeRawId, CustomStringConvertible {
34+
public struct Unidentified: MaybeRawId, CustomStringConvertible, Sendable {
3535
public init() {}
3636

3737
public var description: String { return "Unidentified" }

Sources/JSONAPI/Resource/Poly+PrimaryResource.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ import Poly
1515
/// disparate types under one roof for
1616
/// the purposes of JSON API compliant
1717
/// encoding or decoding.
18-
public typealias EncodableJSONPoly = Poly & EncodablePrimaryResource
18+
public typealias EncodableJSONPoly = Poly & EncodablePrimaryResource & Sendable
1919

2020
public typealias EncodablePolyWrapped = Encodable & Equatable
2121
public typealias CodablePolyWrapped = EncodablePolyWrapped & Decodable
2222

23-
extension Poly0: CodablePrimaryResource {
23+
extension Poly0: @retroactive Encodable, @retroactive Decodable {
2424
public init(from decoder: Decoder) throws {
2525
throw JSONAPICodingError.illegalDecoding("Attempted to decode Poly0, which should represent a thing that is not expected to be found in a document.", path: decoder.codingPath)
2626
}
@@ -30,6 +30,8 @@ extension Poly0: CodablePrimaryResource {
3030
}
3131
}
3232

33+
extension Poly0: CodablePrimaryResource {}
34+
3335
// MARK: - 1 type
3436
extension Poly1: EncodablePrimaryResource, OptionalEncodablePrimaryResource
3537
where A: EncodablePolyWrapped {}

Sources/JSONAPI/Resource/Resource Object/ResourceObjectDecodingError.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public struct ResourceObjectDecodingError: Swift.Error, Equatable {
1313

1414
static let entireObject = "entire object"
1515

16-
public enum Cause: Equatable {
16+
public enum Cause: Equatable, Sendable {
1717
case keyNotFound
1818
case valueNotFound
1919
case typeMismatch(expectedTypeName: String)
@@ -26,7 +26,7 @@ public struct ResourceObjectDecodingError: Swift.Error, Equatable {
2626
}
2727
}
2828

29-
public enum Location: String, Equatable {
29+
public enum Location: String, Equatable, Sendable {
3030
case attributes
3131
case relationships
3232
case relationshipType

0 commit comments

Comments
 (0)