Announcement: Ariadne-Relay package available #495
Replies: 7 comments 18 replies
-
Make sure you'll share the word on spectrum for more coverage: https://spectrum.chat/ariadne |
Beta Was this translation helpful? Give feedback.
-
Don't have a horse in this race. My experience with relay was through Graphene and examples in "Learning GraphQL" book that was giveaway on GraphQL Summit, but I've never used Relay on client side myself, and I wasn't biggest fan of conventions enforced by Graphene. Perhaps once you have the repo up I'll be able to be more of help. :) |
Beta Was this translation helpful? Give feedback.
-
Thanks @rafalp. Once I get an first-draft implementation that I'm happy with I'll publish it on spectrum for comment. Do you mind if I leave this thread open for a week or so in case there are other reactions? |
Beta Was this translation helpful? Give feedback.
-
I dug in a little bit to this today. I don't think the idea I had to provide a ConnectionType will work, because the connection has to be constructed by the parent field. So, update to the proposal:
There are two slightly tricky design challenges with this:
I'm leaning towards using a Short story, it seems like this project can work, but it's a bit involved. |
Beta Was this translation helpful? Give feedback.
-
@markedwards Did you ever finish the draft implementation? |
Beta Was this translation helpful? Give feedback.
-
I have a codebase now which seems to be fairly stable and achieves my goals. It implements support for connections and Node types, and I’ve tried to make it feel like a first-class part of Ariadne. I don’t have anything for mutations because it’s not clear to me what is needed there, if anything. I plan to post an |
Beta Was this translation helpful? Give feedback.
-
Ariadne-Relay is now available: https://github.com/g18e/ariadne-relay pip install ariadne-relay It will stay pre-release until test coverage is complete, and ideally until I get some adoption and feedback. Let me know if you have a chance to take a look! Do you think it makes sense to post an announcement separate from this thread? Or maybe change the title of this thread? |
Beta Was this translation helpful? Give feedback.
-
Update (2021-05-25):
Ariadne-Relay is now available: https://github.com/g18e/ariadne-relay
pip install ariadne-relay
Ariadne-Relay provides a toolset for implementing GraphQL servers in Python that conform to the Relay specification. Its built on top of Ariadne, and aims to make implementing Relay feel just like the rest of Ariadne.
It will stay pre-release until test coverage is complete, and ideally until it gets some adoption and feedback. Please post in Ariadne-Relay issues and discussions if you have any feedback.
@rafalp and @patrys, I dropped a comment on #188 a couple of weeks ago, but I think it might have gone under the radar since that issue is closed, so I'm going to make a more formal proposal here.
I've already built a quick-and-dirty implementation for Relay connections, based on a decorator that wraps an ObjectType resolver that emits a Sequence. The implementation resolves the connection using graphql-relay-py. It works well, but its too specific to my case to be offered as a generalized implementation.
I agree with the assessment in #188 that the right path forward here is for there to be an independent ariadne-relay package. It seems reasonable to build it on top of graphql-relay-py so it is synchronised closely to the reference Relay codebase. I'm willing to take ownership of this project, but I want to introduce the approach I have in mind here for comment, prior to doing further work.
Proposed implementation:
ariadne-relay will provide aConnectionType
class, as a subclass ofariadne.ObjectType
, which takes care of the boilerplate glue between an iterable/sliceable object returned by another resolver and graphql-relay-py. This class will have aset_count_resolver()
method and acount_resolver
decorator to allow for control over how the count is derived.NodeType
class, as a subclass ofAriadne.InterfaceType
, which will help with the formation ofID
values, leveraging the methods in graphql-relay-py. This class will have aset_id_value_resolver()
method and aid_value_resolver
decorator to allow for control over how ids are derived.graphql_relay.mutation
so I'm not sure how that might be leveraged, but at a glance it seems like it should be possible to do something useful here.Does this seems like a reasonable basic direction? It seems from #188 that you guys have put a bit of consideration into this already, so perhaps you have some insight that I'm missing?
Beta Was this translation helpful? Give feedback.
All reactions