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

[GraphQL]: Add Relay support #26

Open
buffalojoec opened this issue Apr 2, 2024 · 5 comments
Open

[GraphQL]: Add Relay support #26

buffalojoec opened this issue Apr 2, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@buffalojoec
Copy link

Motivation

The GraphQL package can be much easier to integrate into web applications if it adheres to the Relay specification and can be used by apps powered by Relay.

One of the biggest schema changes required to be Relay-compliant will be the use of an ID field.

@buffalojoec buffalojoec added the enhancement New feature or request label Apr 2, 2024
@tibi77
Copy link

tibi77 commented Apr 24, 2024

hey @buffalojoec!
I'm interested in picking this one up. From my understanding the gameplan shall be the following:

  1. add id to all the schemas from packages/rpc-graphql/src/schema
  2. add tests specific for Relay inside the schemas tests

Is there any change needed inside the resolvers or loaders?

From the specification in the provided link i can see that ID is a required field, shall that be the case for this PR as well; or shall it be optional?

Thanks

@buffalojoec
Copy link
Author

Hi @tibi77 thanks for reaching out!

I think you've generalized it pretty well here, although we don't know how much of an effort it will be to be completely compliant with the Relay spec until we've started to uncover a few stones in the schema and their docs.

For example, we might have to investigate pagination and cursor connections, but I think the ID and the tests are a good place to start.

It's worth noting that we actually have suitable identifiers for each schema object.

  • Account: Address
  • Block: Slot
  • Transaction: Signature

I think we just need to hack around and see how practical it might be to either:

  1. Replace those fields (address, slot, signature) with the field name id.
  2. Simply duplicate them under the id field name.

Both are pretty gross for their own reasons, but it won't become clear which is the better move until we've messed around with it up close.

tibi77 referenced this issue in tibi77/solana-web3.js Apr 25, 2024
@tibi77
Copy link

tibi77 commented Apr 25, 2024

@buffalojoec opened a draft just for the transactions; curious if i m doing it correctly
also, when i run pnpm run test inside the root, i can not see the rpc-graphql being run. And if i go into the folder packages/rpc-graphql and run npm run test:unit:node i get
image
i think I m missing something about running those tests

@buffalojoec
Copy link
Author

buffalojoec commented Apr 25, 2024

@tibi77 Try making sure you don't have a test validator running, and then from the workspace root run scripts/setup-test-validator.sh. That will download a Solana binary to the workspace and allow the tests to spin up a local validator to run the unit tests. Don't worry about starting it. The test command will do start and stop.

@tibi77
Copy link

tibi77 commented Apr 25, 2024

ohhh nice; thanks for that
they seem to work 💪

tibi77 referenced this issue in tibi77/solana-web3.js Apr 26, 2024
tibi77 referenced this issue in tibi77/solana-web3.js Apr 27, 2024
tibi77 referenced this issue in tibi77/solana-web3.js Apr 30, 2024
@steveluscher steveluscher transferred this issue from solana-labs/solana-web3.js Dec 14, 2024
@steveluscher steveluscher transferred this issue from another repository Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants