-
-
Notifications
You must be signed in to change notification settings - Fork 535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support schema extensions for subsctriptions - Alternative #2825
Support schema extensions for subsctriptions - Alternative #2825
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2825 +/- ##
========================================
Coverage 96.55% 96.55%
========================================
Files 468 468
Lines 29201 29417 +216
Branches 3592 3616 +24
========================================
+ Hits 28194 28403 +209
- Misses 827 831 +4
- Partials 180 183 +3 |
39b9aa8
to
eb8c340
Compare
Thanks for adding the Here's a preview of the changelog: Subscriptions now support Schema Extensions. Here's the preview release card for twitter: Here's the tweet text:
|
eb8c340
to
7bbee00
Compare
e7b17a7
to
143cf7d
Compare
143cf7d
to
cb3949a
Compare
CodSpeed Performance ReportMerging #2825 will degrade performances by 79.84%Comparing Summary
Benchmarks breakdown
|
/pre-release |
Pre-release👋 Releasing commit [cb3949a] to PyPi as pre-release! 📦 |
Pre-release👋 Pre-release 0.196.0.dev.1689676980 [cb3949a] has been released on PyPi! 🚀 poetry add strawberry-graphql==0.196.0.dev.1689676980 |
Update graphql_ws handler fix tests now that field verification is done by Strawberry Return "extensions" as part of ExecutionResult if present. Add some error/validation test cases Add release.md Fix tests, remove extra "extensions" payload we don't want to inspect Add extensive tests for extension hook execution while running subscriptions update docs for `resolve` extension hook
cb3949a
to
14a83ba
Compare
Performance regression is expected when all of the schema extension boilerplate code is added on top of a trivial method. |
Subscriptions are now executed like queries and mutations, and extension hooks are called.
Result extension hooks are called for each result yielded by the subscription
Note, This is a separate PR from #2784, because it contains an alternative, less intrusive, way to do this.
It avoids changing the signature of
schema.subscribe
which now, likegraphql-core
, continues to return eitheran
ExcecutionResult
or anAsyncGenerator
.Description
the
Schema.subscribe()
, when awaited returns aUnion[ExeuctionResult, AsyncGenerator[ExecutionResult,None]]
.This is similar to before, but previously it would return a raw
GraphQLExecutionResult
object, or anAsyncIterator
over said type, directly fromgraphql-core
.Internally, an
AsyncGenerator
is created which yields an extra initial result, which is either aExecutionResult
in casethe inner subscribe method failed and no iterator is forthcoming, or a
None
if subscription is about to proceed. Anouter method examines this initially yielded value and either returns that to the caller, or the already started
AsyncGenerator
, which the caller then continues to iterate from, maintaining all context which that iterator had already established.Tests are added to tests for result extensions.
Types of Changes
Issues Fixed or Closed by This PR
Checklist