Skip to content
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

Support Relay #42

Open
LegNeato opened this issue Apr 23, 2017 · 14 comments
Open

Support Relay #42

LegNeato opened this issue Apr 23, 2017 · 14 comments
Labels
enhancement Improvement of existing features or bugfix

Comments

@LegNeato
Copy link
Member

Looks like Relay has a thin layer on top of GraphQL. Would adding (optional?) Relay support be in scope for juniper?

@theduke theduke added the enhancement Improvement of existing features or bugfix label Jul 26, 2017
@bbqsrc
Copy link

bbqsrc commented May 26, 2018

I have started working on relay support, implementing the Relay Cursor Connections Specification specification here.

@kaushalyap
Copy link

@bbqsrc can we now use relay with Juniper? any updates?

@LegNeato
Copy link
Member Author

LegNeato commented Dec 4, 2018

FWIW, I found https://github.com/bbqsrc/juniper-relay. @bbqsrc can speak to the state of it of course.

@MonsieurMan
Copy link

MonsieurMan commented Nov 18, 2019

There is a specification page about the assumptions Relay makes of a GraphQL server. https://relay.dev/docs/en/graphql-server-specification, work could begin from there.

Those three points are further detailed and linked at the end of the page, https://relay.dev/docs/en/graphql-server-specification#further-reading:

From my understanding, any implementation of a GraphQL server can work as a Relay server, you just have to check a few other things. There is maybe an opportunity to check them at compile time with Rust but this is not to be added directly into juniper IMO.

@UkonnRa
Copy link

UkonnRa commented Jan 1, 2020

So any progress on Relay?

@MonsieurMan
Copy link

@UkonnRa see my comment above. You can use it, you just have to check a few things manually and to conform to the three specs I linked to.

@davidpdrsn
Copy link
Contributor

I wonder if the relay additions could be a separate library built on top of juniper and not necessarily something that is built in 🤔

@MonsieurMan
Copy link

MonsieurMan commented Jan 11, 2020 via email

@davidpdrsn
Copy link
Contributor

I guess that means someone can build a library crate for relay support?

@Asone
Copy link

Asone commented Oct 7, 2022

Just for information, digging on with Github search i found an implementation that seems to work made by @dyedgreen on a rust project he made. The implementation can be found here.

I don't know if he intends at some point to publish this as a separate crate, but meanwhile it could be useful to anyone that would like to use relay pagination.

Also, his code uses the implementation so it provides a good example on how to use it

@dyedgreen
Copy link
Contributor

dyedgreen commented Oct 8, 2022

If people find it useful, I could try to update the library if necessary and publish it as a stand-alone crate.

I made this a while ago, but iirc it’s mostly just a trait that you can implement which then gets plummed through to the correct Juniper traits.

@Asone
Copy link

Asone commented Oct 8, 2022

If people find it useful, I could try to update the library if necessary and publish it as a stand-alone crate.

I made this a while ago, but iirc it’s mostly just a trait that you can implement which then gets plummed through to the correct Juniper traits.

For my own use i just made a copy of your implementation mentioning the source.

However if you intend to publish it as a crate i'd be happy to use it as a dependency 😀.
I can't speak for all but i'm pretty sure people would find it useful as even if it is a few traits and structs, it might be not so trivial to many as no other implementation ( aside of @bbqsrc's one ) can be found on GH.

@dyedgreen
Copy link
Contributor

I've moved the Relay connection package into it's own repo and published that on crates.io. (I also added an async version, so the load closure may be async ...) (cc @Asone)

@IvanRodriCalleja
Copy link

How do you support Global ID with Juniper?

having the node query:

node(id: "") {
    id
    ... on Model {
      name
    }
  }

I can't think in a good way to resolve this node query to get the exact model resolver. I have seen in other language implementations that the id has a shape like: model-id an then converted to uuid with that when the node query is requested deserialize that and uses the model to resolve.

How do you implement this resolver?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement of existing features or bugfix
Projects
None yet
Development

No branches or pull requests

10 participants