Skip to content

Commit f37842a

Browse files
authored
Inconsistency in documentation brought up by docc v6 (#80)
1 parent fba2bb2 commit f37842a

File tree

7 files changed

+26
-19
lines changed

7 files changed

+26
-19
lines changed

Sources/HummingbirdWSClient/Exports.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
@_exported import HummingbirdWSCore
15+
@_exported @_documentation(visibility: internal) import HummingbirdWSCore

Sources/HummingbirdWSClient/WebSocketClient.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import NIOWebSocket
4040
/// }
4141
/// ```
4242
public struct WebSocketClient {
43-
/// Basic context implementation of ``WebSocketContext``.
43+
/// Basic context implementation of ``/HummingbirdWSCore/WebSocketContext``.
4444
/// Used by non-router web socket handle function
4545
public struct Context: WebSocketContext {
4646
public let logger: Logger

Sources/HummingbirdWSCore/WebSocketExtension.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ public struct WebSocketExtensionHTTPParameters: Sendable, Equatable {
157157
/// Parse all `Sec-WebSocket-Extensions` header values
158158
/// - Parameters:
159159
/// - headers: headers coming from other
160-
/// - type: client or server
161160
/// - Returns: Array of extensions
162161
public static func parseHeaders(_ headers: HTTPFields) -> [WebSocketExtensionHTTPParameters] {
163162
let extHeaders = headers[values: .secWebSocketExtensions]

Sources/HummingbirdWSCore/WebSocketInboundMessageStream.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ extension WebSocketInboundStream {
4343
/// converts the inbound stream of WebSocket data frames into a sequence of WebSocket
4444
/// messages.
4545
///
46-
/// - Parameter maxMessageSize: The maximum size of message we are allowed to create
46+
/// - Parameter maxSize: The maximum size of message we are allowed to read
4747
public func messages(maxSize: Int) -> WebSocketInboundMessageStream {
4848
.init(inboundStream: self, maxSize: maxSize)
4949
}

Sources/HummingbirdWebSocket/Exports.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
@_exported import HummingbirdWSCore
15+
@_exported @_documentation(visibility: internal) import HummingbirdWSCore

Sources/HummingbirdWebSocket/WebSocketChannel.swift

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public struct HTTP1WebSocketUpgradeChannel: ServerChildChannel, HTTPChannelHandl
3939
public let channel: Channel
4040
}
4141

42-
/// Basic context implementation of ``WebSocketContext``.
42+
/// Basic context implementation of ``/HummingbirdWSCore/WebSocketContext``.
4343
/// Used by non-router web socket handle function
4444
public struct Context: WebSocketContext {
4545
public let logger: Logger
@@ -51,11 +51,10 @@ public struct HTTP1WebSocketUpgradeChannel: ServerChildChannel, HTTPChannelHandl
5151

5252
/// Initialize HTTP1AndWebSocketChannel with synchronous `shouldUpgrade` function
5353
/// - Parameters:
54-
/// - additionalChannelHandlers: Additional channel handlers to add
5554
/// - responder: HTTP responder
56-
/// - maxFrameSize: Max frame size WebSocket will allow
55+
/// - configuration: WebSocket configuration
56+
/// - additionalChannelHandlers: Additional channel handlers to add
5757
/// - shouldUpgrade: Function returning whether upgrade should be allowed
58-
/// - Returns: Upgrade result future
5958
public init(
6059
responder: @escaping HTTPChannelHandler.Responder,
6160
configuration: WebSocketServerConfiguration,
@@ -97,13 +96,23 @@ public struct HTTP1WebSocketUpgradeChannel: ServerChildChannel, HTTPChannelHandl
9796
self.responder = responder
9897
}
9998

99+
@available(*, deprecated, renamed: "init(responder:configuration:additionalChannelHandlers:shouldUpgrade:)")
100+
@_documentation(visibility: internal)
101+
public init(
102+
responder: @escaping HTTPChannelHandler.Responder,
103+
additionalChannelHandlers: @escaping @Sendable () -> [any RemovableChannelHandler] = { [] },
104+
configuration: WebSocketServerConfiguration,
105+
shouldUpgrade: @escaping @Sendable (HTTPRequest, Channel, Logger) async throws -> ShouldUpgradeResult<WebSocketDataHandler<Context>>
106+
) {
107+
self.init(responder: responder, configuration: configuration, additionalChannelHandlers: additionalChannelHandlers, shouldUpgrade: shouldUpgrade)
108+
}
109+
100110
/// Initialize HTTP1AndWebSocketChannel with async `shouldUpgrade` function
101111
/// - Parameters:
102-
/// - additionalChannelHandlers: Additional channel handlers to add
103112
/// - responder: HTTP responder
104-
/// - maxFrameSize: Max frame size WebSocket will allow
113+
/// - additionalChannelHandlers: Additional channel handlers to add
114+
/// - configuration: WebSocket configuration
105115
/// - shouldUpgrade: Function returning whether upgrade should be allowed
106-
/// - Returns: Upgrade result future
107116
public init(
108117
responder: @escaping HTTPChannelHandler.Responder,
109118
configuration: WebSocketServerConfiguration,

Sources/HummingbirdWebSocket/WebSocketRouter.swift

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ extension RouterMethods {
8585
/// - Parameters:
8686
/// - path: Path to match
8787
/// - shouldUpgrade: Should request be upgraded
88-
/// - handler: WebSocket channel handler
88+
/// - handler: WebSocket channel handler function
8989
@discardableResult public func ws(
9090
_ path: RouterPath = "",
9191
shouldUpgrade: @Sendable @escaping (Request, Context) async throws -> RouterShouldUpgrade = { _, _ in .upgrade([:]) },
@@ -115,7 +115,7 @@ public struct WebSocketUpgradeMiddleware<Context: WebSocketRequestContext>: Rout
115115
/// Initialize WebSocketUpgradeMiddleare
116116
/// - Parameters:
117117
/// - shouldUpgrade: Return whether the WebSocket upgrade should occur
118-
/// - handle: WebSocket handler
118+
/// - handler: WebSocket handler function
119119
public init(
120120
shouldUpgrade: @Sendable @escaping (Request, Context) async throws -> RouterShouldUpgrade = { _, _ in .upgrade([:]) },
121121
onUpgrade handler: @escaping WebSocketDataHandler<WebSocketRouterContext<Context>>
@@ -140,11 +140,10 @@ public struct WebSocketUpgradeMiddleware<Context: WebSocketRequestContext>: Rout
140140
extension HTTP1WebSocketUpgradeChannel {
141141
/// Initialize HTTP1WebSocketUpgradeChannel with async `shouldUpgrade` function
142142
/// - Parameters:
143-
/// - additionalChannelHandlers: Additional channel handlers to add
144143
/// - responder: HTTP responder
145-
/// - maxFrameSize: Max frame size WebSocket will allow
146-
/// - webSocketRouter: WebSocket router
147-
/// - Returns: Upgrade result future
144+
/// - webSocketResponder: WebSocket initial request responder
145+
/// - configuration: WebSocket configuration
146+
/// - additionalChannelHandlers: Additional channel handlers to add
148147
public init<WSResponder: HTTPResponder>(
149148
responder: @escaping HTTPChannelHandler.Responder,
150149
webSocketResponder: WSResponder,
@@ -207,7 +206,7 @@ extension HTTPServerBuilder {
207206
/// - webSocketRouter: Router used for testing whether a WebSocket upgrade should occur
208207
/// - configuration: WebSocket server configuration
209208
/// - additionalChannelHandlers: Additional channel handlers to add to channel pipeline
210-
/// - Returns:
209+
/// - Returns: HTTP server builder that builds an HTTP1 with WebSocket upgrade server
211210
public static func http1WebSocketUpgrade<WSResponderBuilder: HTTPResponderBuilder>(
212211
webSocketRouter: WSResponderBuilder,
213212
configuration: WebSocketServerConfiguration = .init(),

0 commit comments

Comments
 (0)