Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public struct ErrorHandlingMiddleware: ServerMiddleware {
body: OpenAPIRuntime.HTTPBody?,
metadata: OpenAPIRuntime.ServerRequestMetadata,
operationID: String,
next: @Sendable (HTTPTypes.HTTPRequest, OpenAPIRuntime.HTTPBody?, OpenAPIRuntime.ServerRequestMetadata)
next:
@Sendable (HTTPTypes.HTTPRequest, OpenAPIRuntime.HTTPBody?, OpenAPIRuntime.ServerRequestMetadata)
async throws -> (HTTPTypes.HTTPResponse, OpenAPIRuntime.HTTPBody?)
) async throws -> (HTTPTypes.HTTPResponse, OpenAPIRuntime.HTTPBody?) {
do { return try await next(request, body, metadata) } catch {
Expand Down
7 changes: 4 additions & 3 deletions Sources/OpenAPIRuntime/Interface/ServerTransport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,10 @@ public protocol ServerTransport {
/// - Important: The `path` can have mixed components, such
/// as `/file/{name}.zip`.
func register(
_ handler: @Sendable @escaping (HTTPRequest, HTTPBody?, ServerRequestMetadata) async throws -> (
HTTPResponse, HTTPBody?
),
_ handler:
@Sendable @escaping (HTTPRequest, HTTPBody?, ServerRequestMetadata) async throws -> (
HTTPResponse, HTTPBody?
),
method: HTTPRequest.Method,
path: String
) throws
Expand Down
4 changes: 2 additions & 2 deletions Sources/OpenAPIRuntime/Interface/UniversalServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ import struct Foundation.URLComponents
metadata: ServerRequestMetadata,
forOperation operationID: String,
using handlerMethod: @Sendable @escaping (APIHandler) -> ((OperationInput) async throws -> OperationOutput),
deserializer: @Sendable @escaping (HTTPRequest, HTTPBody?, ServerRequestMetadata) async throws ->
OperationInput,
deserializer:
@Sendable @escaping (HTTPRequest, HTTPBody?, ServerRequestMetadata) async throws -> OperationInput,
serializer: @Sendable @escaping (OperationOutput, HTTPRequest) throws -> (HTTPResponse, HTTPBody?)
) async throws -> (HTTPResponse, HTTPBody?) where OperationInput: Sendable, OperationOutput: Sendable {
@Sendable func wrappingErrors<R>(work: () async throws -> R, mapError: (any Error) -> any Error) async throws
Expand Down
4 changes: 2 additions & 2 deletions Tests/OpenAPIRuntimeTests/Base/Test_OpenAPIValue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ struct MyAnyOf2<Value1: Codable & Hashable & Sendable, Value2: Codable & Hashabl
self.value1 = value1
self.value2 = value2
}
public init(from decoder: any Decoder) throws {
init(from decoder: any Decoder) throws {
var errors: [any Error] = []
do { self.value1 = try .init(from: decoder) } catch { errors.append(error) }
do { self.value2 = try .init(from: decoder) } catch { errors.append(error) }
Expand All @@ -465,7 +465,7 @@ struct MyAnyOf2<Value1: Codable & Hashable & Sendable, Value2: Codable & Hashabl
errors: errors
)
}
public func encode(to encoder: any Encoder) throws {
func encode(to encoder: any Encoder) throws {
try self.value1?.encode(to: encoder)
try self.value2?.encode(to: encoder)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ final class Test_ErrorHandlingMiddlewareTests: XCTestCase {
XCTAssertEqual(responseBody, nil)
}

private func getNextMiddleware(failurePhase: MockErrorMiddleware_Next.FailurePhase) -> @Sendable (
HTTPTypes.HTTPRequest, OpenAPIRuntime.HTTPBody?, OpenAPIRuntime.ServerRequestMetadata
) async throws -> (HTTPTypes.HTTPResponse, OpenAPIRuntime.HTTPBody?) {
private func getNextMiddleware(failurePhase: MockErrorMiddleware_Next.FailurePhase)
-> @Sendable (HTTPTypes.HTTPRequest, OpenAPIRuntime.HTTPBody?, OpenAPIRuntime.ServerRequestMetadata)
async throws -> (HTTPTypes.HTTPResponse, OpenAPIRuntime.HTTPBody?)
{
let mockNext:
@Sendable (HTTPTypes.HTTPRequest, OpenAPIRuntime.HTTPBody?, OpenAPIRuntime.ServerRequestMetadata)
async throws -> (HTTPTypes.HTTPResponse, OpenAPIRuntime.HTTPBody?) = { request, body, metadata in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -524,11 +524,6 @@ final class Test_URIParser: Test_Runtime {
}
var result: ExpectedResult

init(string: String, result: ExpectedResult) {
self.string = string
self.result = result
}

static func assert(_ string: String, equals value: RootType) -> Self {
.init(string: string, result: .success(value))
}
Expand Down
Loading