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
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 9 additions & 5 deletions Sources/GraphQLHummingbird/GraphQLConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -97,6 +100,7 @@ public struct GraphQLConfig<
}
}

/// WebSocket configuration
public struct WebSocket: Sendable {
let onWebSocketInit: @Sendable (WebSocketInit, Request, Context) async throws -> WebSocketInitResult

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down