From 4b91e48611382c92b6ec11e5d1164df0b13809f8 Mon Sep 17 00:00:00 2001 From: MahdiBM Date: Mon, 27 Nov 2023 21:06:52 +0330 Subject: [PATCH 1/6] remove `@preconcurrency`s --- Sources/OpenAPIRuntime/Conversion/Converter.swift | 2 +- Sources/OpenAPIRuntime/Errors/ClientError.swift | 8 ++------ Sources/OpenAPIRuntime/Interface/ClientTransport.swift | 4 ---- Sources/OpenAPIRuntime/Interface/UniversalServer.swift | 4 ++-- .../URICoder/Test_URICodingRoundtrip.swift | 3 --- 5 files changed, 5 insertions(+), 16 deletions(-) diff --git a/Sources/OpenAPIRuntime/Conversion/Converter.swift b/Sources/OpenAPIRuntime/Conversion/Converter.swift index bd7566b9..9e3408e9 100644 --- a/Sources/OpenAPIRuntime/Conversion/Converter.swift +++ b/Sources/OpenAPIRuntime/Conversion/Converter.swift @@ -15,7 +15,7 @@ import Foundation #else @preconcurrency import class Foundation.JSONEncoder -@preconcurrency import class Foundation.JSONDecoder +import class Foundation.JSONDecoder #endif /// Converter between generated and HTTP currency types. diff --git a/Sources/OpenAPIRuntime/Errors/ClientError.swift b/Sources/OpenAPIRuntime/Errors/ClientError.swift index 5a20f224..eea4081e 100644 --- a/Sources/OpenAPIRuntime/Errors/ClientError.swift +++ b/Sources/OpenAPIRuntime/Errors/ClientError.swift @@ -13,12 +13,8 @@ //===----------------------------------------------------------------------===// import HTTPTypes -#if canImport(Darwin) -import Foundation -#else -@preconcurrency import struct Foundation.URL -@preconcurrency import protocol Foundation.LocalizedError -#endif +import struct Foundation.URL +import protocol Foundation.LocalizedError /// An error thrown by a client performing an OpenAPI operation. /// diff --git a/Sources/OpenAPIRuntime/Interface/ClientTransport.swift b/Sources/OpenAPIRuntime/Interface/ClientTransport.swift index 3786bcea..200520ca 100644 --- a/Sources/OpenAPIRuntime/Interface/ClientTransport.swift +++ b/Sources/OpenAPIRuntime/Interface/ClientTransport.swift @@ -13,11 +13,7 @@ //===----------------------------------------------------------------------===// import HTTPTypes -#if canImport(Darwin) import struct Foundation.URL -#else -@preconcurrency import struct Foundation.URL -#endif /// A type that performs HTTP operations. /// diff --git a/Sources/OpenAPIRuntime/Interface/UniversalServer.swift b/Sources/OpenAPIRuntime/Interface/UniversalServer.swift index 80d69e25..5acc06f0 100644 --- a/Sources/OpenAPIRuntime/Interface/UniversalServer.swift +++ b/Sources/OpenAPIRuntime/Interface/UniversalServer.swift @@ -16,11 +16,11 @@ import HTTPTypes #if canImport(Darwin) import struct Foundation.URL -import struct Foundation.URLComponents #else @preconcurrency import struct Foundation.URL -@preconcurrency import struct Foundation.URLComponents #endif +import struct Foundation.URLComponents + /// OpenAPI document-agnostic HTTP server used by OpenAPI document-specific, /// generated servers to perform request deserialization, middleware and handler diff --git a/Tests/OpenAPIRuntimeTests/URICoder/Test_URICodingRoundtrip.swift b/Tests/OpenAPIRuntimeTests/URICoder/Test_URICodingRoundtrip.swift index 0487c756..f2eb485a 100644 --- a/Tests/OpenAPIRuntimeTests/URICoder/Test_URICodingRoundtrip.swift +++ b/Tests/OpenAPIRuntimeTests/URICoder/Test_URICodingRoundtrip.swift @@ -13,9 +13,6 @@ //===----------------------------------------------------------------------===// import XCTest @_spi(Generated) @testable import OpenAPIRuntime -#if os(Linux) -@preconcurrency import Foundation -#endif final class Test_URICodingRoundtrip: Test_Runtime { From 89ba36ecf341b192007083430cef9954325ab781 Mon Sep 17 00:00:00 2001 From: MahdiBM Date: Tue, 28 Nov 2023 13:39:05 +0330 Subject: [PATCH 2/6] add back URL with preconcurrency --- Sources/OpenAPIRuntime/Errors/ClientError.swift | 6 +++++- Sources/OpenAPIRuntime/Interface/ClientTransport.swift | 6 +++++- Sources/OpenAPIRuntime/Interface/UniversalServer.swift | 1 - 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Sources/OpenAPIRuntime/Errors/ClientError.swift b/Sources/OpenAPIRuntime/Errors/ClientError.swift index eea4081e..ce1c1128 100644 --- a/Sources/OpenAPIRuntime/Errors/ClientError.swift +++ b/Sources/OpenAPIRuntime/Errors/ClientError.swift @@ -13,7 +13,11 @@ //===----------------------------------------------------------------------===// import HTTPTypes -import struct Foundation.URL +#if canImport(Darwin) +import Foundation +#else +@preconcurrency import struct Foundation.URL +#endif import protocol Foundation.LocalizedError /// An error thrown by a client performing an OpenAPI operation. diff --git a/Sources/OpenAPIRuntime/Interface/ClientTransport.swift b/Sources/OpenAPIRuntime/Interface/ClientTransport.swift index 200520ca..bd7a5393 100644 --- a/Sources/OpenAPIRuntime/Interface/ClientTransport.swift +++ b/Sources/OpenAPIRuntime/Interface/ClientTransport.swift @@ -13,7 +13,11 @@ //===----------------------------------------------------------------------===// import HTTPTypes -import struct Foundation.URL +#if canImport(Darwin) +import Foundation +#else +@preconcurrency import struct Foundation.URL +#endif /// A type that performs HTTP operations. /// diff --git a/Sources/OpenAPIRuntime/Interface/UniversalServer.swift b/Sources/OpenAPIRuntime/Interface/UniversalServer.swift index 5acc06f0..04cc7e6d 100644 --- a/Sources/OpenAPIRuntime/Interface/UniversalServer.swift +++ b/Sources/OpenAPIRuntime/Interface/UniversalServer.swift @@ -13,7 +13,6 @@ //===----------------------------------------------------------------------===// import HTTPTypes - #if canImport(Darwin) import struct Foundation.URL #else From 2d4060ce55319275f2a009d9a9032065da1eb0f4 Mon Sep 17 00:00:00 2001 From: MahdiBM Date: Tue, 28 Nov 2023 13:42:09 +0330 Subject: [PATCH 3/6] some more import cleanup --- Sources/OpenAPIRuntime/Conversion/Converter.swift | 4 ++-- Sources/OpenAPIRuntime/Errors/ClientError.swift | 2 +- Sources/OpenAPIRuntime/Interface/ClientTransport.swift | 2 +- Sources/OpenAPIRuntime/Interface/UniversalClient.swift | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/OpenAPIRuntime/Conversion/Converter.swift b/Sources/OpenAPIRuntime/Conversion/Converter.swift index 9e3408e9..69223da5 100644 --- a/Sources/OpenAPIRuntime/Conversion/Converter.swift +++ b/Sources/OpenAPIRuntime/Conversion/Converter.swift @@ -12,11 +12,11 @@ // //===----------------------------------------------------------------------===// #if canImport(Darwin) -import Foundation +import class Foundation.JSONEncoder #else @preconcurrency import class Foundation.JSONEncoder -import class Foundation.JSONDecoder #endif +import class Foundation.JSONDecoder /// Converter between generated and HTTP currency types. @_spi(Generated) public struct Converter: Sendable { diff --git a/Sources/OpenAPIRuntime/Errors/ClientError.swift b/Sources/OpenAPIRuntime/Errors/ClientError.swift index ce1c1128..90481bff 100644 --- a/Sources/OpenAPIRuntime/Errors/ClientError.swift +++ b/Sources/OpenAPIRuntime/Errors/ClientError.swift @@ -14,7 +14,7 @@ import HTTPTypes #if canImport(Darwin) -import Foundation +import struct Foundation.URL #else @preconcurrency import struct Foundation.URL #endif diff --git a/Sources/OpenAPIRuntime/Interface/ClientTransport.swift b/Sources/OpenAPIRuntime/Interface/ClientTransport.swift index bd7a5393..3786bcea 100644 --- a/Sources/OpenAPIRuntime/Interface/ClientTransport.swift +++ b/Sources/OpenAPIRuntime/Interface/ClientTransport.swift @@ -14,7 +14,7 @@ import HTTPTypes #if canImport(Darwin) -import Foundation +import struct Foundation.URL #else @preconcurrency import struct Foundation.URL #endif diff --git a/Sources/OpenAPIRuntime/Interface/UniversalClient.swift b/Sources/OpenAPIRuntime/Interface/UniversalClient.swift index 431fb8af..5afff2b1 100644 --- a/Sources/OpenAPIRuntime/Interface/UniversalClient.swift +++ b/Sources/OpenAPIRuntime/Interface/UniversalClient.swift @@ -13,7 +13,7 @@ //===----------------------------------------------------------------------===// import HTTPTypes #if canImport(Darwin) -import Foundation +import struct Foundation.URL #else @preconcurrency import struct Foundation.URL #endif From 037bda30ad3e769d1dc5a9792df0d0c31211f140 Mon Sep 17 00:00:00 2001 From: MahdiBM Date: Tue, 28 Nov 2023 20:41:02 +0330 Subject: [PATCH 4/6] soundness --- Sources/OpenAPIRuntime/Interface/UniversalServer.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Sources/OpenAPIRuntime/Interface/UniversalServer.swift b/Sources/OpenAPIRuntime/Interface/UniversalServer.swift index 04cc7e6d..4608dafe 100644 --- a/Sources/OpenAPIRuntime/Interface/UniversalServer.swift +++ b/Sources/OpenAPIRuntime/Interface/UniversalServer.swift @@ -20,7 +20,6 @@ import struct Foundation.URL #endif import struct Foundation.URLComponents - /// OpenAPI document-agnostic HTTP server used by OpenAPI document-specific, /// generated servers to perform request deserialization, middleware and handler /// invocation, and response serialization. From 734d1efa830beba348d106f01a4fd12951f29961 Mon Sep 17 00:00:00 2001 From: MahdiBM Date: Fri, 1 Dec 2023 11:37:46 +0330 Subject: [PATCH 5/6] try resolve 5.9 warnings --- Sources/OpenAPIRuntime/Conversion/Converter.swift | 4 ++++ Sources/OpenAPIRuntime/Errors/ClientError.swift | 4 ++++ Sources/OpenAPIRuntime/Interface/UniversalServer.swift | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/Sources/OpenAPIRuntime/Conversion/Converter.swift b/Sources/OpenAPIRuntime/Conversion/Converter.swift index 69223da5..ecf5dff1 100644 --- a/Sources/OpenAPIRuntime/Conversion/Converter.swift +++ b/Sources/OpenAPIRuntime/Conversion/Converter.swift @@ -16,7 +16,11 @@ import class Foundation.JSONEncoder #else @preconcurrency import class Foundation.JSONEncoder #endif +#if canImport(Darwin) || swift(>=5.9.1) import class Foundation.JSONDecoder +#else +@preconcurrency import class Foundation.JSONDecoder +#endif /// Converter between generated and HTTP currency types. @_spi(Generated) public struct Converter: Sendable { diff --git a/Sources/OpenAPIRuntime/Errors/ClientError.swift b/Sources/OpenAPIRuntime/Errors/ClientError.swift index 90481bff..8272bd0d 100644 --- a/Sources/OpenAPIRuntime/Errors/ClientError.swift +++ b/Sources/OpenAPIRuntime/Errors/ClientError.swift @@ -18,7 +18,11 @@ import struct Foundation.URL #else @preconcurrency import struct Foundation.URL #endif +#if canImport(Darwin) || swift(>=5.9.1) import protocol Foundation.LocalizedError +#else +@preconcurrency import protocol Foundation.LocalizedError +#endif /// An error thrown by a client performing an OpenAPI operation. /// diff --git a/Sources/OpenAPIRuntime/Interface/UniversalServer.swift b/Sources/OpenAPIRuntime/Interface/UniversalServer.swift index 4608dafe..e91dd4a6 100644 --- a/Sources/OpenAPIRuntime/Interface/UniversalServer.swift +++ b/Sources/OpenAPIRuntime/Interface/UniversalServer.swift @@ -18,7 +18,11 @@ import struct Foundation.URL #else @preconcurrency import struct Foundation.URL #endif +#if canImport(Darwin) || swift(>=5.9.1) import struct Foundation.URLComponents +#else +@preconcurrency import struct Foundation.URLComponents +#endif /// OpenAPI document-agnostic HTTP server used by OpenAPI document-specific, /// generated servers to perform request deserialization, middleware and handler From 635c6f0e903edf37572b1652e5539046a985a4ca Mon Sep 17 00:00:00 2001 From: MahdiBM Date: Fri, 1 Dec 2023 12:20:04 +0330 Subject: [PATCH 6/6] No warnings this time on 5.9.0/5.9.1 --- Sources/OpenAPIRuntime/Conversion/Converter.swift | 4 ---- Sources/OpenAPIRuntime/Errors/ClientError.swift | 4 ---- Sources/OpenAPIRuntime/Interface/ClientTransport.swift | 4 ---- Sources/OpenAPIRuntime/Interface/UniversalServer.swift | 4 ---- .../URICoder/Test_URICodingRoundtrip.swift | 5 +++++ 5 files changed, 5 insertions(+), 16 deletions(-) diff --git a/Sources/OpenAPIRuntime/Conversion/Converter.swift b/Sources/OpenAPIRuntime/Conversion/Converter.swift index ecf5dff1..69223da5 100644 --- a/Sources/OpenAPIRuntime/Conversion/Converter.swift +++ b/Sources/OpenAPIRuntime/Conversion/Converter.swift @@ -16,11 +16,7 @@ import class Foundation.JSONEncoder #else @preconcurrency import class Foundation.JSONEncoder #endif -#if canImport(Darwin) || swift(>=5.9.1) import class Foundation.JSONDecoder -#else -@preconcurrency import class Foundation.JSONDecoder -#endif /// Converter between generated and HTTP currency types. @_spi(Generated) public struct Converter: Sendable { diff --git a/Sources/OpenAPIRuntime/Errors/ClientError.swift b/Sources/OpenAPIRuntime/Errors/ClientError.swift index 8272bd0d..90481bff 100644 --- a/Sources/OpenAPIRuntime/Errors/ClientError.swift +++ b/Sources/OpenAPIRuntime/Errors/ClientError.swift @@ -18,11 +18,7 @@ import struct Foundation.URL #else @preconcurrency import struct Foundation.URL #endif -#if canImport(Darwin) || swift(>=5.9.1) import protocol Foundation.LocalizedError -#else -@preconcurrency import protocol Foundation.LocalizedError -#endif /// An error thrown by a client performing an OpenAPI operation. /// diff --git a/Sources/OpenAPIRuntime/Interface/ClientTransport.swift b/Sources/OpenAPIRuntime/Interface/ClientTransport.swift index 3786bcea..200520ca 100644 --- a/Sources/OpenAPIRuntime/Interface/ClientTransport.swift +++ b/Sources/OpenAPIRuntime/Interface/ClientTransport.swift @@ -13,11 +13,7 @@ //===----------------------------------------------------------------------===// import HTTPTypes -#if canImport(Darwin) import struct Foundation.URL -#else -@preconcurrency import struct Foundation.URL -#endif /// A type that performs HTTP operations. /// diff --git a/Sources/OpenAPIRuntime/Interface/UniversalServer.swift b/Sources/OpenAPIRuntime/Interface/UniversalServer.swift index e91dd4a6..4608dafe 100644 --- a/Sources/OpenAPIRuntime/Interface/UniversalServer.swift +++ b/Sources/OpenAPIRuntime/Interface/UniversalServer.swift @@ -18,11 +18,7 @@ import struct Foundation.URL #else @preconcurrency import struct Foundation.URL #endif -#if canImport(Darwin) || swift(>=5.9.1) import struct Foundation.URLComponents -#else -@preconcurrency import struct Foundation.URLComponents -#endif /// OpenAPI document-agnostic HTTP server used by OpenAPI document-specific, /// generated servers to perform request deserialization, middleware and handler diff --git a/Tests/OpenAPIRuntimeTests/URICoder/Test_URICodingRoundtrip.swift b/Tests/OpenAPIRuntimeTests/URICoder/Test_URICodingRoundtrip.swift index f2eb485a..ccfe52c4 100644 --- a/Tests/OpenAPIRuntimeTests/URICoder/Test_URICodingRoundtrip.swift +++ b/Tests/OpenAPIRuntimeTests/URICoder/Test_URICodingRoundtrip.swift @@ -12,6 +12,11 @@ // //===----------------------------------------------------------------------===// import XCTest +#if canImport(Darwin) || swift(>=5.9.1) +import struct Foundation.Date +#else +@preconcurrency import struct Foundation.Date +#endif @_spi(Generated) @testable import OpenAPIRuntime final class Test_URICodingRoundtrip: Test_Runtime {