-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
9856 Replace graphene with Strawberry #15141
Conversation
Remaining work:
|
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.
Excellent work! Noticed a few minor cleanup items on initial review and had some general questions.
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.
The GraphiQL view isn't using our custom template, and static resources are being pulled from unpkg.com rather than being served locally.
Also, it looks like maybe we should swap django-graphiql-debug-toolbar
for django-graphiql-strawberry-debug-toolbar
, although AFAICT the current middleware seems functional.
Fixed up the GraphiQL view, the old method of bundling the assets wouldn't work as the new GraphiQL has some include packages that ESBuild can't translate to ES6, see: (graphql/graphiql#2525) - we could switch to webpack which does handle it, but as it is just for GraphiQL it seemed fine to just statically link the separate files. Changed the ESBuild script to copy the files out of the node-packages. django-graphical-debug-toolbar is no longer needed, so removed that. The strawberry one is handled by middleware already. |
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.
Almost there!
Fixes: #9856
Replaces django-graphene with strawberry-django a new engine for handling GraphQL queries. Notable changes:
Example Queries:
and
Filtering lookups are different between the two libraries:
Graphene
Strawberry
The filtering lookup syntax (greater than, less than, case-insensitive compare) is also different:
Graphene
Strawberry
For stawberry, allowing lookups on fields forces the lookup to be present, so it forces this somewhat awkward syntax:
Graphene
Strawberry
Performance optimizer
Below is a ridiculous nested query that can be used to show optimization
old graphene: 55 queries
strawberry: 24 queries