Skip to content

Commit 7b84cdf

Browse files
authored
documentation updates. (#154)
1 parent 620271f commit 7b84cdf

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ GraphQL stitching composes a single schema from multiple underlying GraphQL reso
55
![Stitched graph](./docs/images/stitching.png)
66

77
**Supports:**
8-
- All operation types: query, mutation, and subscription.
8+
- All operation types: query, mutation, and [subscription](./docs/subscriptions.md).
99
- Merged object and abstract types.
1010
- Shared objects, fields, enums, and inputs across locations.
1111
- Multiple and composite type keys.

docs/subscriptions.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class EntitiesSchema < GraphQL::Schema
8888
end
8989
```
9090

91-
These schemas can be composed as normal into a stitching client. The subscriptions schema must be locally-executable while other entity schema(s) may be served from anywhere:
91+
These schemas can be composed as normal into a stitching client. The subscriptions schema must be locally-executable while the other entity schema(s) may be served from anywhere:
9292

9393
```ruby
9494
StitchedSchema = GraphQL::Stitching::Client.new(locations: {
@@ -104,7 +104,7 @@ StitchedSchema = GraphQL::Stitching::Client.new(locations: {
104104

105105
### Serving stitched subscriptions
106106

107-
Once you've stitched a schema with subscriptions, it gets called as part of three workflows:
107+
Once you've composed a schema with subscriptions, it gets called as part of three workflows:
108108

109109
1. Controller - handles normal query and mutation requests recieved via HTTP.
110110
2. Channel - handles subscription-create requests recieved through a socket connection.
@@ -172,7 +172,7 @@ class GraphqlChannel < ApplicationCable::Channel
172172
end
173173
```
174174

175-
What happens behind the scenes here is that stitching filters the `execute` request down to just subscription selections, and passes those through to the subscriptions subschema where they register an event binding. The subscriber response gets stitched while passing back up through the stitching client.
175+
What happens behind the scenes here is that stitching filters the `execute` request down to just subscription selections, and passes those through to the subscriptions subschema where they register an event binding. The subscriber response gets stitched while passing back out through the stitching client.
176176

177177
#### Plugin
178178

@@ -181,9 +181,9 @@ Lastly, update events trigger with the filtered subscriptions selection, so must
181181
```ruby
182182
class StitchedActionCableSubscriptions < GraphQL::Subscriptions::ActionCableSubscriptions
183183
def execute_update(subscription_id, event, object)
184-
super(subscription_id, event, object).tap do |result|
185-
result.context[:stitch_subscription_update]&.call(result)
186-
end
184+
result = super(subscription_id, event, object)
185+
result.context[:stitch_subscription_update]&.call(result)
186+
result
187187
end
188188
end
189189

examples/subscriptions/app/graphql/subscriptions_schema.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
class SubscriptionsSchema < GraphQL::Schema
22
class StitchedActionCableSubscriptions < GraphQL::Subscriptions::ActionCableSubscriptions
33
def execute_update(subscription_id, event, object)
4-
super(subscription_id, event, object).tap do |result|
5-
result.context[:stitch_subscription_update]&.call(result)
6-
end
4+
result = super(subscription_id, event, object)
5+
result.context[:stitch_subscription_update]&.call(result)
6+
result
77
end
88
end
99

0 commit comments

Comments
 (0)