From 3afdad98e59162a311cfa628cd77a2bb400cbab3 Mon Sep 17 00:00:00 2001 From: Jay Herron Date: Sat, 28 Feb 2026 13:30:23 -0700 Subject: [PATCH 1/4] docs: Adds docs on how to use with Graphiti --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 5d420a1..4ac73c5 100644 --- a/README.md +++ b/README.md @@ -100,3 +100,17 @@ app.graphql(schema: schema) { inputs in ) } ``` + +### Graphiti + +If using Graphiti to build your GraphQL schema, you must provide an instance of the `Resolver` to the `rootValue` argument. For example: + +```swift +let graphqlSchema: Graphiti.Schema = try graphqlSchema() +app.graphql( + schema: graphqlSchema.schema, + rootValue: Resolver() // This must be included +) { _ in + Context() +} +``` From 8b257a08b90ca9b7b01edc317e56472a5c64b6c8 Mon Sep 17 00:00:00 2001 From: Jay Herron Date: Sat, 28 Feb 2026 13:35:18 -0700 Subject: [PATCH 2/4] docs: Links schema creation packages --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4ac73c5..595377f 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,8 @@ Then add it to your target: ## Usage +To use this package, you must already have a GraphQL schema. You can use [graphql-generator](https://github.com/GraphQLSwift/graphql-generator), [Graphiti](https://github.com/GraphQLSwift/Graphiti), or [GraphQL](https://github.com/GraphQLSwift/GraphQL) to construct one. + ### Basic Example ```swift @@ -43,7 +45,6 @@ import GraphQLVapor import Vapor // Define your GraphQL schema -// To construct schemas, consider using `Graphiti` or `graphql-generator` let schema = try GraphQLSchema( query: GraphQLObjectType( name: "Query", From 50b22884f09573b06008df2884657a4aa1e1d3dc Mon Sep 17 00:00:00 2001 From: Jay Herron Date: Sat, 28 Feb 2026 13:37:09 -0700 Subject: [PATCH 3/4] docs: Links Example --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 595377f..e225e7d 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,8 @@ Then add it to your target: To use this package, you must already have a GraphQL schema. You can use [graphql-generator](https://github.com/GraphQLSwift/graphql-generator), [Graphiti](https://github.com/GraphQLSwift/Graphiti), or [GraphQL](https://github.com/GraphQLSwift/GraphQL) to construct one. +See [the HelloWorld project](https://github.com/GraphQLSwift/graphql-vapor/tree/main/Examples/HelloWorld) for a full working example. + ### Basic Example ```swift From cbc4cb3e1708dd65d3bd95878af55c8e76318020 Mon Sep 17 00:00:00 2001 From: Jay Herron Date: Sat, 28 Feb 2026 13:42:17 -0700 Subject: [PATCH 4/4] docs: Adds websocket documentation --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index e225e7d..ed03fc8 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,18 @@ app.graphql(schema: schema) { inputs in } ``` +### WebSockets + +Subscription support via WebSockets is provided, and can be enabled by in the `subscriptionProtocols` configuration: + +```swift +app.graphql(schema: schema, config: .init(subscriptionProtocols: [.websocket])) { _ in + GraphQLContext() +} +``` + +[`graphql-ws`](https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md) and [`graphql-transport-ws`](https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md) subprotocols are supported. + ### Graphiti If using Graphiti to build your GraphQL schema, you must provide an instance of the `Resolver` to the `rootValue` argument. For example: