-
-
Notifications
You must be signed in to change notification settings - Fork 544
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
Add Litestar integration #3213
Add Litestar integration #3213
Conversation
Thanks for adding the Here's a preview of the changelog: This release adds support for litestar. import strawberry
from litestar import Request, Litestar
from strawberry.litestar import make_graphql_controller
from strawberry.types.info import Info
def custom_context_getter(request: Request):
return {"custom": "context"}
@strawberry.type
class Query:
@strawberry.field
def hello(self, info: Info[object, None]) -> str:
return info.context["custom"]
schema = strawberry.Schema(Query)
GraphQLController = make_graphql_controller(
schema,
path="/graphql",
context_getter=custom_context_getter,
)
app = Litestar(
route_handlers=[GraphQLController],
) Here's the tweet text:
|
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3213 +/- ##
==========================================
- Coverage 96.58% 96.40% -0.18%
==========================================
Files 486 498 +12
Lines 30334 31107 +773
Branches 3751 3811 +60
==========================================
+ Hits 29298 29989 +691
- Misses 838 912 +74
- Partials 198 206 +8 |
CodSpeed Performance ReportMerging #3213 will not alter performanceComparing Summary
|
Documentation is missing, and the one for Starlite does not show up in the index btw |
Documentation added, should ready for review |
is there anything we can do to help out getting this in? |
@gazorby thank you for this and sorry for the delay, I'll review and merge soon 😊 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! I think we'll have to deprecate starlite, but we can do that in another PR 😊
Add support for Litestar.
Description
This adds a new integration and does not replace the Starlite one. It adds a bunch of duplicated code but allows a smoother transition from Starlite to Litestar.
We may decide to keep both for some time and consider dropping Starlite later on.
Usage is pretty much identical as for Starlite :
Types of Changes
Issues Fixed or Closed by This PR
starlite
docs #3081starlite
to the doc navigation list #3082Checklist