Skip to content

Commit 001c4e9

Browse files
authored
Full compatibility with the "ExistentialAny" upcoming feature (#9)
Discussed and requested in apple/swift-openapi-generator#99 (comment)
1 parent 12cece2 commit 001c4e9

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

Package.swift

+11-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
import Foundation
1616
import PackageDescription
1717

18+
// General Swift-settings for all targets.
19+
let swiftSettings: [SwiftSetting] = [
20+
// https://github.com/apple/swift-evolution/blob/main/proposals/0335-existential-any.md
21+
// Require `any` for existential types.
22+
.enableUpcomingFeature("ExistentialAny")
23+
]
24+
1825
let package = Package(
1926
name: "swift-openapi-urlsession",
2027
platforms: [
@@ -35,11 +42,13 @@ let package = Package(
3542
name: "OpenAPIURLSession",
3643
dependencies: [
3744
.product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),
38-
]
45+
],
46+
swiftSettings: swiftSettings
3947
),
4048
.testTarget(
4149
name: "OpenAPIURLSessionTests",
42-
dependencies: ["OpenAPIURLSession"]
50+
dependencies: ["OpenAPIURLSession"],
51+
swiftSettings: swiftSettings
4352
),
4453
]
4554
)

Tests/OpenAPIURLSessionTests/URLSessionTransportTests.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class URLSessionTransportTests: XCTestCase {
5959
body: Data("👋".utf8)
6060
)
6161
)
62-
let transport: ClientTransport = URLSessionTransport(
62+
let transport: any ClientTransport = URLSessionTransport(
6363
configuration: .init(session: MockURLProtocol.mockURLSession)
6464
)
6565
let request = OpenAPIRuntime.Request(
@@ -81,7 +81,7 @@ class URLSessionTransportTests: XCTestCase {
8181
}
8282

8383
class MockURLProtocol: URLProtocol {
84-
static var mockHTTPResponses: [URL: Result<(response: HTTPURLResponse, body: Data?), Error>] = [:]
84+
static var mockHTTPResponses: [URL: Result<(response: HTTPURLResponse, body: Data?), any Error>] = [:]
8585

8686
static var recordedHTTPRequests: [URLRequest] = []
8787

0 commit comments

Comments
 (0)