-
-
Notifications
You must be signed in to change notification settings - Fork 543
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
feat: Initial relay implementation #2511
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #2511 +/- ##
==========================================
+ Coverage 96.34% 96.51% +0.16%
==========================================
Files 197 203 +6
Lines 8328 8774 +446
Branches 1525 1610 +85
==========================================
+ Hits 8024 8468 +444
- Misses 191 194 +3
+ Partials 113 112 -1 |
Thanks for adding the Here's a preview of the changelog: Initial relay spec implementation. For information on how to use Here's the preview release card for twitter: Here's the tweet text:
|
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.
This is a massive PR, but I hope we can get through this as it looks really well worked through. 🚀
And it will be easier to circle back and fix any remaining rough edges after we've got some experience using it.
_R = TypeVar("_R") | ||
connection_typename = "arrayconnection" | ||
|
||
NodeType = TypeVar("NodeType", bound="Node") |
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.
This looks like a class name to me, and reading the docs example for custom connections had me really confused (wrgt how it was implemented, not how to use it).
I'm not sure how to improve this really, though. Perhaps TNode
does a better job at hinting that this is a generic type var?
however, looking at some more places this is used, I think NodeType
works really well, so perhaps the doc mentioned is the only confusing part.. I'll ponder on this a bit more.
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.
I'm open to change it to TNode
or anything else that makes more sense. I have to admit that I'm not good at naming things (strawberry-django-plus
is a good example of that hahaha)
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.
Naming stuff is among the top 3 most difficult programming jobs! :P
I think I landed in being in favour of keeping it as NodeType
, left the comment regardless to be transparent about my review process.
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.
Nice!
Just added a doc section for the input mutation and some tests for it. I think the PR is basically done, not considering any suggestions/improvements that might arrive from code reviews, of course :) |
… in utils/inspect.py module
Note: I separated the specialized generic support to another PR (#2517). As soon as it gets merged I'll rebase this PR to make the changes here be only about relay itself |
…ier to override them in subclasses
…ith field extensions
…n using relay.node and relay.connection
docs/guides/pagination/overview.md
Outdated
[relay spec](https://relay.dev/docs/guides/graphql-server-specification/). | ||
You can read more about it in the [relay](./input-types) page. | ||
|
||
<Note/> |
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.
<Note/> | |
</Note> |
/pre-release |
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.
👀
Thanks @bellini666 !!! |
amazing!! |
Great job! Thanks you @bellini666 and whole reviewers :) |
Thank you for relay implementation. But schema like
is not compatible with schema that produces Graphene when using federation
So that combining Strawberry subgraph with Graphene subgraph is not possible. I think using |
@lostclus can you open an issue for this? we were discussing some ideas around it on discord, but I think it is worth tracking it here on GitHub too :) |
This is my relay implementation from strawberry-django-plus, which I mentioned in this issue
There are some things that might need some discussion:
GlobalID
as the name of the scalar to avoid conflicts with the existingID
. Although it doesn't cause issues for the majority of people, there are some cases where the client expects the scalar to be namedID
. It can be worked around by overriding theID
scalar to use theGlobalID
, but maybe there's a better way? Note that theGlobalID
object is a dataclass with some custom attributes and methods.id
, which is the non global version one, while still keeping ourNode.id
resolver working. You will notice in my tests that I defined theFruit
id as_id
for that reason. Maybe use a metaclass approach to solve this?TODO (already done):
input_mutation
input_mutation
Fix #1573