https://www.pinterest.ca/pin/800303796252282285

The tension between data & use-case driven GraphQL APIs

  • Pagination: the GitHub API was designed with snappier / use case driven clients. This assumes these kinds of clients probably don’t want to fetch a very large amount of comments in a single request, but rather recreate something a bit like GitHub’s own UI.
  • Timeouts: We’re pretty aggressive with GraphQL query timeouts with our API at GitHub, we don’t want to let a gigantic GraphQL running for too long. However, purely data driven clients might need to make pretty large queries (one query only, yay), to achieve their goals. Even though it’s a valid use case and not an abuse scenario, there is quite a high chance queries could timeout if they query hundreds, see thousands of records.

Ship a new data driven schema

Asynchronous GraphQL Jobs

POST /async_graphql{
allTheThings {
andEvenMore {
things
}
}
}
202 ACCEPTED
Location: /async_graphql/HS3HlKN76EI5es7qSTHNmA
GET /async_graphql/HS3HlKN76EI5es7qSTHNmA202 ACCEPTED
Location: /async_graphql/HS3HlKN76EI5es7qSTHNmA
GET /async_graphql/HS3HlKN76EI5es7qSTHNmA{ "data": { ... } }

Streaming

Best of both worlds?

subscription Comments {
comments(pullRequests: [...]) {
comment {
id
bodyHTML
author {
name
}
}
}
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Marc-André Giroux

Marc-André Giroux

#GraphQL Enthusiast, Speaker, Senior Software Developer @ Netflix 📖 Book is now available https://book.productionreadygraphql.com/