Skip to content

Commit 58554e2

Browse files
Update integration test to 0.3.0 APIs and temporarily use main (#310)
### Motivation The integration test has been unable to run because its Package.swift was updated to depend on 0.3.0 of this project, which has yet to be tagged. This means we've been having to merge over broken CI. However, there's nothing stopping us updating it to use the new APIs and getting it running in the meantime. ### Modifications - Update the integration test to use the new APIs (new Swift HTTP types). - Temporarily depend on main for swift-openapi-generator (until we tag). ### Result Integration test pipeline is working again. ### Test Plan Should pass in CI.
1 parent 22830f2 commit 58554e2

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

IntegrationTest/Package.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ let package = Package(
3232
)
3333
],
3434
dependencies: [
35-
.package(url: "https://github.com/apple/swift-openapi-generator", .upToNextMinor(from: "0.3.0")),
35+
// TODO: When swift-openapi-generator is tagged with 0.3.0, stop depending on main.
36+
// .package(url: "https://github.com/apple/swift-openapi-generator", .upToNextMinor(from: "0.3.0"),
37+
.package(url: "https://github.com/apple/swift-openapi-generator", branch: "main"),
3638
.package(url: "https://github.com/apple/swift-openapi-runtime", .upToNextMinor(from: "0.3.0")),
3739
],
3840
targets: [

IntegrationTest/Sources/MockTransportClient/Client.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ import Types
1515
import Client
1616
import OpenAPIRuntime
1717
import Foundation
18+
import HTTPTypes
1819

1920
struct MockClientTransport: ClientTransport {
2021
func send(
21-
_ request: Request,
22+
_ request: HTTPTypes.HTTPRequest,
23+
body: OpenAPIRuntime.HTTPBody?,
2224
baseURL: URL,
2325
operationID: String
24-
) async throws -> Response {
25-
.init(statusCode: 200)
26+
) async throws -> (HTTPTypes.HTTPResponse, OpenAPIRuntime.HTTPBody?) {
27+
(HTTPTypes.HTTPResponse(status: 200), nil)
2628
}
2729
}
2830

IntegrationTest/Sources/MockTransportServer/Server.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import Types
1515
import Server
1616
import OpenAPIRuntime
17+
import HTTPTypes
1718

1819
actor SimpleAPIImpl: APIProtocol {
1920
func getGreeting(
@@ -25,14 +26,14 @@ actor SimpleAPIImpl: APIProtocol {
2526
}
2627

2728
class MockServerTransport: ServerTransport {
28-
29-
typealias Handler = @Sendable (Request, ServerRequestMetadata) async throws -> Response
29+
typealias Handler = @Sendable (
30+
HTTPTypes.HTTPRequest, OpenAPIRuntime.HTTPBody?, OpenAPIRuntime.ServerRequestMetadata
31+
) async throws -> (HTTPTypes.HTTPResponse, OpenAPIRuntime.HTTPBody?)
3032

3133
func register(
3234
_ handler: @escaping Handler,
33-
method: HTTPMethod,
34-
path: [RouterPathComponent],
35-
queryItemNames: Set<String>
35+
method: HTTPTypes.HTTPRequest.Method,
36+
path: String
3637
) throws {
3738
// noop.
3839
}

0 commit comments

Comments
 (0)