Existing Relay API needs modifications to be usable in practical applications #3700
Unanswered
aryaniyaps
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
While using the relay API provided by strawberry GraphQL, I've been noticing a few quirks that make the existing API patterns unusable in the real world.
Quirk 1- Relay Connections API
The documentation shows that we can use the relay Connections API like this:
However, there are a few issues with this approach:
Here's how I've setup Relay Connections with a layered architecture instead:
Quirk 2- Global ID API
Whenever I declare a NodeID like this:
A GlobalID is automatically being generated in the schema. (referencing #3551 )
My understanding is that this dataclass was initially meant to help conversion to and from base64 opaque ids, but ended up being a custom scalar in the output GraphQL schema as well.
This probably doesn't matter much, until when you're facing errors from the relay compiler which strictly requires the ID fields to be named as
ID
, and notGlobalID
, as described in #3551 ,As a result, Im using a hack like this in the meantime:
I think that the GlobalID field should be an internal helper and not a custom scalar type.
Making these changes would probably break some stuff, but I wanted to put forth these DX issues to consider them before making things stable!
Beta Was this translation helpful? Give feedback.
All reactions