PageInfo needs to be shareable in GraphQL Federation
Opened this issue · 1 comments
Hi folks,
I want to use absinthe_relay in a GraphQL Federation subgraph.
However, as explained here, PageInfo
must be declared as @shareable
.
I am using absinthe_federation
, and I wanted to add shareable to the PageInfo
type.
Is there a way to do this in my own project without touching the libraries? Thanks!!!
As a workaround, we use a pipeline modifier to add the shareable directive to the PageInfo object if it exists. You can find more information about the usage of those here.
Essentially what you'd want to do is prewalking the blueprint and if the object matches with %Absinthe.Blueprint.Schema.ObjectTypeDefinition{name: "PageInfo"}
pattern, you'd want to inject %Absinthe.Blueprint.Directive{name: "shareable"}
in the directives.
Since the shareable directive doesn't exist in non-federated graphs, it's understandable to not have it in the page_info definition in this library.