smallrye-graphql
smallrye-graphql copied to clipboard
Add support for Relay connections
I understand time is limited, but it might be interesting to have support for Relay connections out of the box.
Similar as https://nexus.js.org/docs/plugin-connection
PS: I don't need this myself, but I came across it and it might be useful to have something similar in the future.
Any update regarding this? i think it's a valid use case
No update on this. You are welcome to provide a PR !!! :)
I guess chances would increase, if you would provide a tangible suggestion how the syntax would work exactly.
@t1 this is the official link for relay server side specification (https://relay.dev/docs/en/graphql-server-specification.html). The level of schema starts by connection -> edges -> node -> your (table row, collection document). The changes that need to be done is that you have a general type Node that has an id of type ID!, this type is usually base64 encoded and it should be used in all the ((table row, collection document) types (all of them should implement it). You can also notice that the implementation starts by a Connection type that define edges and pageInfo (i will explain pageInfo later), the edges then have cursor(i will explain later) and node and then you have your node which is your attributes or columns. Regarding the pageinfo it has information about the your queryif it has nextpage, previouspage, start cursor and end cursor which is related to the cursor that you have in the edge type. the cursor is unique value for each edge and it's used to query the next cursor for example or previous cursor that you get from query.
PS I would be happy to help if you would like to do the implementation together.
Connection and Edge part is available in my generics example. Node is not here but can be added easily
DGS Framework supports it natively: https://netflix.github.io/dgs/advanced/relay-pagination/ sourcecode: https://github.com/Netflix/dgs-framework/blob/master/graphql-dgs-pagination/src/main/kotlin/com/netflix/graphql/dgs/pagination/DgsPaginationTypeDefinitionRegistry.kt