Add `Paginator` interface to all paginated fields
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.5k
- Forks
- 468
- Avg merge
- 3h 9m
- Merged PRs (30d)
- 2
Description
I am willing to work on this feature if someone could provide the necessary context to get me going.
Is your feature request related to a problem? Please describe.
I am trying to use fragments to extract information from the paginatorInfo field on multiple paginated fields but, as it stands, Lighthouse generates a unique type for each paginated field:
# Example of such a type
type VideoPaginator {
paginatorInfo: PaginatorInfo!
data: [Video!]!
}
Describe the solution you'd like
I suggest we add an interface to the generated types called Paginator:
union Paginated = Video | Post | ... #all fields with @paginated would appear here
interface Paginator {
paginatorInfo: PaginatorInfo!
data: [Paginated!]!
}
type VideoPaginator implements Paginator {
paginatorInfo: PaginatorInfo!
data: [Video!]!
}
Describe alternatives you've considered
I have not considered any other solutions but would love to hear other's ideas.
A brief outline of how to approach this problem in the context of the internal workings of Lighthouse would be helpful as I am not familiar with how things work.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the generated paginator types and the @paginated directive in Lighthouse, then trace how their fields and GraphQL types are assembled. The issue's proposed Paginator interface and shared fragment behavior define the desired outcome, but alternative designs and the exact affected entry points still need investigation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, laravel, php
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100