Skip to content

Commit

Permalink
Merge pull request #389 from mattpolzin/enable-strict-concurrency-in-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpolzin authored Feb 16, 2025
2 parents c5aa61b + bb4bf69 commit 1d1f322
Show file tree
Hide file tree
Showing 146 changed files with 523 additions and 373 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
- name: Run tests
run: swift test
run: swift test -Xswiftc -strict-concurrency=complete
osx:
strategy:
fail-fast: false
Expand All @@ -46,4 +46,4 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
- name: Run tests
run: swift test
run: swift test -Xswiftc -strict-concurrency=complete
2 changes: 1 addition & 1 deletion Sources/OpenAPIKit/CodableVendorExtendable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ extension CodableVendorExtendable {
throw VendorExtensionDecodingError.selfIsArrayNotDict
}

guard let decodedAny = decoded as? [String: Any] else {
guard let decodedAny = decoded as? [String: any Sendable] else {
throw VendorExtensionDecodingError.foundNonStringKeys
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenAPIKit/Components Object/Components.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extension OpenAPI {
///
/// This is a place to put reusable components to
/// be referenced from other parts of the spec.
public struct Components: Equatable, CodableVendorExtendable {
public struct Components: Equatable, CodableVendorExtendable, Sendable {

public var schemas: ComponentDictionary<JSONSchema>
public var responses: ComponentDictionary<Response>
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenAPIKit/Content/Content.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extension OpenAPI {
/// OpenAPI Spec "Media Type Object"
///
/// See [OpenAPI Media Type Object](https://spec.openapis.org/oas/v3.1.1.html#media-type-object).
public struct Content: Equatable, CodableVendorExtendable {
public struct Content: Equatable, CodableVendorExtendable, Sendable {
public var schema: Either<OpenAPI.Reference<JSONSchema>, JSONSchema>?
public var example: AnyCodable?
public var examples: Example.Map?
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenAPIKit/Content/ContentEncoding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extension OpenAPI.Content {
/// OpenAPI Spec "Encoding Object"
///
/// See [OpenAPI Encoding Object](https://spec.openapis.org/oas/v3.1.1.html#encoding-object).
public struct Encoding: Equatable {
public struct Encoding: Equatable, Sendable {
public typealias Style = OpenAPI.Parameter.SchemaContext.Style

public let contentTypes: [OpenAPI.ContentType]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension OpenAPI.Error.Decoding {
public let context: Context
public let codingPath: [CodingKey]

public enum Context {
public enum Context: Sendable {
case path(Path)
case inconsistency(InconsistencyError)
case other(Swift.DecodingError)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ extension OpenAPI.Error.Decoding {
public let context: Context
internal let relativeCodingPath: [CodingKey]

public enum Context {
public enum Context: Sendable {
case request(Request)
case response(Response)
case inconsistency(InconsistencyError)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ extension OpenAPI.Error.Decoding {
public let context: Context
internal let relativeCodingPath: [CodingKey]

public enum Context {
public enum Context: Sendable {
case endpoint(Operation)
case inconsistency(InconsistencyError)
case other(Swift.DecodingError)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ extension OpenAPI.Error.Decoding {
public let context: Context
internal let relativeCodingPath: [CodingKey]

public enum Context {
public enum Context: Sendable {
case inconsistency(InconsistencyError)
case other(Swift.DecodingError)
case neither(EitherDecodeNoTypesMatchedError)
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenAPIKit/Example.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension OpenAPI {
/// OpenAPI Spec "Example Object"
///
/// See [OpenAPI Example Object](https://spec.openapis.org/oas/v3.1.1.html#example-object).
public struct Example: Equatable, CodableVendorExtendable {
public struct Example: Equatable, CodableVendorExtendable, Sendable {
public let summary: String?
public let description: String?

Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenAPIKit/ExternalDocumentation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension OpenAPI {
/// OpenAPI Spec "External Documentation Object"
///
/// See [OpenAPI External Documentation Object](https://spec.openapis.org/oas/v3.1.1.html#external-documentation-object).
public struct ExternalDocumentation: Equatable, CodableVendorExtendable {
public struct ExternalDocumentation: Equatable, CodableVendorExtendable, Sendable {
public var description: String?
public var url: URL

Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenAPIKit/ExternalLoader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Foundation
/// An `ExternalLoader` enables `OpenAPIKit` to load external references
/// without knowing the details of what decoder is being used or how new internal
/// references should be named.
public protocol ExternalLoader {
public protocol ExternalLoader where Message: Sendable {
/// This can be anything that an implementor of this protocol wants to pass back from
/// the `load()` function and have available after all external loading has been done.
///
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenAPIKit/Header/Header.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extension OpenAPI {
/// OpenAPI Spec "Header Object"
///
/// See [OpenAPI Header Object](https://spec.openapis.org/oas/v3.1.1.html#header-object).
public struct Header: Equatable, CodableVendorExtendable {
public struct Header: Equatable, CodableVendorExtendable, Sendable {
public typealias SchemaContext = Parameter.SchemaContext

public let description: String?
Expand Down
8 changes: 4 additions & 4 deletions Sources/OpenAPIKit/JSONReference.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import Foundation
/// Components Object will be validated when you call `validate()` on an
/// `OpenAPI.Document`.
///
public enum JSONReference<ReferenceType: ComponentDictionaryLocatable>: Equatable, Hashable, _OpenAPIReference {
public enum JSONReference<ReferenceType: ComponentDictionaryLocatable>: Equatable, Hashable, _OpenAPIReference, Sendable {
/// The reference is internal to the file.
case `internal`(InternalReference)
/// The reference refers to another file.
Expand Down Expand Up @@ -124,7 +124,7 @@ public enum JSONReference<ReferenceType: ComponentDictionaryLocatable>: Equatabl
/// `JSONReference`.
///
/// This reference must start with "#".
public enum InternalReference: LosslessStringConvertible, RawRepresentable, Equatable, Hashable {
public enum InternalReference: LosslessStringConvertible, RawRepresentable, Equatable, Hashable, Sendable {
/// The reference refers to a component (i.e. `#/components/...`).
case component(name: String)
/// The reference refers to some path outside the Components Object.
Expand Down Expand Up @@ -202,7 +202,7 @@ public enum JSONReference<ReferenceType: ComponentDictionaryLocatable>: Equatabl
///
/// This path does _not_ start with "#". It starts with a forward slash. By contrast, an
/// `InternalReference` starts with "#" and is followed by the start of a `Path`.
public struct Path: ExpressibleByArrayLiteral, ExpressibleByStringLiteral, LosslessStringConvertible, RawRepresentable, Equatable, Hashable {
public struct Path: ExpressibleByArrayLiteral, ExpressibleByStringLiteral, LosslessStringConvertible, RawRepresentable, Equatable, Hashable, Sendable {

/// The Path's components. In the `rawValue`, these components are joined
/// with forward slashes '/' per the JSON Reference specification.
Expand Down Expand Up @@ -312,7 +312,7 @@ extension OpenAPI {
/// Per the specification, these summary and description overrides are irrelevant
/// if the referenced component does not support the given attribute.
@dynamicMemberLookup
public struct Reference<ReferenceType: ComponentDictionaryLocatable>: Equatable, Hashable, _OpenAPIReference {
public struct Reference<ReferenceType: ComponentDictionaryLocatable>: Equatable, Hashable, _OpenAPIReference, Sendable {
public let jsonReference: JSONReference<ReferenceType>
public let summary: String?
public let description: String?
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenAPIKit/Link.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extension OpenAPI {
/// OpenAPI Spec "Link Object"
///
/// See [OpenAPI Link Object](https://spec.openapis.org/oas/v3.1.1.html#link-object).
public struct Link: Equatable, CodableVendorExtendable {
public struct Link: Equatable, CodableVendorExtendable, Sendable {
/// The **OpenAPI**` `operationRef` or `operationId` field, depending on whether
/// a `URL` of a remote or local Operation Object or a `operationId` (String) of an
/// operation defined in the same document is given.
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenAPIKit/Operation/Operation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extension OpenAPI {
/// OpenAPI Spec "Operation Object"
///
/// See [OpenAPI Operation Object](https://spec.openapis.org/oas/v3.1.1.html#operation-object).
public struct Operation: Equatable, CodableVendorExtendable {
public struct Operation: Equatable, CodableVendorExtendable, Sendable {
public var tags: [String]?
public var summary: String?
public var description: String?
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenAPIKit/Parameter/Parameter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extension OpenAPI {
/// OpenAPI Spec "Parameter Object"
///
/// See [OpenAPI Parameter Object](https://spec.openapis.org/oas/v3.1.1.html#parameter-object).
public struct Parameter: Equatable, CodableVendorExtendable {
public struct Parameter: Equatable, CodableVendorExtendable, Sendable {
public var name: String

/// OpenAPI Spec "in" property determines the `Context`.
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenAPIKit/Parameter/ParameterContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extension OpenAPI.Parameter {
/// all optional by default unless you pass
/// `required: true` to the context construction.
/// Path parameters are always required.
public enum Context: Equatable {
public enum Context: Equatable, Sendable {
case query(required: Bool, allowEmptyValue: Bool)
case header(required: Bool)
case path
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenAPIKit/Parameter/ParameterSchemaContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension OpenAPI.Parameter {
///
/// See [OpenAPI Parameter Object](https://spec.openapis.org/oas/v3.1.1.html#parameter-object)
/// and [OpenAPI Style Values](https://spec.openapis.org/oas/v3.1.1.html#style-values).
public struct SchemaContext: Equatable {
public struct SchemaContext: Equatable, Sendable {
public var style: Style
public var explode: Bool
public var allowReserved: Bool //defaults to false
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenAPIKit/Path Item/PathItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ extension OpenAPI {
///
/// You can access an array of equatable `HttpMethod`/`Operation` paris with the
/// `endpoints` property.
public struct PathItem: Equatable, CodableVendorExtendable {
public struct PathItem: Equatable, CodableVendorExtendable, Sendable {
public var summary: String?
public var description: String?
public var servers: [OpenAPI.Server]?
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenAPIKit/Request/Request.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extension OpenAPI {
/// OpenAPI Spec "Request Body Object"
///
/// See [OpenAPI Request Body Object](https://spec.openapis.org/oas/v3.1.1.html#request-body-object).
public struct Request: Equatable, CodableVendorExtendable {
public struct Request: Equatable, CodableVendorExtendable, Sendable {
public var description: String?
public var content: Content.Map
public var required: Bool
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenAPIKit/Response/Response.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extension OpenAPI {
/// OpenAPI Spec "Response Object"
///
/// See [OpenAPI Response Object](https://spec.openapis.org/oas/v3.1.1.html#response-object).
public struct Response: Equatable, CodableVendorExtendable {
public struct Response: Equatable, CodableVendorExtendable, Sendable {
public var description: String
public var headers: Header.Map?
/// An empty Content map will be omitted from encoding.
Expand Down
4 changes: 2 additions & 2 deletions Sources/OpenAPIKit/RuntimeExpression.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension OpenAPI {
///
/// See [OpenAPI Runtime Expression[(https://spec.openapis.org/oas/v3.1.1.html#runtime-expressions).
///
public enum RuntimeExpression: RawRepresentable, Equatable {
public enum RuntimeExpression: RawRepresentable, Equatable, Sendable {
case url
case method
case statusCode
Expand Down Expand Up @@ -74,7 +74,7 @@ extension OpenAPI {
return nil
}

public enum Source: RawRepresentable, Equatable {
public enum Source: RawRepresentable, Equatable, Sendable {
/// A reference to one of the header parameters.
case header(name: String)
/// A reference to one of the query parameters.
Expand Down
6 changes: 3 additions & 3 deletions Sources/OpenAPIKit/Schema Object/DereferencedJSONSchema.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import OpenAPIKitCore
/// A `JSONSchema` type that guarantees none of its
/// nodes are references.
@dynamicMemberLookup
public enum DereferencedJSONSchema: Equatable, JSONSchemaContext {
public enum DereferencedJSONSchema: Equatable, JSONSchemaContext, Sendable {
public typealias CoreContext<Format: OpenAPIFormat> = JSONSchema.CoreContext<Format>
public typealias NumericContext = JSONSchema.NumericContext
public typealias IntegerContext = JSONSchema.IntegerContext
Expand Down Expand Up @@ -265,7 +265,7 @@ extension DereferencedJSONSchema {
}

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

/// The context that only applies to `.object` schemas.
public struct ObjectContext: Equatable {
public struct ObjectContext: Equatable, Sendable {
public let maxProperties: Int?
let _minProperties: Int?
public let properties: OrderedDictionary<String, DereferencedJSONSchema>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public func ~=(lhs: JSONSchemaResolutionError, rhs: JSONSchemaResolutionError) -
/// I expect this to be an area where I may want to make fixes and add
/// errors without breaknig changes, so this annoying workaround for
/// the absense of a "non-frozen" enum is a must.
internal enum _JSONSchemaResolutionError: CustomStringConvertible, Equatable {
internal enum _JSONSchemaResolutionError: CustomStringConvertible, Equatable, Sendable {
case unsupported(because: String)
case typeConflict(original: JSONType, new: JSONType)
case formatConflict(original: String, new: String)
Expand Down
6 changes: 3 additions & 3 deletions Sources/OpenAPIKit/Schema Object/JSONSchema.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import OpenAPIKitCore
/// OpenAPI "Schema Object"
///
/// See [OpenAPI Schema Object](https://spec.openapis.org/oas/v3.1.1.html#schema-object).
public struct JSONSchema: JSONSchemaContext, HasWarnings {
public struct JSONSchema: JSONSchemaContext, HasWarnings, Sendable {

public let warnings: [OpenAPI.Warning]
public var value: Schema
Expand Down Expand Up @@ -68,7 +68,7 @@ public struct JSONSchema: JSONSchemaContext, HasWarnings {
.init(schema: .fragment(core))
}

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

guard let decodedAny = decoded as? [String: Any] else {
guard let decodedAny = decoded as? [String: any Sendable] else {
throw VendorExtensionDecodingError.foundNonStringKeys
}

Expand Down
18 changes: 9 additions & 9 deletions Sources/OpenAPIKit/Schema Object/JSONSchemaContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import OpenAPIKitCore
/// A schema context stores information about a schema.
/// All schemas can have the contextual information in
/// this protocol.
public protocol JSONSchemaContext {
public protocol JSONSchemaContext: Sendable {
/// The format of the schema as a string value.
///
/// This can be set even when a schema type has
Expand Down Expand Up @@ -574,8 +574,8 @@ extension JSONSchema {
/// `IntegerContext` _can_ be asked for the
/// `NumericContext` that would describe it via its
/// `numericContext` property.
public struct NumericContext: Equatable {
public struct Bound: Equatable {
public struct NumericContext: Equatable, Sendable {
public struct Bound: Equatable, Sendable {
public let value: Double
public let exclusive: Bool

Expand Down Expand Up @@ -610,8 +610,8 @@ extension JSONSchema {
}

/// The context that only applies to `.integer` schemas.
public struct IntegerContext: Equatable {
public struct Bound: Equatable {
public struct IntegerContext: Equatable, Sendable {
public struct Bound: Equatable, Sendable {
public let value: Int
public let exclusive: Bool

Expand Down Expand Up @@ -696,7 +696,7 @@ extension JSONSchema {
}

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

/// The context that only applies to `.object` schemas.
public struct ObjectContext: Equatable {
public struct ObjectContext: Equatable, Sendable {
/// The maximum number of properties the object
/// is allowed to have.
public let maxProperties: Int?
Expand Down Expand Up @@ -796,7 +796,7 @@ extension JSONSchema {
}

/// The context that only applies to `.string` schemas.
public struct StringContext: Equatable {
public struct StringContext: Equatable, Sendable {
public let maxLength: Int?
let _minLength: Int?

Expand Down Expand Up @@ -833,7 +833,7 @@ extension JSONSchema {

extension OpenAPI {
/// An encoding, as specified in RFC 2045, part 6.1 and RFC 4648.
public enum ContentEncoding: String, Codable {
public enum ContentEncoding: String, Codable, Sendable {
case _7bit = "7bit"
case _8bit = "8bit"
case binary
Expand Down
Loading

0 comments on commit 1d1f322

Please sign in to comment.