Skip to content
This repository has been archived by the owner on Mar 15, 2023. It is now read-only.

Latest commit

 

History

History
51 lines (38 loc) · 926 Bytes

all-lists-in-connections.md

File metadata and controls

51 lines (38 loc) · 926 Bytes

All long lists must be paginated (all-lists-in-connections)

Rule Details

All lists must either be paginated according to the Relay spec or explicitly marked as not needing pagination because they're guaranteed to be small.

Use the @tinylist directive to mark a list as small and not in need of pagination.

Examples of incorrect code for this rule:

type T1 {
  val: [T2]
}

Examples of correct code for this rule:

Edges on connections can be lists

type UserConnection {
  pageInfo: PageInfo!
  edges: [UserEdge!]! # this is ok to be a list, since it's an edge on a connection
  totalCount: Int!
}

type PageInfo {
  endCursor: String
  hasNextPage: Boolean!
  hasPreviousPage: Boolean!
  startCursor: String
}

type UserEdge {
  cursor: String!
  node: User!
}

type User {
  ...
}

Fields can be whitelisted to be lists

type T1 {
  val: [T2] @tinylist
}