-
Notifications
You must be signed in to change notification settings - Fork 139
Rejoiner - Relay support thoughts #102
Comments
Overall Relay support is not in a good state. The main functionality I wanted to add was to be able to easily annotate Proto message which would do two things. 1) Tell Rejoiner which field to use when populating a value for the ID. 2) Annotate methods with the RelayNode annotation so that Rejoiner can fetch data.
|
There is something that is not clear to me... Can we use/take advantage of this Relay (and if so, how..) or to fully take advantage of Rejoiner we would have to use Rejoiner's implementation of Relay? |
@CelsoSantos this is a good question... so relay is really just bunch of additional requirements/assumption about your schema on top of standard GraphQL spec. Btw, I actually don't know what is going to happen if you try to use relay client with the server that does not comply 100% with the requirements (if you find out -let me know). So I think graphql-java-kickstart provides some utils to add otherwise very repetitive schema annotation so is rejoiner. I don't think you can use rejoiner together with I have started this branch for TodoMVC example for relay and rejoiner. This seemed to work, but I have never done it for real use case though... Keep me posted if you go that route... |
According to the spec, one needs to annotate the proto definition with @DianaSuvorova I took a look at your code. I see the On another note, building protos with Maven using that annotation is producing an error due to being unable to use/find
Do I need to replicate/implement |
I'd be surprised you need to reimplement relay.proto I think it is project's compilation issue.
Yeah, I probably has stopped at this point. Cause I thought it is too far down the stack. Ie I think Relay support gets too invasive if you need to built it in proto defs. I am probably not very helpful... but would you mind sharing why you decided to go for Relay instead of other GraphQL client (ie apollo) Since I went similar route and while I very much like Relay's approach, guidelines and structure I have decided in favor of Apollo since it was much easier to get up and running and it does not dictate additional requirements on the server part.. would be curious to hear your thoughts |
I have tried to spin up a relay client with rejoiner-based GraphQL server on the back end and here are my observations:
relay client requires
graphql.schema
to be available locally. So GrapQL server needs to expose a way to get a schema. This is as simple as using schema printer and exposing it via/schema
endpoint.My need to update an example to demo complete integration.
private static final String schema = new SchemaPrinter().print(SCHEMA);
I feel a bit uneasy about the fact that
ID
fields annotations belong to actual source.proto
files.I actually have not tested it and not sure if it works properly given that Relay support is experimental.
It could use some more centralized config. For example assume all fields with name
id
are actually an GraphQLID
type and provide a way to turn it off and/or provide a different name for an ID field. For examplenew SchemaProviderModule(
uid)
. Since there is a way to update the types on case-by-case basis, I feel this might have a better separation of concerns than to actually bake relay-related artifacts into .proto files.Similarly I feel that relay support is awesome in general, but should be optional. Maybe it can be an an option to the
SchemaProviderModule(relay: true)
.I haven't tested
@RelayNode
signature, but I like the idea.I haven't checked if mutations and connections work as per spec but planning to get to it soon.
The text was updated successfully, but these errors were encountered: