diff --git a/modules/openapi-generator/src/main/resources/swift6/APIHelper.mustache b/modules/openapi-generator/src/main/resources/swift6/APIHelper.mustache index 04c8f841528b..f25c30b2ae6b 100644 --- a/modules/openapi-generator/src/main/resources/swift6/APIHelper.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/APIHelper.mustache @@ -7,7 +7,7 @@ import Foundation{{#useVapor}} import Vapor{{/useVapor}} -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct APIHelper { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct APIHelper: Sendable { {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? { let destination = source.reduce(into: [String: any Sendable]()) { result, item in if let value = item.value { diff --git a/modules/openapi-generator/src/main/resources/swift6/APIs.mustache b/modules/openapi-generator/src/main/resources/swift6/APIs.mustache index c9d2a508d099..22626aa8dc3b 100644 --- a/modules/openapi-generator/src/main/resources/swift6/APIs.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/APIs.mustache @@ -82,7 +82,7 @@ import Alamofire{{/useAlamofire}} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static let shared = {{projectName}}APIConfiguration() }{{^useVapor}} -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class RequestBuilder: @unchecked Sendable, Identifiable { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class RequestBuilder: @unchecked Sendable, Identifiable { {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var credential: URLCredential? {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var headers: [String: String] {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let parameters: [String: any Sendable]? @@ -119,9 +119,24 @@ import Alamofire{{/useAlamofire}} } {{#useAsyncAwait}} + #if compiler(>=6.2) + @concurrent @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) @discardableResult {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func execute() async throws(ErrorResponse) -> Response { + try await _execute() + } + #else + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + @discardableResult + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func execute() async throws(ErrorResponse) -> Response { + try await _execute() + } + #endif + + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + @discardableResult + private func _execute() async throws(ErrorResponse) -> Response { do { let requestTask = self.requestTask return try await withTaskCancellationHandler { @@ -135,7 +150,6 @@ import Alamofire{{/useAlamofire}} self.execute { result in switch result { case let .success(response): - nonisolated(unsafe) let response = response continuation.resume(returning: response) case let .failure(error): continuation.resume(throwing: error) @@ -153,7 +167,7 @@ import Alamofire{{/useAlamofire}} } } } - + {{/useAsyncAwait}} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func addHeader(name: String, value: String) -> Self { if !value.isEmpty { @@ -167,7 +181,7 @@ import Alamofire{{/useAlamofire}} } } -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} protocol RequestBuilderFactory { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} protocol RequestBuilderFactory: Sendable { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type }{{/useVapor}} diff --git a/modules/openapi-generator/src/main/resources/swift6/Models.mustache b/modules/openapi-generator/src/main/resources/swift6/Models.mustache index c8a80a636fb7..06576779dc40 100644 --- a/modules/openapi-generator/src/main/resources/swift6/Models.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/Models.mustache @@ -70,11 +70,11 @@ extension NullEncodable: Codable where Wrapped: Codable { } } -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum ErrorResponse: Error { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum ErrorResponse: Error, @unchecked Sendable { case error(Int, Data?, URLResponse?, Error) } -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum DownloadException: Error { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum DownloadException: Error, Sendable { case responseDataMissing case responseFailed case requestMissing @@ -82,7 +82,7 @@ extension NullEncodable: Codable where Wrapped: Codable { case requestMissingURL } -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum DecodableRequestBuilderError: Error { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum DecodableRequestBuilderError: Error, @unchecked Sendable { case emptyDataResponse case nilHTTPResponse case unsuccessfulHTTPStatusCode diff --git a/modules/openapi-generator/src/main/resources/swift6/Validation.mustache b/modules/openapi-generator/src/main/resources/swift6/Validation.mustache index 9d60c6098f13..adfb876f001b 100644 --- a/modules/openapi-generator/src/main/resources/swift6/Validation.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/Validation.mustache @@ -27,23 +27,23 @@ extension NumericRule: Sendable where T: Sendable {} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var uniqueItems: Bool } -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum StringValidationErrorKind: Error { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum NumericValidationErrorKind: Error { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum ArrayValidationErrorKind: Error { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct ValidationError: Error { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct ValidationError: Error, Sendable { {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} fileprivate(set) var kinds: Set } -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct Validator { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. diff --git a/modules/openapi-generator/src/main/resources/swift6/libraries/alamofire/AlamofireImplementations.mustache b/modules/openapi-generator/src/main/resources/swift6/libraries/alamofire/AlamofireImplementations.mustache index f2db4445678a..a92eb8c13add 100644 --- a/modules/openapi-generator/src/main/resources/swift6/libraries/alamofire/AlamofireImplementations.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/libraries/alamofire/AlamofireImplementations.mustache @@ -7,7 +7,7 @@ import Foundation import Alamofire -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} class AlamofireRequestBuilderFactory: RequestBuilderFactory { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} final class AlamofireRequestBuilderFactory: RequestBuilderFactory, Sendable { {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init() {} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -27,7 +27,7 @@ fileprivate class AlamofireRequestBuilderConfiguration: @unchecked Sendable { var managerStore = SynchronizedDictionary() } -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class AlamofireRequestBuilder: RequestBuilder, @unchecked Sendable { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class AlamofireRequestBuilder: RequestBuilder, @unchecked Sendable { required {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: {{projectName}}APIConfiguration = {{projectName}}APIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) } @@ -255,7 +255,7 @@ fileprivate class AlamofireRequestBuilderConfiguration: @unchecked Sendable { } -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class AlamofireDecodableRequestBuilder: AlamofireRequestBuilder, @unchecked Sendable { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class AlamofireDecodableRequestBuilder: AlamofireRequestBuilder, @unchecked Sendable { override fileprivate func processRequest(request: DataRequest, managerId: String, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { if let credential = self.credential { diff --git a/modules/openapi-generator/src/main/resources/swift6/libraries/urlsession/URLSessionImplementations.mustache b/modules/openapi-generator/src/main/resources/swift6/libraries/urlsession/URLSessionImplementations.mustache index 7f97dbdd755c..5125bf17c13d 100644 --- a/modules/openapi-generator/src/main/resources/swift6/libraries/urlsession/URLSessionImplementations.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/libraries/urlsession/URLSessionImplementations.mustache @@ -40,7 +40,7 @@ extension URLSession: URLSessionProtocol { extension URLSessionDataTask: URLSessionDataTaskProtocol {} -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} class URLSessionRequestBuilderFactory: RequestBuilderFactory { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} final class URLSessionRequestBuilderFactory: RequestBuilderFactory, Sendable { {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init() {} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -69,7 +69,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { var credentialStore = SynchronizedDictionary() } -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { required {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: {{projectName}}APIConfiguration = {{projectName}}APIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) @@ -319,7 +319,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { } -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { diff --git a/modules/openapi-generator/src/main/resources/swift6/modelObject.mustache b/modules/openapi-generator/src/main/resources/swift6/modelObject.mustache index d577636875ba..c1e562c6ca11 100644 --- a/modules/openapi-generator/src/main/resources/swift6/modelObject.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/modelObject.mustache @@ -1,5 +1,5 @@ {{^objcCompatible}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} {{#useClasses}}final class{{/useClasses}}{{^useClasses}}struct{{/useClasses}} {{{classname}}}: {{^useClasses}}Sendable, {{/useClasses}}{{#useClasses}}{{#readonlyProperties}}@unchecked Sendable, {{/readonlyProperties}}{{/useClasses}}{{#useVapor}}Content{{/useVapor}}{{^useVapor}}Codable{{/useVapor}}{{#vendorExtensions.x-swift-hashable}}, Hashable{{/vendorExtensions.x-swift-hashable}} { -{{/objcCompatible}}{{#objcCompatible}}@objcMembers {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} class {{classname}}: NSObject, Codable { +{{/objcCompatible}}{{#objcCompatible}}@objcMembers {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} final class {{classname}}: NSObject, Codable, @unchecked Sendable { {{/objcCompatible}} {{#allVars}} diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/APIHelper.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/APIHelper.swift index b4218d3375c9..5308eaac92c0 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/APIHelper.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/APIHelper.swift @@ -6,7 +6,7 @@ import Foundation -public struct APIHelper { +public struct APIHelper: Sendable { public static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? { let destination = source.reduce(into: [String: any Sendable]()) { result, item in if let value = item.value { diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift index fff700bc9495..542ab429d641 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift @@ -61,7 +61,7 @@ open class PetstoreClientAPIConfiguration: @unchecked Sendable { public static let shared = PetstoreClientAPIConfiguration() } -open class RequestBuilder: @unchecked Sendable, Identifiable { +open class RequestBuilder: @unchecked Sendable, Identifiable { public var credential: URLCredential? public var headers: [String: String] public let parameters: [String: any Sendable]? @@ -109,7 +109,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } -public protocol RequestBuilderFactory { +public protocol RequestBuilderFactory: Sendable { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type } diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/AlamofireImplementations.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/AlamofireImplementations.swift index 6ab188305e2f..1efeb37227d1 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/AlamofireImplementations.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/AlamofireImplementations.swift @@ -7,7 +7,7 @@ import Foundation import Alamofire -public class AlamofireRequestBuilderFactory: RequestBuilderFactory { +public final class AlamofireRequestBuilderFactory: RequestBuilderFactory, Sendable { public init() {} public func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -27,7 +27,7 @@ fileprivate class AlamofireRequestBuilderConfiguration: @unchecked Sendable { var managerStore = SynchronizedDictionary() } -open class AlamofireRequestBuilder: RequestBuilder, @unchecked Sendable { +open class AlamofireRequestBuilder: RequestBuilder, @unchecked Sendable { required public init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) } @@ -255,7 +255,7 @@ open class AlamofireRequestBuilder: RequestBuilder, @unchecked Sendable { } -open class AlamofireDecodableRequestBuilder: AlamofireRequestBuilder, @unchecked Sendable { +open class AlamofireDecodableRequestBuilder: AlamofireRequestBuilder, @unchecked Sendable { override fileprivate func processRequest(request: DataRequest, managerId: String, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { if let credential = self.credential { diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Models.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Models.swift index 788f242d4be7..a51480e9dbd2 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Models.swift @@ -70,11 +70,11 @@ extension NullEncodable: Codable where Wrapped: Codable { } } -public enum ErrorResponse: Error { +public enum ErrorResponse: Error, @unchecked Sendable { case error(Int, Data?, URLResponse?, Error) } -public enum DownloadException: Error { +public enum DownloadException: Error, Sendable { case responseDataMissing case responseFailed case requestMissing @@ -82,7 +82,7 @@ public enum DownloadException: Error { case requestMissingURL } -public enum DecodableRequestBuilderError: Error { +public enum DecodableRequestBuilderError: Error, @unchecked Sendable { case emptyDataResponse case nilHTTPResponse case unsuccessfulHTTPStatusCode diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift index b830e2d31a40..11b7ac6a90be 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift @@ -27,23 +27,23 @@ public struct ArrayRule: Sendable { public var uniqueItems: Bool } -public enum StringValidationErrorKind: Error { +public enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -public enum NumericValidationErrorKind: Error { +public enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -public enum ArrayValidationErrorKind: Error { +public enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -public struct ValidationError: Error { +public struct ValidationError: Error, Sendable { public fileprivate(set) var kinds: Set } -public struct Validator { +public struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/APIHelper.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/APIHelper.swift index b4218d3375c9..5308eaac92c0 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/APIHelper.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/APIHelper.swift @@ -6,7 +6,7 @@ import Foundation -public struct APIHelper { +public struct APIHelper: Sendable { public static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? { let destination = source.reduce(into: [String: any Sendable]()) { result, item in if let value = item.value { diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/APIs.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/APIs.swift index e697fa560e49..485bc20e0a40 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/APIs.swift @@ -61,7 +61,7 @@ open class PetstoreClientAPIConfiguration: @unchecked Sendable { public static let shared = PetstoreClientAPIConfiguration() } -open class RequestBuilder: @unchecked Sendable, Identifiable { +open class RequestBuilder: @unchecked Sendable, Identifiable { public var credential: URLCredential? public var headers: [String: String] public let parameters: [String: any Sendable]? @@ -97,9 +97,24 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { return requestTask } + #if compiler(>=6.2) + @concurrent @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) @discardableResult open func execute() async throws(ErrorResponse) -> Response { + try await _execute() + } + #else + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + @discardableResult + open func execute() async throws(ErrorResponse) -> Response { + try await _execute() + } + #endif + + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + @discardableResult + private func _execute() async throws(ErrorResponse) -> Response { do { let requestTask = self.requestTask return try await withTaskCancellationHandler { @@ -113,7 +128,6 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { self.execute { result in switch result { case let .success(response): - nonisolated(unsafe) let response = response continuation.resume(returning: response) case let .failure(error): continuation.resume(throwing: error) @@ -131,7 +145,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } } - + public func addHeader(name: String, value: String) -> Self { if !value.isEmpty { headers[name] = value @@ -144,7 +158,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } -public protocol RequestBuilderFactory { +public protocol RequestBuilderFactory: Sendable { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type } diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/AlamofireImplementations.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/AlamofireImplementations.swift index 6ab188305e2f..1efeb37227d1 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/AlamofireImplementations.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/AlamofireImplementations.swift @@ -7,7 +7,7 @@ import Foundation import Alamofire -public class AlamofireRequestBuilderFactory: RequestBuilderFactory { +public final class AlamofireRequestBuilderFactory: RequestBuilderFactory, Sendable { public init() {} public func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -27,7 +27,7 @@ fileprivate class AlamofireRequestBuilderConfiguration: @unchecked Sendable { var managerStore = SynchronizedDictionary() } -open class AlamofireRequestBuilder: RequestBuilder, @unchecked Sendable { +open class AlamofireRequestBuilder: RequestBuilder, @unchecked Sendable { required public init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) } @@ -255,7 +255,7 @@ open class AlamofireRequestBuilder: RequestBuilder, @unchecked Sendable { } -open class AlamofireDecodableRequestBuilder: AlamofireRequestBuilder, @unchecked Sendable { +open class AlamofireDecodableRequestBuilder: AlamofireRequestBuilder, @unchecked Sendable { override fileprivate func processRequest(request: DataRequest, managerId: String, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { if let credential = self.credential { diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Models.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Models.swift index 788f242d4be7..a51480e9dbd2 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Models.swift @@ -70,11 +70,11 @@ extension NullEncodable: Codable where Wrapped: Codable { } } -public enum ErrorResponse: Error { +public enum ErrorResponse: Error, @unchecked Sendable { case error(Int, Data?, URLResponse?, Error) } -public enum DownloadException: Error { +public enum DownloadException: Error, Sendable { case responseDataMissing case responseFailed case requestMissing @@ -82,7 +82,7 @@ public enum DownloadException: Error { case requestMissingURL } -public enum DecodableRequestBuilderError: Error { +public enum DecodableRequestBuilderError: Error, @unchecked Sendable { case emptyDataResponse case nilHTTPResponse case unsuccessfulHTTPStatusCode diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Validation.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Validation.swift index b830e2d31a40..11b7ac6a90be 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Validation.swift @@ -27,23 +27,23 @@ public struct ArrayRule: Sendable { public var uniqueItems: Bool } -public enum StringValidationErrorKind: Error { +public enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -public enum NumericValidationErrorKind: Error { +public enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -public enum ArrayValidationErrorKind: Error { +public enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -public struct ValidationError: Error { +public struct ValidationError: Error, Sendable { public fileprivate(set) var kinds: Set } -public struct Validator { +public struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/APIHelper.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/APIHelper.swift index b4218d3375c9..5308eaac92c0 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/APIHelper.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/APIHelper.swift @@ -6,7 +6,7 @@ import Foundation -public struct APIHelper { +public struct APIHelper: Sendable { public static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? { let destination = source.reduce(into: [String: any Sendable]()) { result, item in if let value = item.value { diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift index 1d94b12a8166..675c3cf609ed 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift @@ -47,7 +47,7 @@ open class PetstoreClientAPIConfiguration: @unchecked Sendable { public static let shared = PetstoreClientAPIConfiguration() } -open class RequestBuilder: @unchecked Sendable, Identifiable { +open class RequestBuilder: @unchecked Sendable, Identifiable { public var credential: URLCredential? public var headers: [String: String] public let parameters: [String: any Sendable]? @@ -83,9 +83,24 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { return requestTask } + #if compiler(>=6.2) + @concurrent @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) @discardableResult open func execute() async throws(ErrorResponse) -> Response { + try await _execute() + } + #else + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + @discardableResult + open func execute() async throws(ErrorResponse) -> Response { + try await _execute() + } + #endif + + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + @discardableResult + private func _execute() async throws(ErrorResponse) -> Response { do { let requestTask = self.requestTask return try await withTaskCancellationHandler { @@ -99,7 +114,6 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { self.execute { result in switch result { case let .success(response): - nonisolated(unsafe) let response = response continuation.resume(returning: response) case let .failure(error): continuation.resume(throwing: error) @@ -117,7 +131,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } } - + public func addHeader(name: String, value: String) -> Self { if !value.isEmpty { headers[name] = value @@ -130,7 +144,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } -public protocol RequestBuilderFactory { +public protocol RequestBuilderFactory: Sendable { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type } diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Models.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Models.swift index 6e7a6337deb0..2b7940a33af1 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Models.swift @@ -69,11 +69,11 @@ extension NullEncodable: Codable where Wrapped: Codable { } } -public enum ErrorResponse: Error { +public enum ErrorResponse: Error, @unchecked Sendable { case error(Int, Data?, URLResponse?, Error) } -public enum DownloadException: Error { +public enum DownloadException: Error, Sendable { case responseDataMissing case responseFailed case requestMissing @@ -81,7 +81,7 @@ public enum DownloadException: Error { case requestMissingURL } -public enum DecodableRequestBuilderError: Error { +public enum DecodableRequestBuilderError: Error, @unchecked Sendable { case emptyDataResponse case nilHTTPResponse case unsuccessfulHTTPStatusCode diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift index 74f69c0063d8..cb169eca2bcb 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift @@ -40,7 +40,7 @@ extension URLSession: URLSessionProtocol { extension URLSessionDataTask: URLSessionDataTaskProtocol {} -public class URLSessionRequestBuilderFactory: RequestBuilderFactory { +public final class URLSessionRequestBuilderFactory: RequestBuilderFactory, Sendable { public init() {} public func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -69,7 +69,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { var credentialStore = SynchronizedDictionary() } -open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { +open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { required public init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) @@ -319,7 +319,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } -open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { +open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift index b830e2d31a40..11b7ac6a90be 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift @@ -27,23 +27,23 @@ public struct ArrayRule: Sendable { public var uniqueItems: Bool } -public enum StringValidationErrorKind: Error { +public enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -public enum NumericValidationErrorKind: Error { +public enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -public enum ArrayValidationErrorKind: Error { +public enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -public struct ValidationError: Error { +public struct ValidationError: Error, Sendable { public fileprivate(set) var kinds: Set } -public struct Validator { +public struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift index b4218d3375c9..5308eaac92c0 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift @@ -6,7 +6,7 @@ import Foundation -public struct APIHelper { +public struct APIHelper: Sendable { public static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? { let destination = source.reduce(into: [String: any Sendable]()) { result, item in if let value = item.value { diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift index 3c4de9c14675..c7f49fa11157 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift @@ -47,7 +47,7 @@ open class PetstoreClientAPIConfiguration: @unchecked Sendable { public static let shared = PetstoreClientAPIConfiguration() } -open class RequestBuilder: @unchecked Sendable, Identifiable { +open class RequestBuilder: @unchecked Sendable, Identifiable { public var credential: URLCredential? public var headers: [String: String] public let parameters: [String: any Sendable]? @@ -95,7 +95,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } -public protocol RequestBuilderFactory { +public protocol RequestBuilderFactory: Sendable { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type } diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift index 6e7a6337deb0..2b7940a33af1 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift @@ -69,11 +69,11 @@ extension NullEncodable: Codable where Wrapped: Codable { } } -public enum ErrorResponse: Error { +public enum ErrorResponse: Error, @unchecked Sendable { case error(Int, Data?, URLResponse?, Error) } -public enum DownloadException: Error { +public enum DownloadException: Error, Sendable { case responseDataMissing case responseFailed case requestMissing @@ -81,7 +81,7 @@ public enum DownloadException: Error { case requestMissingURL } -public enum DecodableRequestBuilderError: Error { +public enum DecodableRequestBuilderError: Error, @unchecked Sendable { case emptyDataResponse case nilHTTPResponse case unsuccessfulHTTPStatusCode diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index 74f69c0063d8..cb169eca2bcb 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -40,7 +40,7 @@ extension URLSession: URLSessionProtocol { extension URLSessionDataTask: URLSessionDataTaskProtocol {} -public class URLSessionRequestBuilderFactory: RequestBuilderFactory { +public final class URLSessionRequestBuilderFactory: RequestBuilderFactory, Sendable { public init() {} public func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -69,7 +69,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { var credentialStore = SynchronizedDictionary() } -open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { +open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { required public init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) @@ -319,7 +319,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } -open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { +open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift index b830e2d31a40..11b7ac6a90be 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift @@ -27,23 +27,23 @@ public struct ArrayRule: Sendable { public var uniqueItems: Bool } -public enum StringValidationErrorKind: Error { +public enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -public enum NumericValidationErrorKind: Error { +public enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -public enum ArrayValidationErrorKind: Error { +public enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -public struct ValidationError: Error { +public struct ValidationError: Error, Sendable { public fileprivate(set) var kinds: Set } -public struct Validator { +public struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/APIHelper.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/APIHelper.swift index b4218d3375c9..5308eaac92c0 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/APIHelper.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/APIHelper.swift @@ -6,7 +6,7 @@ import Foundation -public struct APIHelper { +public struct APIHelper: Sendable { public static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? { let destination = source.reduce(into: [String: any Sendable]()) { result, item in if let value = item.value { diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/APIs.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/APIs.swift index 3c4de9c14675..c7f49fa11157 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/APIs.swift @@ -47,7 +47,7 @@ open class PetstoreClientAPIConfiguration: @unchecked Sendable { public static let shared = PetstoreClientAPIConfiguration() } -open class RequestBuilder: @unchecked Sendable, Identifiable { +open class RequestBuilder: @unchecked Sendable, Identifiable { public var credential: URLCredential? public var headers: [String: String] public let parameters: [String: any Sendable]? @@ -95,7 +95,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } -public protocol RequestBuilderFactory { +public protocol RequestBuilderFactory: Sendable { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type } diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Models.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Models.swift index 6e7a6337deb0..2b7940a33af1 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Models.swift @@ -69,11 +69,11 @@ extension NullEncodable: Codable where Wrapped: Codable { } } -public enum ErrorResponse: Error { +public enum ErrorResponse: Error, @unchecked Sendable { case error(Int, Data?, URLResponse?, Error) } -public enum DownloadException: Error { +public enum DownloadException: Error, Sendable { case responseDataMissing case responseFailed case requestMissing @@ -81,7 +81,7 @@ public enum DownloadException: Error { case requestMissingURL } -public enum DecodableRequestBuilderError: Error { +public enum DecodableRequestBuilderError: Error, @unchecked Sendable { case emptyDataResponse case nilHTTPResponse case unsuccessfulHTTPStatusCode diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/URLSessionImplementations.swift index 74f69c0063d8..cb169eca2bcb 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/URLSessionImplementations.swift @@ -40,7 +40,7 @@ extension URLSession: URLSessionProtocol { extension URLSessionDataTask: URLSessionDataTaskProtocol {} -public class URLSessionRequestBuilderFactory: RequestBuilderFactory { +public final class URLSessionRequestBuilderFactory: RequestBuilderFactory, Sendable { public init() {} public func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -69,7 +69,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { var credentialStore = SynchronizedDictionary() } -open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { +open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { required public init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) @@ -319,7 +319,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } -open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { +open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Validation.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Validation.swift index b830e2d31a40..11b7ac6a90be 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Validation.swift @@ -27,23 +27,23 @@ public struct ArrayRule: Sendable { public var uniqueItems: Bool } -public enum StringValidationErrorKind: Error { +public enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -public enum NumericValidationErrorKind: Error { +public enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -public enum ArrayValidationErrorKind: Error { +public enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -public struct ValidationError: Error { +public struct ValidationError: Error, Sendable { public fileprivate(set) var kinds: Set } -public struct Validator { +public struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/APIHelper.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/APIHelper.swift index b4218d3375c9..5308eaac92c0 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/APIHelper.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/APIHelper.swift @@ -6,7 +6,7 @@ import Foundation -public struct APIHelper { +public struct APIHelper: Sendable { public static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? { let destination = source.reduce(into: [String: any Sendable]()) { result, item in if let value = item.value { diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/APIs.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/APIs.swift index 1d94b12a8166..675c3cf609ed 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/APIs.swift @@ -47,7 +47,7 @@ open class PetstoreClientAPIConfiguration: @unchecked Sendable { public static let shared = PetstoreClientAPIConfiguration() } -open class RequestBuilder: @unchecked Sendable, Identifiable { +open class RequestBuilder: @unchecked Sendable, Identifiable { public var credential: URLCredential? public var headers: [String: String] public let parameters: [String: any Sendable]? @@ -83,9 +83,24 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { return requestTask } + #if compiler(>=6.2) + @concurrent @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) @discardableResult open func execute() async throws(ErrorResponse) -> Response { + try await _execute() + } + #else + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + @discardableResult + open func execute() async throws(ErrorResponse) -> Response { + try await _execute() + } + #endif + + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + @discardableResult + private func _execute() async throws(ErrorResponse) -> Response { do { let requestTask = self.requestTask return try await withTaskCancellationHandler { @@ -99,7 +114,6 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { self.execute { result in switch result { case let .success(response): - nonisolated(unsafe) let response = response continuation.resume(returning: response) case let .failure(error): continuation.resume(throwing: error) @@ -117,7 +131,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } } - + public func addHeader(name: String, value: String) -> Self { if !value.isEmpty { headers[name] = value @@ -130,7 +144,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } -public protocol RequestBuilderFactory { +public protocol RequestBuilderFactory: Sendable { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type } diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Models.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Models.swift index 6e7a6337deb0..2b7940a33af1 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Models.swift @@ -69,11 +69,11 @@ extension NullEncodable: Codable where Wrapped: Codable { } } -public enum ErrorResponse: Error { +public enum ErrorResponse: Error, @unchecked Sendable { case error(Int, Data?, URLResponse?, Error) } -public enum DownloadException: Error { +public enum DownloadException: Error, Sendable { case responseDataMissing case responseFailed case requestMissing @@ -81,7 +81,7 @@ public enum DownloadException: Error { case requestMissingURL } -public enum DecodableRequestBuilderError: Error { +public enum DecodableRequestBuilderError: Error, @unchecked Sendable { case emptyDataResponse case nilHTTPResponse case unsuccessfulHTTPStatusCode diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift index 74f69c0063d8..cb169eca2bcb 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift @@ -40,7 +40,7 @@ extension URLSession: URLSessionProtocol { extension URLSessionDataTask: URLSessionDataTaskProtocol {} -public class URLSessionRequestBuilderFactory: RequestBuilderFactory { +public final class URLSessionRequestBuilderFactory: RequestBuilderFactory, Sendable { public init() {} public func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -69,7 +69,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { var credentialStore = SynchronizedDictionary() } -open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { +open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { required public init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) @@ -319,7 +319,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } -open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { +open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Validation.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Validation.swift index b830e2d31a40..11b7ac6a90be 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Validation.swift @@ -27,23 +27,23 @@ public struct ArrayRule: Sendable { public var uniqueItems: Bool } -public enum StringValidationErrorKind: Error { +public enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -public enum NumericValidationErrorKind: Error { +public enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -public enum ArrayValidationErrorKind: Error { +public enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -public struct ValidationError: Error { +public struct ValidationError: Error, Sendable { public fileprivate(set) var kinds: Set } -public struct Validator { +public struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/APIHelper.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/APIHelper.swift index b4218d3375c9..5308eaac92c0 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/APIHelper.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/APIHelper.swift @@ -6,7 +6,7 @@ import Foundation -public struct APIHelper { +public struct APIHelper: Sendable { public static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? { let destination = source.reduce(into: [String: any Sendable]()) { result, item in if let value = item.value { diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/APIs.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/APIs.swift index 3c4de9c14675..c7f49fa11157 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/APIs.swift @@ -47,7 +47,7 @@ open class PetstoreClientAPIConfiguration: @unchecked Sendable { public static let shared = PetstoreClientAPIConfiguration() } -open class RequestBuilder: @unchecked Sendable, Identifiable { +open class RequestBuilder: @unchecked Sendable, Identifiable { public var credential: URLCredential? public var headers: [String: String] public let parameters: [String: any Sendable]? @@ -95,7 +95,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } -public protocol RequestBuilderFactory { +public protocol RequestBuilderFactory: Sendable { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type } diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Models.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Models.swift index 6e7a6337deb0..2b7940a33af1 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Models.swift @@ -69,11 +69,11 @@ extension NullEncodable: Codable where Wrapped: Codable { } } -public enum ErrorResponse: Error { +public enum ErrorResponse: Error, @unchecked Sendable { case error(Int, Data?, URLResponse?, Error) } -public enum DownloadException: Error { +public enum DownloadException: Error, Sendable { case responseDataMissing case responseFailed case requestMissing @@ -81,7 +81,7 @@ public enum DownloadException: Error { case requestMissingURL } -public enum DecodableRequestBuilderError: Error { +public enum DecodableRequestBuilderError: Error, @unchecked Sendable { case emptyDataResponse case nilHTTPResponse case unsuccessfulHTTPStatusCode diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift index 74f69c0063d8..cb169eca2bcb 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift @@ -40,7 +40,7 @@ extension URLSession: URLSessionProtocol { extension URLSessionDataTask: URLSessionDataTaskProtocol {} -public class URLSessionRequestBuilderFactory: RequestBuilderFactory { +public final class URLSessionRequestBuilderFactory: RequestBuilderFactory, Sendable { public init() {} public func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -69,7 +69,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { var credentialStore = SynchronizedDictionary() } -open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { +open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { required public init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) @@ -319,7 +319,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } -open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { +open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Validation.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Validation.swift index b830e2d31a40..11b7ac6a90be 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Validation.swift @@ -27,23 +27,23 @@ public struct ArrayRule: Sendable { public var uniqueItems: Bool } -public enum StringValidationErrorKind: Error { +public enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -public enum NumericValidationErrorKind: Error { +public enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -public enum ArrayValidationErrorKind: Error { +public enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -public struct ValidationError: Error { +public struct ValidationError: Error, Sendable { public fileprivate(set) var kinds: Set } -public struct Validator { +public struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift index 67363bd51bb6..7e8bbecc09d2 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class AdditionalPropertiesClass: NSObject, Codable { +@objcMembers public final class AdditionalPropertiesClass: NSObject, Codable, @unchecked Sendable { public var mapString: [String: String]? public var mapMapString: [String: [String: String]]? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Animal.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Animal.swift index 73979b9c7dfa..5452a85517eb 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Animal.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Animal.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class Animal: NSObject, Codable { +@objcMembers public final class Animal: NSObject, Codable, @unchecked Sendable { public var _className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ApiResponse.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ApiResponse.swift index 99c3cc011f9a..cf1e3d206d31 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ApiResponse.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ApiResponse.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class ApiResponse: NSObject, Codable { +@objcMembers public final class ApiResponse: NSObject, Codable, @unchecked Sendable { public var code: Int? public var codeNum: NSNumber? { diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift index d99f7676974d..4ece3604ea54 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class ArrayOfArrayOfNumberOnly: NSObject, Codable { +@objcMembers public final class ArrayOfArrayOfNumberOnly: NSObject, Codable, @unchecked Sendable { public var arrayArrayNumber: [[Double]]? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift index 8995bbdf2d72..67b719892002 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class ArrayOfNumberOnly: NSObject, Codable { +@objcMembers public final class ArrayOfNumberOnly: NSObject, Codable, @unchecked Sendable { public var arrayNumber: [Double]? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayTest.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayTest.swift index 03e4b517b264..9d44d508ca2d 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayTest.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayTest.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class ArrayTest: NSObject, Codable { +@objcMembers public final class ArrayTest: NSObject, Codable, @unchecked Sendable { public var arrayOfString: [String]? public var arrayArrayOfInteger: [[Int64]]? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Capitalization.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Capitalization.swift index c37099bfb486..67b0a829c450 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Capitalization.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Capitalization.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class Capitalization: NSObject, Codable { +@objcMembers public final class Capitalization: NSObject, Codable, @unchecked Sendable { public var smallCamel: String? public var capitalCamel: String? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Cat.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Cat.swift index 4c5ac7fbc90a..348917b88da0 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Cat.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Cat.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class Cat: NSObject, Codable { +@objcMembers public final class Cat: NSObject, Codable, @unchecked Sendable { public var _className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Category.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Category.swift index 96fcaff3d401..a015f83a5f66 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Category.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Category.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class Category: NSObject, Codable { +@objcMembers public final class Category: NSObject, Codable, @unchecked Sendable { public var _id: Int64? public var _idNum: NSNumber? { diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ClassModel.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ClassModel.swift index 4978f212ac10..20b9477b854c 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ClassModel.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ClassModel.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model with \"_class\" property */ -@objcMembers public class ClassModel: NSObject, Codable { +@objcMembers public final class ClassModel: NSObject, Codable, @unchecked Sendable { public var _class: String? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Client.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Client.swift index dbad08f4cee0..b0ffa2ecadf6 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Client.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Client.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class Client: NSObject, Codable { +@objcMembers public final class Client: NSObject, Codable, @unchecked Sendable { public var client: String? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Dog.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Dog.swift index 972028f8d87b..939a335abed5 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Dog.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Dog.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class Dog: NSObject, Codable { +@objcMembers public final class Dog: NSObject, Codable, @unchecked Sendable { public var _className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/EnumArrays.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/EnumArrays.swift index 93e9af26ba6a..6b5295f71777 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/EnumArrays.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/EnumArrays.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class EnumArrays: NSObject, Codable { +@objcMembers public final class EnumArrays: NSObject, Codable, @unchecked Sendable { public enum JustSymbol: String, Sendable, Codable, CaseIterable { case greaterThanOrEqualTo = ">=" diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/EnumTest.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/EnumTest.swift index ecefb6644fb2..3f16a5a51fe1 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/EnumTest.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/EnumTest.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class EnumTest: NSObject, Codable { +@objcMembers public final class EnumTest: NSObject, Codable, @unchecked Sendable { public enum EnumString: String, Sendable, Codable, CaseIterable { case upper = "UPPER" diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/File.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/File.swift index c8cb3ec9ca5a..3236733b5b24 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/File.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/File.swift @@ -8,7 +8,7 @@ import Foundation /** Must be named `File` for test. */ -@objcMembers public class File: NSObject, Codable { +@objcMembers public final class File: NSObject, Codable, @unchecked Sendable { /** Test capitalization */ public var sourceURI: String? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/FileSchemaTestClass.swift index 678e7dc717e2..e10083a40ba9 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/FileSchemaTestClass.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/FileSchemaTestClass.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class FileSchemaTestClass: NSObject, Codable { +@objcMembers public final class FileSchemaTestClass: NSObject, Codable, @unchecked Sendable { public var file: File? public var files: [File]? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/FormatTest.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/FormatTest.swift index 2a229371bf2e..f93c182df2f3 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/FormatTest.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/FormatTest.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class FormatTest: NSObject, Codable { +@objcMembers public final class FormatTest: NSObject, Codable, @unchecked Sendable { public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift index 5539b28b047e..37cb9878d4aa 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class HasOnlyReadOnly: NSObject, Codable { +@objcMembers public final class HasOnlyReadOnly: NSObject, Codable, @unchecked Sendable { public var bar: String? public var foo: String? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/List.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/List.swift index 437e6e295793..431f13917f87 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/List.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/List.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class List: NSObject, Codable { +@objcMembers public final class List: NSObject, Codable, @unchecked Sendable { public var _123list: String? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/MapTest.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/MapTest.swift index 9a3a4c6f0ab9..2639df5a7711 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/MapTest.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/MapTest.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class MapTest: NSObject, Codable { +@objcMembers public final class MapTest: NSObject, Codable, @unchecked Sendable { public enum MapOfEnumString: String, Sendable, Codable, CaseIterable { case upper = "UPPER" diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index 3c209dadf694..9db6a8e59a18 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class MixedPropertiesAndAdditionalPropertiesClass: NSObject, Codable { +@objcMembers public final class MixedPropertiesAndAdditionalPropertiesClass: NSObject, Codable, @unchecked Sendable { public var uuid: UUID? public var dateTime: Date? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Model200Response.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Model200Response.swift index 01417dc973db..4cf09f3d1aec 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Model200Response.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Model200Response.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model name starting with number */ -@objcMembers public class Model200Response: NSObject, Codable { +@objcMembers public final class Model200Response: NSObject, Codable, @unchecked Sendable { public var name: Int? public var nameNum: NSNumber? { diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Name.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Name.swift index ea194f23abe9..9d1b18bc6159 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Name.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Name.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model name same as property name */ -@objcMembers public class Name: NSObject, Codable { +@objcMembers public final class Name: NSObject, Codable, @unchecked Sendable { public var name: Int public var snakeCase: NullEncodable = .encodeValue(11033) diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/NumberOnly.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/NumberOnly.swift index 0bf7187db5ab..23145cf57472 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/NumberOnly.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/NumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class NumberOnly: NSObject, Codable { +@objcMembers public final class NumberOnly: NSObject, Codable, @unchecked Sendable { public var justNumber: Double? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Order.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Order.swift index 0a73b6782855..40c33e727967 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Order.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Order.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class Order: NSObject, Codable { +@objcMembers public final class Order: NSObject, Codable, @unchecked Sendable { public enum Status: String, Sendable, Codable, CaseIterable { case placed = "placed" diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/OuterComposite.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/OuterComposite.swift index 6eecc41fd8b2..7f507d7248fc 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/OuterComposite.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/OuterComposite.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class OuterComposite: NSObject, Codable { +@objcMembers public final class OuterComposite: NSObject, Codable, @unchecked Sendable { public var myNumber: Double? public var myString: String? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Pet.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Pet.swift index f41187772fb9..70698fc0136a 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Pet.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Pet.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class Pet: NSObject, Codable { +@objcMembers public final class Pet: NSObject, Codable, @unchecked Sendable { public enum Status: String, Sendable, Codable, CaseIterable { case available = "available" diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ReadOnlyFirst.swift index e7df6a5b1164..0663e2751ff0 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ReadOnlyFirst.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class ReadOnlyFirst: NSObject, Codable { +@objcMembers public final class ReadOnlyFirst: NSObject, Codable, @unchecked Sendable { public var bar: String? public var baz: String? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Return.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Return.swift index d832278eb61f..7058ae9ba6e7 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Return.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Return.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing reserved words */ -@objcMembers public class Return: NSObject, Codable { +@objcMembers public final class Return: NSObject, Codable, @unchecked Sendable { public var _return: Int? public var _returnNum: NSNumber? { diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/SpecialModelName.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/SpecialModelName.swift index 33a6e621028c..6a83870af31b 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/SpecialModelName.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class SpecialModelName: NSObject, Codable { +@objcMembers public final class SpecialModelName: NSObject, Codable, @unchecked Sendable { public var specialPropertyName: Int64? public var specialPropertyNameNum: NSNumber? { diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/StringBooleanMap.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/StringBooleanMap.swift index a3240d3e3724..e94fc01c4555 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/StringBooleanMap.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/StringBooleanMap.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class StringBooleanMap: NSObject, Codable { +@objcMembers public final class StringBooleanMap: NSObject, Codable, @unchecked Sendable { public enum CodingKeys: CodingKey, CaseIterable { diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Tag.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Tag.swift index 51a4111dbce4..bc2ad89a9040 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Tag.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Tag.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class Tag: NSObject, Codable { +@objcMembers public final class Tag: NSObject, Codable, @unchecked Sendable { public var _id: Int64? public var _idNum: NSNumber? { diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/TypeHolderDefault.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/TypeHolderDefault.swift index c5f3a002a8ad..4c9656ad6904 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/TypeHolderDefault.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/TypeHolderDefault.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class TypeHolderDefault: NSObject, Codable { +@objcMembers public final class TypeHolderDefault: NSObject, Codable, @unchecked Sendable { public var stringItem: String = "what" public var numberItem: Double diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/TypeHolderExample.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/TypeHolderExample.swift index 36ddbd26f366..bac63f74c5cd 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/TypeHolderExample.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/TypeHolderExample.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class TypeHolderExample: NSObject, Codable { +@objcMembers public final class TypeHolderExample: NSObject, Codable, @unchecked Sendable { public var stringItem: String public var numberItem: Double diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/User.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/User.swift index 434186d6edb2..c93aa17cc872 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/User.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/User.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class User: NSObject, Codable { +@objcMembers public final class User: NSObject, Codable, @unchecked Sendable { public var _id: Int64? public var _idNum: NSNumber? { diff --git a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift index b4218d3375c9..5308eaac92c0 100644 --- a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift +++ b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift @@ -6,7 +6,7 @@ import Foundation -public struct APIHelper { +public struct APIHelper: Sendable { public static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? { let destination = source.reduce(into: [String: any Sendable]()) { result, item in if let value = item.value { diff --git a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift index e3a1fd2b8380..2aa84c29d112 100644 --- a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift @@ -47,7 +47,7 @@ open class PetstoreClientAPIConfiguration: @unchecked Sendable { public static let shared = PetstoreClientAPIConfiguration() } -open class RequestBuilder: @unchecked Sendable, Identifiable { +open class RequestBuilder: @unchecked Sendable, Identifiable { public var credential: URLCredential? public var headers: [String: String] public let parameters: [String: any Sendable]? @@ -95,7 +95,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } -public protocol RequestBuilderFactory { +public protocol RequestBuilderFactory: Sendable { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type } diff --git a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift index 6e7a6337deb0..2b7940a33af1 100644 --- a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift @@ -69,11 +69,11 @@ extension NullEncodable: Codable where Wrapped: Codable { } } -public enum ErrorResponse: Error { +public enum ErrorResponse: Error, @unchecked Sendable { case error(Int, Data?, URLResponse?, Error) } -public enum DownloadException: Error { +public enum DownloadException: Error, Sendable { case responseDataMissing case responseFailed case requestMissing @@ -81,7 +81,7 @@ public enum DownloadException: Error { case requestMissingURL } -public enum DecodableRequestBuilderError: Error { +public enum DecodableRequestBuilderError: Error, @unchecked Sendable { case emptyDataResponse case nilHTTPResponse case unsuccessfulHTTPStatusCode diff --git a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index 74f69c0063d8..cb169eca2bcb 100644 --- a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -40,7 +40,7 @@ extension URLSession: URLSessionProtocol { extension URLSessionDataTask: URLSessionDataTaskProtocol {} -public class URLSessionRequestBuilderFactory: RequestBuilderFactory { +public final class URLSessionRequestBuilderFactory: RequestBuilderFactory, Sendable { public init() {} public func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -69,7 +69,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { var credentialStore = SynchronizedDictionary() } -open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { +open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { required public init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) @@ -319,7 +319,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } -open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { +open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { diff --git a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift index b830e2d31a40..11b7ac6a90be 100644 --- a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift @@ -27,23 +27,23 @@ public struct ArrayRule: Sendable { public var uniqueItems: Bool } -public enum StringValidationErrorKind: Error { +public enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -public enum NumericValidationErrorKind: Error { +public enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -public enum ArrayValidationErrorKind: Error { +public enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -public struct ValidationError: Error { +public struct ValidationError: Error, Sendable { public fileprivate(set) var kinds: Set } -public struct Validator { +public struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift index b4218d3375c9..5308eaac92c0 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift @@ -6,7 +6,7 @@ import Foundation -public struct APIHelper { +public struct APIHelper: Sendable { public static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? { let destination = source.reduce(into: [String: any Sendable]()) { result, item in if let value = item.value { diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift index 3c4de9c14675..c7f49fa11157 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift @@ -47,7 +47,7 @@ open class PetstoreClientAPIConfiguration: @unchecked Sendable { public static let shared = PetstoreClientAPIConfiguration() } -open class RequestBuilder: @unchecked Sendable, Identifiable { +open class RequestBuilder: @unchecked Sendable, Identifiable { public var credential: URLCredential? public var headers: [String: String] public let parameters: [String: any Sendable]? @@ -95,7 +95,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } -public protocol RequestBuilderFactory { +public protocol RequestBuilderFactory: Sendable { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type } diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift index 6e7a6337deb0..2b7940a33af1 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift @@ -69,11 +69,11 @@ extension NullEncodable: Codable where Wrapped: Codable { } } -public enum ErrorResponse: Error { +public enum ErrorResponse: Error, @unchecked Sendable { case error(Int, Data?, URLResponse?, Error) } -public enum DownloadException: Error { +public enum DownloadException: Error, Sendable { case responseDataMissing case responseFailed case requestMissing @@ -81,7 +81,7 @@ public enum DownloadException: Error { case requestMissingURL } -public enum DecodableRequestBuilderError: Error { +public enum DecodableRequestBuilderError: Error, @unchecked Sendable { case emptyDataResponse case nilHTTPResponse case unsuccessfulHTTPStatusCode diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index 74f69c0063d8..cb169eca2bcb 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -40,7 +40,7 @@ extension URLSession: URLSessionProtocol { extension URLSessionDataTask: URLSessionDataTaskProtocol {} -public class URLSessionRequestBuilderFactory: RequestBuilderFactory { +public final class URLSessionRequestBuilderFactory: RequestBuilderFactory, Sendable { public init() {} public func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -69,7 +69,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { var credentialStore = SynchronizedDictionary() } -open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { +open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { required public init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) @@ -319,7 +319,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } -open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { +open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift index b830e2d31a40..11b7ac6a90be 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift @@ -27,23 +27,23 @@ public struct ArrayRule: Sendable { public var uniqueItems: Bool } -public enum StringValidationErrorKind: Error { +public enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -public enum NumericValidationErrorKind: Error { +public enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -public enum ArrayValidationErrorKind: Error { +public enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -public struct ValidationError: Error { +public struct ValidationError: Error, Sendable { public fileprivate(set) var kinds: Set } -public struct Validator { +public struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift index f576985cdd7e..6a86fc03d8f6 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift @@ -6,7 +6,7 @@ import Foundation -internal struct APIHelper { +internal struct APIHelper: Sendable { internal static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? { let destination = source.reduce(into: [String: any Sendable]()) { result, item in if let value = item.value { diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift index 15d7a5af2665..fc4bec788267 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift @@ -47,7 +47,7 @@ internal class PetstoreClientAPIConfiguration: @unchecked Sendable { internal static let shared = PetstoreClientAPIConfiguration() } -internal class RequestBuilder: @unchecked Sendable, Identifiable { +internal class RequestBuilder: @unchecked Sendable, Identifiable { internal var credential: URLCredential? internal var headers: [String: String] internal let parameters: [String: any Sendable]? @@ -95,7 +95,7 @@ internal class RequestBuilder: @unchecked Sendable, Identifiable { } } -internal protocol RequestBuilderFactory { +internal protocol RequestBuilderFactory: Sendable { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type } diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift index 0f7fca84583b..74c89f434f10 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift @@ -69,11 +69,11 @@ extension NullEncodable: Codable where Wrapped: Codable { } } -internal enum ErrorResponse: Error { +internal enum ErrorResponse: Error, @unchecked Sendable { case error(Int, Data?, URLResponse?, Error) } -internal enum DownloadException: Error { +internal enum DownloadException: Error, Sendable { case responseDataMissing case responseFailed case requestMissing @@ -81,7 +81,7 @@ internal enum DownloadException: Error { case requestMissingURL } -internal enum DecodableRequestBuilderError: Error { +internal enum DecodableRequestBuilderError: Error, @unchecked Sendable { case emptyDataResponse case nilHTTPResponse case unsuccessfulHTTPStatusCode diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index ac134522359d..ee2715910e3a 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -40,7 +40,7 @@ extension URLSession: URLSessionProtocol { extension URLSessionDataTask: URLSessionDataTaskProtocol {} -internal class URLSessionRequestBuilderFactory: RequestBuilderFactory { +internal final class URLSessionRequestBuilderFactory: RequestBuilderFactory, Sendable { internal init() {} internal func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -69,7 +69,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { var credentialStore = SynchronizedDictionary() } -internal class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { +internal class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { required internal init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) @@ -319,7 +319,7 @@ internal class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendab } -internal class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { +internal class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift index 38e3460f565e..c52c511100ea 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift @@ -27,23 +27,23 @@ internal struct ArrayRule: Sendable { internal var uniqueItems: Bool } -internal enum StringValidationErrorKind: Error { +internal enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -internal enum NumericValidationErrorKind: Error { +internal enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -internal enum ArrayValidationErrorKind: Error { +internal enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -internal struct ValidationError: Error { +internal struct ValidationError: Error, Sendable { internal fileprivate(set) var kinds: Set } -internal struct Validator { +internal struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift index b4218d3375c9..5308eaac92c0 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift @@ -6,7 +6,7 @@ import Foundation -public struct APIHelper { +public struct APIHelper: Sendable { public static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? { let destination = source.reduce(into: [String: any Sendable]()) { result, item in if let value = item.value { diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift index 3c4de9c14675..c7f49fa11157 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift @@ -47,7 +47,7 @@ open class PetstoreClientAPIConfiguration: @unchecked Sendable { public static let shared = PetstoreClientAPIConfiguration() } -open class RequestBuilder: @unchecked Sendable, Identifiable { +open class RequestBuilder: @unchecked Sendable, Identifiable { public var credential: URLCredential? public var headers: [String: String] public let parameters: [String: any Sendable]? @@ -95,7 +95,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } -public protocol RequestBuilderFactory { +public protocol RequestBuilderFactory: Sendable { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type } diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift index 6e7a6337deb0..2b7940a33af1 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift @@ -69,11 +69,11 @@ extension NullEncodable: Codable where Wrapped: Codable { } } -public enum ErrorResponse: Error { +public enum ErrorResponse: Error, @unchecked Sendable { case error(Int, Data?, URLResponse?, Error) } -public enum DownloadException: Error { +public enum DownloadException: Error, Sendable { case responseDataMissing case responseFailed case requestMissing @@ -81,7 +81,7 @@ public enum DownloadException: Error { case requestMissingURL } -public enum DecodableRequestBuilderError: Error { +public enum DecodableRequestBuilderError: Error, @unchecked Sendable { case emptyDataResponse case nilHTTPResponse case unsuccessfulHTTPStatusCode diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index 74f69c0063d8..cb169eca2bcb 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -40,7 +40,7 @@ extension URLSession: URLSessionProtocol { extension URLSessionDataTask: URLSessionDataTaskProtocol {} -public class URLSessionRequestBuilderFactory: RequestBuilderFactory { +public final class URLSessionRequestBuilderFactory: RequestBuilderFactory, Sendable { public init() {} public func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -69,7 +69,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { var credentialStore = SynchronizedDictionary() } -open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { +open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { required public init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) @@ -319,7 +319,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } -open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { +open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift index b830e2d31a40..11b7ac6a90be 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift @@ -27,23 +27,23 @@ public struct ArrayRule: Sendable { public var uniqueItems: Bool } -public enum StringValidationErrorKind: Error { +public enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -public enum NumericValidationErrorKind: Error { +public enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -public enum ArrayValidationErrorKind: Error { +public enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -public struct ValidationError: Error { +public struct ValidationError: Error, Sendable { public fileprivate(set) var kinds: Set } -public struct Validator { +public struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/APIHelper.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/APIHelper.swift index b4218d3375c9..5308eaac92c0 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/APIHelper.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/APIHelper.swift @@ -6,7 +6,7 @@ import Foundation -public struct APIHelper { +public struct APIHelper: Sendable { public static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? { let destination = source.reduce(into: [String: any Sendable]()) { result, item in if let value = item.value { diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift index 5483a1487591..6c19df9add1e 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift @@ -49,7 +49,7 @@ open class PetstoreClientAPIConfiguration: @unchecked Sendable { public static let shared = PetstoreClientAPIConfiguration() } -open class RequestBuilder: @unchecked Sendable, Identifiable { +open class RequestBuilder: @unchecked Sendable, Identifiable { public var credential: URLCredential? public var headers: [String: String] public let parameters: [String: any Sendable]? @@ -97,7 +97,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } -public protocol RequestBuilderFactory { +public protocol RequestBuilderFactory: Sendable { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type } diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Models.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Models.swift index 6e7a6337deb0..2b7940a33af1 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Models.swift @@ -69,11 +69,11 @@ extension NullEncodable: Codable where Wrapped: Codable { } } -public enum ErrorResponse: Error { +public enum ErrorResponse: Error, @unchecked Sendable { case error(Int, Data?, URLResponse?, Error) } -public enum DownloadException: Error { +public enum DownloadException: Error, Sendable { case responseDataMissing case responseFailed case requestMissing @@ -81,7 +81,7 @@ public enum DownloadException: Error { case requestMissingURL } -public enum DecodableRequestBuilderError: Error { +public enum DecodableRequestBuilderError: Error, @unchecked Sendable { case emptyDataResponse case nilHTTPResponse case unsuccessfulHTTPStatusCode diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift index 74f69c0063d8..cb169eca2bcb 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift @@ -40,7 +40,7 @@ extension URLSession: URLSessionProtocol { extension URLSessionDataTask: URLSessionDataTaskProtocol {} -public class URLSessionRequestBuilderFactory: RequestBuilderFactory { +public final class URLSessionRequestBuilderFactory: RequestBuilderFactory, Sendable { public init() {} public func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -69,7 +69,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { var credentialStore = SynchronizedDictionary() } -open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { +open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { required public init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) @@ -319,7 +319,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } -open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { +open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift index b830e2d31a40..11b7ac6a90be 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift @@ -27,23 +27,23 @@ public struct ArrayRule: Sendable { public var uniqueItems: Bool } -public enum StringValidationErrorKind: Error { +public enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -public enum NumericValidationErrorKind: Error { +public enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -public enum ArrayValidationErrorKind: Error { +public enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -public struct ValidationError: Error { +public struct ValidationError: Error, Sendable { public fileprivate(set) var kinds: Set } -public struct Validator { +public struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. diff --git a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift index b4218d3375c9..5308eaac92c0 100644 --- a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift +++ b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIHelper.swift @@ -6,7 +6,7 @@ import Foundation -public struct APIHelper { +public struct APIHelper: Sendable { public static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? { let destination = source.reduce(into: [String: any Sendable]()) { result, item in if let value = item.value { diff --git a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift index 98c27f3af422..0b3554a37cfd 100644 --- a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/APIs.swift @@ -47,7 +47,7 @@ open class PetstoreClientAPIConfiguration: @unchecked Sendable { public static let shared = PetstoreClientAPIConfiguration() } -open class RequestBuilder: @unchecked Sendable, Identifiable { +open class RequestBuilder: @unchecked Sendable, Identifiable { public var credential: URLCredential? public var headers: [String: String] public let parameters: [String: any Sendable]? @@ -83,9 +83,24 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { return requestTask } + #if compiler(>=6.2) + @concurrent @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) @discardableResult open func execute() async throws(ErrorResponse) -> Response { + try await _execute() + } + #else + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + @discardableResult + open func execute() async throws(ErrorResponse) -> Response { + try await _execute() + } + #endif + + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + @discardableResult + private func _execute() async throws(ErrorResponse) -> Response { do { let requestTask = self.requestTask return try await withTaskCancellationHandler { @@ -99,7 +114,6 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { self.execute { result in switch result { case let .success(response): - nonisolated(unsafe) let response = response continuation.resume(returning: response) case let .failure(error): continuation.resume(throwing: error) @@ -117,7 +131,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } } - + public func addHeader(name: String, value: String) -> Self { if !value.isEmpty { headers[name] = value @@ -130,7 +144,7 @@ open class RequestBuilder: @unchecked Sendable, Identifiable { } } -public protocol RequestBuilderFactory { +public protocol RequestBuilderFactory: Sendable { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type } diff --git a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift index 6e7a6337deb0..2b7940a33af1 100644 --- a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift @@ -69,11 +69,11 @@ extension NullEncodable: Codable where Wrapped: Codable { } } -public enum ErrorResponse: Error { +public enum ErrorResponse: Error, @unchecked Sendable { case error(Int, Data?, URLResponse?, Error) } -public enum DownloadException: Error { +public enum DownloadException: Error, Sendable { case responseDataMissing case responseFailed case requestMissing @@ -81,7 +81,7 @@ public enum DownloadException: Error { case requestMissingURL } -public enum DecodableRequestBuilderError: Error { +public enum DecodableRequestBuilderError: Error, @unchecked Sendable { case emptyDataResponse case nilHTTPResponse case unsuccessfulHTTPStatusCode diff --git a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index 74f69c0063d8..cb169eca2bcb 100644 --- a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -40,7 +40,7 @@ extension URLSession: URLSessionProtocol { extension URLSessionDataTask: URLSessionDataTaskProtocol {} -public class URLSessionRequestBuilderFactory: RequestBuilderFactory { +public final class URLSessionRequestBuilderFactory: RequestBuilderFactory, Sendable { public init() {} public func getNonDecodableBuilder() -> RequestBuilder.Type { @@ -69,7 +69,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { var credentialStore = SynchronizedDictionary() } -open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { +open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { required public init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) { super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration) @@ -319,7 +319,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { } -open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { +open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder, @unchecked Sendable { override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, httpResponse: HTTPURLResponse, error: Error?, completion: @Sendable @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { switch T.self { diff --git a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift index b830e2d31a40..11b7ac6a90be 100644 --- a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift @@ -27,23 +27,23 @@ public struct ArrayRule: Sendable { public var uniqueItems: Bool } -public enum StringValidationErrorKind: Error { +public enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -public enum NumericValidationErrorKind: Error { +public enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -public enum ArrayValidationErrorKind: Error { +public enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -public struct ValidationError: Error { +public struct ValidationError: Error, Sendable { public fileprivate(set) var kinds: Set } -public struct Validator { +public struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift index b830e2d31a40..11b7ac6a90be 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift @@ -27,23 +27,23 @@ public struct ArrayRule: Sendable { public var uniqueItems: Bool } -public enum StringValidationErrorKind: Error { +public enum StringValidationErrorKind: Error, Sendable { case minLength, maxLength, pattern } -public enum NumericValidationErrorKind: Error { +public enum NumericValidationErrorKind: Error, Sendable { case minimum, maximum, multipleOf } -public enum ArrayValidationErrorKind: Error { +public enum ArrayValidationErrorKind: Error, Sendable { case minItems, maxItems, uniqueItems } -public struct ValidationError: Error { +public struct ValidationError: Error, Sendable { public fileprivate(set) var kinds: Set } -public struct Validator { +public struct Validator: Sendable { /// Validate a string against a rule. /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation.