Skip to content

Commit 1d1f322

Browse files
authored
Merge pull request #389 from mattpolzin/enable-strict-concurrency-in-ci
2 parents c5aa61b + bb4bf69 commit 1d1f322

File tree

146 files changed

+523
-373
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+523
-373
lines changed

.github/workflows/tests.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Checkout code
3030
uses: actions/checkout@v4
3131
- name: Run tests
32-
run: swift test
32+
run: swift test -Xswiftc -strict-concurrency=complete
3333
osx:
3434
strategy:
3535
fail-fast: false
@@ -46,4 +46,4 @@ jobs:
4646
- name: Checkout code
4747
uses: actions/checkout@v4
4848
- name: Run tests
49-
run: swift test
49+
run: swift test -Xswiftc -strict-concurrency=complete

Sources/OpenAPIKit/CodableVendorExtendable.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ extension CodableVendorExtendable {
9898
throw VendorExtensionDecodingError.selfIsArrayNotDict
9999
}
100100

101-
guard let decodedAny = decoded as? [String: Any] else {
101+
guard let decodedAny = decoded as? [String: any Sendable] else {
102102
throw VendorExtensionDecodingError.foundNonStringKeys
103103
}
104104

Sources/OpenAPIKit/Components Object/Components.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ extension OpenAPI {
1515
///
1616
/// This is a place to put reusable components to
1717
/// be referenced from other parts of the spec.
18-
public struct Components: Equatable, CodableVendorExtendable {
18+
public struct Components: Equatable, CodableVendorExtendable, Sendable {
1919

2020
public var schemas: ComponentDictionary<JSONSchema>
2121
public var responses: ComponentDictionary<Response>

Sources/OpenAPIKit/Content/Content.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ extension OpenAPI {
1111
/// OpenAPI Spec "Media Type Object"
1212
///
1313
/// See [OpenAPI Media Type Object](https://spec.openapis.org/oas/v3.1.1.html#media-type-object).
14-
public struct Content: Equatable, CodableVendorExtendable {
14+
public struct Content: Equatable, CodableVendorExtendable, Sendable {
1515
public var schema: Either<OpenAPI.Reference<JSONSchema>, JSONSchema>?
1616
public var example: AnyCodable?
1717
public var examples: Example.Map?

Sources/OpenAPIKit/Content/ContentEncoding.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ extension OpenAPI.Content {
1111
/// OpenAPI Spec "Encoding Object"
1212
///
1313
/// See [OpenAPI Encoding Object](https://spec.openapis.org/oas/v3.1.1.html#encoding-object).
14-
public struct Encoding: Equatable {
14+
public struct Encoding: Equatable, Sendable {
1515
public typealias Style = OpenAPI.Parameter.SchemaContext.Style
1616

1717
public let contentTypes: [OpenAPI.ContentType]

Sources/OpenAPIKit/Encoding and Decoding Errors/DocumentDecodingError.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ extension OpenAPI.Error.Decoding {
1212
public let context: Context
1313
public let codingPath: [CodingKey]
1414

15-
public enum Context {
15+
public enum Context: Sendable {
1616
case path(Path)
1717
case inconsistency(InconsistencyError)
1818
case other(Swift.DecodingError)

Sources/OpenAPIKit/Encoding and Decoding Errors/OperationDecodingError.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ extension OpenAPI.Error.Decoding {
1313
public let context: Context
1414
internal let relativeCodingPath: [CodingKey]
1515

16-
public enum Context {
16+
public enum Context: Sendable {
1717
case request(Request)
1818
case response(Response)
1919
case inconsistency(InconsistencyError)

Sources/OpenAPIKit/Encoding and Decoding Errors/PathDecodingError.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ extension OpenAPI.Error.Decoding {
1313
public let context: Context
1414
internal let relativeCodingPath: [CodingKey]
1515

16-
public enum Context {
16+
public enum Context: Sendable {
1717
case endpoint(Operation)
1818
case inconsistency(InconsistencyError)
1919
case other(Swift.DecodingError)

Sources/OpenAPIKit/Encoding and Decoding Errors/ResponseDecodingError.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ extension OpenAPI.Error.Decoding {
1313
public let context: Context
1414
internal let relativeCodingPath: [CodingKey]
1515

16-
public enum Context {
16+
public enum Context: Sendable {
1717
case inconsistency(InconsistencyError)
1818
case other(Swift.DecodingError)
1919
case neither(EitherDecodeNoTypesMatchedError)

Sources/OpenAPIKit/Example.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ extension OpenAPI {
1212
/// OpenAPI Spec "Example Object"
1313
///
1414
/// See [OpenAPI Example Object](https://spec.openapis.org/oas/v3.1.1.html#example-object).
15-
public struct Example: Equatable, CodableVendorExtendable {
15+
public struct Example: Equatable, CodableVendorExtendable, Sendable {
1616
public let summary: String?
1717
public let description: String?
1818

Sources/OpenAPIKit/ExternalDocumentation.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ extension OpenAPI {
1212
/// OpenAPI Spec "External Documentation Object"
1313
///
1414
/// See [OpenAPI External Documentation Object](https://spec.openapis.org/oas/v3.1.1.html#external-documentation-object).
15-
public struct ExternalDocumentation: Equatable, CodableVendorExtendable {
15+
public struct ExternalDocumentation: Equatable, CodableVendorExtendable, Sendable {
1616
public var description: String?
1717
public var url: URL
1818

Sources/OpenAPIKit/ExternalLoader.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import Foundation
1111
/// An `ExternalLoader` enables `OpenAPIKit` to load external references
1212
/// without knowing the details of what decoder is being used or how new internal
1313
/// references should be named.
14-
public protocol ExternalLoader {
14+
public protocol ExternalLoader where Message: Sendable {
1515
/// This can be anything that an implementor of this protocol wants to pass back from
1616
/// the `load()` function and have available after all external loading has been done.
1717
///

Sources/OpenAPIKit/Header/Header.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ extension OpenAPI {
1111
/// OpenAPI Spec "Header Object"
1212
///
1313
/// See [OpenAPI Header Object](https://spec.openapis.org/oas/v3.1.1.html#header-object).
14-
public struct Header: Equatable, CodableVendorExtendable {
14+
public struct Header: Equatable, CodableVendorExtendable, Sendable {
1515
public typealias SchemaContext = Parameter.SchemaContext
1616

1717
public let description: String?

Sources/OpenAPIKit/JSONReference.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import Foundation
3939
/// Components Object will be validated when you call `validate()` on an
4040
/// `OpenAPI.Document`.
4141
///
42-
public enum JSONReference<ReferenceType: ComponentDictionaryLocatable>: Equatable, Hashable, _OpenAPIReference {
42+
public enum JSONReference<ReferenceType: ComponentDictionaryLocatable>: Equatable, Hashable, _OpenAPIReference, Sendable {
4343
/// The reference is internal to the file.
4444
case `internal`(InternalReference)
4545
/// The reference refers to another file.
@@ -124,7 +124,7 @@ public enum JSONReference<ReferenceType: ComponentDictionaryLocatable>: Equatabl
124124
/// `JSONReference`.
125125
///
126126
/// This reference must start with "#".
127-
public enum InternalReference: LosslessStringConvertible, RawRepresentable, Equatable, Hashable {
127+
public enum InternalReference: LosslessStringConvertible, RawRepresentable, Equatable, Hashable, Sendable {
128128
/// The reference refers to a component (i.e. `#/components/...`).
129129
case component(name: String)
130130
/// The reference refers to some path outside the Components Object.
@@ -202,7 +202,7 @@ public enum JSONReference<ReferenceType: ComponentDictionaryLocatable>: Equatabl
202202
///
203203
/// This path does _not_ start with "#". It starts with a forward slash. By contrast, an
204204
/// `InternalReference` starts with "#" and is followed by the start of a `Path`.
205-
public struct Path: ExpressibleByArrayLiteral, ExpressibleByStringLiteral, LosslessStringConvertible, RawRepresentable, Equatable, Hashable {
205+
public struct Path: ExpressibleByArrayLiteral, ExpressibleByStringLiteral, LosslessStringConvertible, RawRepresentable, Equatable, Hashable, Sendable {
206206

207207
/// The Path's components. In the `rawValue`, these components are joined
208208
/// with forward slashes '/' per the JSON Reference specification.
@@ -312,7 +312,7 @@ extension OpenAPI {
312312
/// Per the specification, these summary and description overrides are irrelevant
313313
/// if the referenced component does not support the given attribute.
314314
@dynamicMemberLookup
315-
public struct Reference<ReferenceType: ComponentDictionaryLocatable>: Equatable, Hashable, _OpenAPIReference {
315+
public struct Reference<ReferenceType: ComponentDictionaryLocatable>: Equatable, Hashable, _OpenAPIReference, Sendable {
316316
public let jsonReference: JSONReference<ReferenceType>
317317
public let summary: String?
318318
public let description: String?

Sources/OpenAPIKit/Link.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ extension OpenAPI {
1616
/// OpenAPI Spec "Link Object"
1717
///
1818
/// See [OpenAPI Link Object](https://spec.openapis.org/oas/v3.1.1.html#link-object).
19-
public struct Link: Equatable, CodableVendorExtendable {
19+
public struct Link: Equatable, CodableVendorExtendable, Sendable {
2020
/// The **OpenAPI**` `operationRef` or `operationId` field, depending on whether
2121
/// a `URL` of a remote or local Operation Object or a `operationId` (String) of an
2222
/// operation defined in the same document is given.

Sources/OpenAPIKit/Operation/Operation.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ extension OpenAPI {
1111
/// OpenAPI Spec "Operation Object"
1212
///
1313
/// See [OpenAPI Operation Object](https://spec.openapis.org/oas/v3.1.1.html#operation-object).
14-
public struct Operation: Equatable, CodableVendorExtendable {
14+
public struct Operation: Equatable, CodableVendorExtendable, Sendable {
1515
public var tags: [String]?
1616
public var summary: String?
1717
public var description: String?

Sources/OpenAPIKit/Parameter/Parameter.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ extension OpenAPI {
1111
/// OpenAPI Spec "Parameter Object"
1212
///
1313
/// See [OpenAPI Parameter Object](https://spec.openapis.org/oas/v3.1.1.html#parameter-object).
14-
public struct Parameter: Equatable, CodableVendorExtendable {
14+
public struct Parameter: Equatable, CodableVendorExtendable, Sendable {
1515
public var name: String
1616

1717
/// OpenAPI Spec "in" property determines the `Context`.

Sources/OpenAPIKit/Parameter/ParameterContext.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ extension OpenAPI.Parameter {
1616
/// all optional by default unless you pass
1717
/// `required: true` to the context construction.
1818
/// Path parameters are always required.
19-
public enum Context: Equatable {
19+
public enum Context: Equatable, Sendable {
2020
case query(required: Bool, allowEmptyValue: Bool)
2121
case header(required: Bool)
2222
case path

Sources/OpenAPIKit/Parameter/ParameterSchemaContext.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ extension OpenAPI.Parameter {
1212
///
1313
/// See [OpenAPI Parameter Object](https://spec.openapis.org/oas/v3.1.1.html#parameter-object)
1414
/// and [OpenAPI Style Values](https://spec.openapis.org/oas/v3.1.1.html#style-values).
15-
public struct SchemaContext: Equatable {
15+
public struct SchemaContext: Equatable, Sendable {
1616
public var style: Style
1717
public var explode: Bool
1818
public var allowReserved: Bool //defaults to false

Sources/OpenAPIKit/Path Item/PathItem.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ extension OpenAPI {
2121
///
2222
/// You can access an array of equatable `HttpMethod`/`Operation` paris with the
2323
/// `endpoints` property.
24-
public struct PathItem: Equatable, CodableVendorExtendable {
24+
public struct PathItem: Equatable, CodableVendorExtendable, Sendable {
2525
public var summary: String?
2626
public var description: String?
2727
public var servers: [OpenAPI.Server]?

Sources/OpenAPIKit/Request/Request.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ extension OpenAPI {
1111
/// OpenAPI Spec "Request Body Object"
1212
///
1313
/// See [OpenAPI Request Body Object](https://spec.openapis.org/oas/v3.1.1.html#request-body-object).
14-
public struct Request: Equatable, CodableVendorExtendable {
14+
public struct Request: Equatable, CodableVendorExtendable, Sendable {
1515
public var description: String?
1616
public var content: Content.Map
1717
public var required: Bool

Sources/OpenAPIKit/Response/Response.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ extension OpenAPI {
1111
/// OpenAPI Spec "Response Object"
1212
///
1313
/// See [OpenAPI Response Object](https://spec.openapis.org/oas/v3.1.1.html#response-object).
14-
public struct Response: Equatable, CodableVendorExtendable {
14+
public struct Response: Equatable, CodableVendorExtendable, Sendable {
1515
public var description: String
1616
public var headers: Header.Map?
1717
/// An empty Content map will be omitted from encoding.

Sources/OpenAPIKit/RuntimeExpression.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ extension OpenAPI {
1212
///
1313
/// See [OpenAPI Runtime Expression[(https://spec.openapis.org/oas/v3.1.1.html#runtime-expressions).
1414
///
15-
public enum RuntimeExpression: RawRepresentable, Equatable {
15+
public enum RuntimeExpression: RawRepresentable, Equatable, Sendable {
1616
case url
1717
case method
1818
case statusCode
@@ -74,7 +74,7 @@ extension OpenAPI {
7474
return nil
7575
}
7676

77-
public enum Source: RawRepresentable, Equatable {
77+
public enum Source: RawRepresentable, Equatable, Sendable {
7878
/// A reference to one of the header parameters.
7979
case header(name: String)
8080
/// A reference to one of the query parameters.

Sources/OpenAPIKit/Schema Object/DereferencedJSONSchema.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import OpenAPIKitCore
1010
/// A `JSONSchema` type that guarantees none of its
1111
/// nodes are references.
1212
@dynamicMemberLookup
13-
public enum DereferencedJSONSchema: Equatable, JSONSchemaContext {
13+
public enum DereferencedJSONSchema: Equatable, JSONSchemaContext, Sendable {
1414
public typealias CoreContext<Format: OpenAPIFormat> = JSONSchema.CoreContext<Format>
1515
public typealias NumericContext = JSONSchema.NumericContext
1616
public typealias IntegerContext = JSONSchema.IntegerContext
@@ -265,7 +265,7 @@ extension DereferencedJSONSchema {
265265
}
266266

267267
/// The context that only applies to `.array` schemas.
268-
public struct ArrayContext: Equatable {
268+
public struct ArrayContext: Equatable, Sendable {
269269
/// A JSON Type Node that describes
270270
/// the type of each element in the array.
271271
public let items: DereferencedJSONSchema?
@@ -333,7 +333,7 @@ extension DereferencedJSONSchema {
333333
}
334334

335335
/// The context that only applies to `.object` schemas.
336-
public struct ObjectContext: Equatable {
336+
public struct ObjectContext: Equatable, Sendable {
337337
public let maxProperties: Int?
338338
let _minProperties: Int?
339339
public let properties: OrderedDictionary<String, DereferencedJSONSchema>

Sources/OpenAPIKit/Schema Object/JSONSchema+Combining.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public func ~=(lhs: JSONSchemaResolutionError, rhs: JSONSchemaResolutionError) -
6262
/// I expect this to be an area where I may want to make fixes and add
6363
/// errors without breaknig changes, so this annoying workaround for
6464
/// the absense of a "non-frozen" enum is a must.
65-
internal enum _JSONSchemaResolutionError: CustomStringConvertible, Equatable {
65+
internal enum _JSONSchemaResolutionError: CustomStringConvertible, Equatable, Sendable {
6666
case unsupported(because: String)
6767
case typeConflict(original: JSONType, new: JSONType)
6868
case formatConflict(original: String, new: String)

Sources/OpenAPIKit/Schema Object/JSONSchema.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import OpenAPIKitCore
1010
/// OpenAPI "Schema Object"
1111
///
1212
/// See [OpenAPI Schema Object](https://spec.openapis.org/oas/v3.1.1.html#schema-object).
13-
public struct JSONSchema: JSONSchemaContext, HasWarnings {
13+
public struct JSONSchema: JSONSchemaContext, HasWarnings, Sendable {
1414

1515
public let warnings: [OpenAPI.Warning]
1616
public var value: Schema
@@ -68,7 +68,7 @@ public struct JSONSchema: JSONSchemaContext, HasWarnings {
6868
.init(schema: .fragment(core))
6969
}
7070

71-
public enum Schema: Equatable {
71+
public enum Schema: Equatable, Sendable {
7272
/// The null type, which replaces the functionality of the `nullable` property from
7373
/// previous versions of the OpenAPI specification.
7474
case null(CoreContext<JSONTypeFormat.AnyFormat>)
@@ -2151,7 +2151,7 @@ extension JSONSchema: Decodable {
21512151
throw VendorExtensionDecodingError.selfIsArrayNotDict
21522152
}
21532153

2154-
guard let decodedAny = decoded as? [String: Any] else {
2154+
guard let decodedAny = decoded as? [String: any Sendable] else {
21552155
throw VendorExtensionDecodingError.foundNonStringKeys
21562156
}
21572157

Sources/OpenAPIKit/Schema Object/JSONSchemaContext.swift

+9-9
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import OpenAPIKitCore
1212
/// A schema context stores information about a schema.
1313
/// All schemas can have the contextual information in
1414
/// this protocol.
15-
public protocol JSONSchemaContext {
15+
public protocol JSONSchemaContext: Sendable {
1616
/// The format of the schema as a string value.
1717
///
1818
/// This can be set even when a schema type has
@@ -574,8 +574,8 @@ extension JSONSchema {
574574
/// `IntegerContext` _can_ be asked for the
575575
/// `NumericContext` that would describe it via its
576576
/// `numericContext` property.
577-
public struct NumericContext: Equatable {
578-
public struct Bound: Equatable {
577+
public struct NumericContext: Equatable, Sendable {
578+
public struct Bound: Equatable, Sendable {
579579
public let value: Double
580580
public let exclusive: Bool
581581

@@ -610,8 +610,8 @@ extension JSONSchema {
610610
}
611611

612612
/// The context that only applies to `.integer` schemas.
613-
public struct IntegerContext: Equatable {
614-
public struct Bound: Equatable {
613+
public struct IntegerContext: Equatable, Sendable {
614+
public struct Bound: Equatable, Sendable {
615615
public let value: Int
616616
public let exclusive: Bool
617617

@@ -696,7 +696,7 @@ extension JSONSchema {
696696
}
697697

698698
/// The context that only applies to `.array` schemas.
699-
public struct ArrayContext: Equatable {
699+
public struct ArrayContext: Equatable, Sendable {
700700
/// A JSON Type Node that describes
701701
/// the type of each element in the array.
702702
public let items: JSONSchema?
@@ -729,7 +729,7 @@ extension JSONSchema {
729729
}
730730

731731
/// The context that only applies to `.object` schemas.
732-
public struct ObjectContext: Equatable {
732+
public struct ObjectContext: Equatable, Sendable {
733733
/// The maximum number of properties the object
734734
/// is allowed to have.
735735
public let maxProperties: Int?
@@ -796,7 +796,7 @@ extension JSONSchema {
796796
}
797797

798798
/// The context that only applies to `.string` schemas.
799-
public struct StringContext: Equatable {
799+
public struct StringContext: Equatable, Sendable {
800800
public let maxLength: Int?
801801
let _minLength: Int?
802802

@@ -833,7 +833,7 @@ extension JSONSchema {
833833

834834
extension OpenAPI {
835835
/// An encoding, as specified in RFC 2045, part 6.1 and RFC 4648.
836-
public enum ContentEncoding: String, Codable {
836+
public enum ContentEncoding: String, Codable, Sendable {
837837
case _7bit = "7bit"
838838
case _8bit = "8bit"
839839
case binary

0 commit comments

Comments
 (0)