Code Monkey home page Code Monkey logo

Comments (5)

siderakis avatar siderakis commented on June 10, 2024

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.

  1. That makes sense.
  2. There are a bunch of approaches we could take, annotating protos, annotating Java code, external config file (maybe YAML). Most of Rejoiner was based on Java annotations/code, I'd also like to support proto annotations and this was just a place to experiment (since Relay support itself is experimental). I'm open to supporting all of those options, since I see pros and cons depending on the situation.
  3. Good idea. Also, if nothing is annotated with @RelayId or @RelayNode I'd hope the schema wouldn't mention Relay at all.
  4. Thanks :-)
  5. There might be a great opportunity to map Google API design recommendation for pagination (https://aip.dev/158) onto Relay pagination.

from rejoiner.

CelsoSantos avatar CelsoSantos commented on June 10, 2024

There is something that is not clear to me...
I'm using graphql-java-kickstart which implements Relay (for a number of reasons this existed already in the project I'm working on).

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?

from rejoiner.

DianaSuvorova avatar DianaSuvorova commented on June 10, 2024

@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 graphql-java-kickstart, it comes with its own graphql server implementation, in examples they use jetty

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...

from rejoiner.

CelsoSantos avatar CelsoSantos commented on June 10, 2024

According to the spec, one needs to annotate the proto definition with [(google.api.graphql.relay_options).id = true]; right?

@DianaSuvorova I took a look at your code. I see the @RelayNode annotation but your protos don't have that annotation. Is that on purpose?

On another note, building protos with Maven using that annotation is producing an error due to being unable to use/find relay.proto:

[INFO]     Processing (java): author.proto
protoc-jar: executing: [/tmp/protocjar14842319688386487255/bin/protoc.exe, -I/workspace/proto, -I/tmp/protocjar14618580364098423728/include, -I/workspace/proto/my-company/ac/author/v1, --java_out=/workspace/proto/target/generated-sources, /workspace/proto/my-company/ac/author/v1/author.proto]
relay.proto: File not found.
my-company/ac/author/v1/author.proto:10:1: Import "relay.proto" was not found or had errors.
my-company/ac/author/v1/author.proto:9:1: warning: Import google/protobuf/empty.proto is unused.
[ERROR] /workspace/proto/evooq/ac/author/v1/author.proto [0:0]: relay.proto: File not found.
[ERROR] /workspace/proto/evooq/ac/author/v1/author.proto [10:1]:  Import "relay.proto" was not found or had errors.
[ERROR] /workspace/proto/evooq/ac/author/v1/author.proto [9:1]:  warning: Import google/protobuf/empty.proto is unused.
[ERROR] /workspace/proto/evooq/ac/author/v1/author.proto [0:0]: 

Do I need to replicate/implement relay.proto locally?

from rejoiner.

DianaSuvorova avatar DianaSuvorova commented on June 10, 2024

@CelsoSantos

I'd be surprised you need to reimplement relay.proto I think it is project's compilation issue.

I see the @RelayNode annotation but your protos don't have that annotation. Is that on purpose?

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

from rejoiner.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.