Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Implementing and using GraphQL at GitHub

Kyle Daigle
September 14, 2016

Implementing and using GraphQL at GitHub

This talk was given at GitHub Universe 2016. Alongside Dan Schafer from GitHub, we discuss GraphQL, the what's and the hows, and how GitHub has launched its public GraphQL API.

Kyle Daigle

September 14, 2016
Tweet

More Decks by Kyle Daigle

Other Decks in Programming

Transcript

  1. Implementing and Using GraphQL Kyle Daigle Platform Interface Engineering Manager,

    GitHub Dan Schafer Software Engineer, Co-Creater of GraphQL, Facebook
  2. Today • Over 250,000 OAuth Applications • Over 6,000,000 users

    have installed an OAuth app • REST API v3 • Webhooks
  3. Pains of our API • Getting the data you want

    can be multiple REST calls away • It’s difficult for us to release comprehensive REST responses that don’t expose too much data that’s too expensive to calculate. • When we’re forced to make a change, it’s very hard to know who it will impact • GitHub uses the API for its own integrations but not for product features
  4. { "me": { "name": "Daniel Schafer", "profilePic": { "width": 50,

    "height": 50, "url": "https://cdn/50.jpg" } } } { me { name profilePic { width height url } } }
  5. { me { name friends { name } } }

    { "me": { "name": "Daniel Schafer", "friends": [ { "name": "Kyle Daigle" }, { "name": "Nick Schrock" }, { "name": "Lee Byron" },
  6. { me { name friends { name events { name

    } } } } { "me": { "name": "Daniel Schafer", "friends": [ { "name": "Kyle Daigle", "events": [ { "name": "Github Universe" }, { "name": "GraphQL Meetup" }, ] }
  7. { me { name friends(first: 1) { name events(first: 1)

    { name } } } } { "me": { "name": "Daniel Schafer", "friends": [ { "name": "Kyle Daigle", "events": [ { "name": "Github Universe" } ] } ] } }
  8. { me { name friends(first: 1) { name events(first: 1)

    { name } } } } type Query { me: User user(id: Int): User }
  9. { me { name friends(first: 1) { name events(first: 1)

    { name } } } } type User { name: String profilePic(size: Int = 50): Image friends(first: Int): [User] events(first: Int): [Event] }
  10. { me { name friends(first: 1) { name events(first: 1)

    { name } } } } type User { name: String profilePic(size: Int = 50): Image friends(first: Int): [User] events(first: Int): [Event] }
  11. { me { name friends(first: 1) { name events(first: 1)

    { name } } } } type Event { name: String attendees(first: Int): [User] }
  12. { me { name attendees(first: 1) { name } }

    } type User { name: String profilePic(size: Int = 50): Image friends(first: Int): [User] events(first: Int): [Event] }
  13. { __schema { types { name fields { name type

    { name } } } } } type Query { me: User user(id: Int): User } type User { name: String profilePic(size: Int = 50): Image friends(first: Int): [User] events(first: Int): [Event] } type Event { name: String attendees(first: Int): [User] }
  14. CLIENT APP SERVER Views v3 Models Models v2 Models v3

    Here's your 123 v3 model Model: 123, v3, plz
  15. CLIENT APP SERVER Models v2 Models v3 Models v4 Views

    v4 Here's your 123 v4 model Model: 123, v4, plz
  16. Models Views Here's your 123 model CLIENT Model: 123, plz

    APP SERVER Model: 123, plz Model: 123, plz Model: 123, plz Model: 123, plz Model: 123, plz
  17. Views v2 Views Models Models v2 This data shape, plz

    Here's your specific data CLIENT APP SERVER Type System
  18. Views v3 Views v2 Views Models Models v2 Models v3

    This data shape, plz Here's your specific data CLIENT APP SERVER Type System
  19. GitHub Platform Forum • Public forum to discuss early access

    and pre-release features • Staffed by GitHub Platform Engineers, Product Managers, and Support staff • Feedback can immediately be used by GitHub engineers • Integrators can work with each other to share novel uses and best practices
  20. Early Access Program • We will provide a communication channel

    to collaboratively impact the direction and approach of a project. • We will strive to keep documentation updated, but you can expect unannounced breaking changes as we develop quickly. • We may stop or pause access to Early Access releases at any point. • You will encounter bugs and there will be reliability and stability hiccups.
  21. FIN