diff --git a/README.md b/README.md index ecd362c..5aef871 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,6 @@ [![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FGraphQLSwift%2Fgraphql-hummingbird%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/GraphQLSwift/graphql-hummingbird) [![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FGraphQLSwift%2Fgraphql-hummingbird%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/GraphQLSwift/graphql-hummingbird) -> ***WARNING***: This package is in v0.x beta. It's API is still evolving and is subject to breaking changes in minor version bumps. - A Swift library for integrating [GraphQL](https://github.com/GraphQLSwift/GraphQL) with [Hummingbird](https://github.com/hummingbird-project/hummingbird), enabling you to easily expose GraphQL APIs in your Hummingbird applications. ## Features diff --git a/Sources/GraphQLHummingbird/GraphQLConfig.swift b/Sources/GraphQLHummingbird/GraphQLConfig.swift index 754995f..0489dc6 100644 --- a/Sources/GraphQLHummingbird/GraphQLConfig.swift +++ b/Sources/GraphQLHummingbird/GraphQLConfig.swift @@ -45,12 +45,13 @@ public struct GraphQLConfig< self.websocket = websocket } + /// A collection of encoders and decoders used by the GraphQL system public struct Coders: Sendable { - public let graphQLJSONEncoder: GraphQLJSONEncoder - public let jsonDecoder: JSONDecoder - public let jsonEncoder: JSONEncoder - public let urlEncodedFormDecoder: URLEncodedFormDecoder - public let urlEncodedFormEncoder: URLEncodedFormEncoder + let graphQLJSONEncoder: GraphQLJSONEncoder + let jsonDecoder: JSONDecoder + let jsonEncoder: JSONEncoder + let urlEncodedFormDecoder: URLEncodedFormDecoder + let urlEncodedFormEncoder: URLEncodedFormEncoder public init( graphQLJSONEncoder: GraphQLJSONEncoder? = nil, @@ -67,6 +68,7 @@ public struct GraphQLConfig< } } + /// An embeddable GraphQL IDE public struct IDE: Sendable, Equatable { /// GraphiQL: https://github.com/graphql/graphiql public static var graphiql: Self { @@ -85,6 +87,7 @@ public struct GraphQLConfig< } } + /// A GraphQL subscription implementation public struct SubscriptionProtocol: Sendable, Hashable { /// Expose GraphQL subscriptions over WebSockets public static var websocket: Self { @@ -97,6 +100,7 @@ public struct GraphQLConfig< } } + /// WebSocket configuration public struct WebSocket: Sendable { let onWebSocketInit: @Sendable (WebSocketInit, Request, Context) async throws -> WebSocketInitResult diff --git a/Sources/GraphQLHummingbird/WebSocket/GraphQLHandler+handleWebSocket.swift b/Sources/GraphQLHummingbird/WebSocket/GraphQLHandler+handleWebSocket.swift index af4b307..4e53f50 100644 --- a/Sources/GraphQLHummingbird/WebSocket/GraphQLHandler+handleWebSocket.swift +++ b/Sources/GraphQLHummingbird/WebSocket/GraphQLHandler+handleWebSocket.swift @@ -16,8 +16,7 @@ extension GraphQLHandler where Context: WebSocketRequestContext { ) async throws { let messenger = WebSocketMessenger(outbound: outbound, logger: logger) - // TODO: Make maxSize configurable - let messageStream = inbound.messages(maxSize: 1024 * 1024).compactMap { message -> String? in + let messageStream = inbound.messages(maxSize: context.requestContext.maxUploadSize).compactMap { message -> String? in // TODO: Add binary support guard case let .text(text) = message else { return nil