Production Ready
GraphQL

 

Eve Porcello

@eveporcello

eve@moonhighway.com

Agenda

  • Getting Ready for @defer and @stream 

  • Apollo Studio and Rover CLI 

  • Managed Federation

  • Graph Security

  • Error Handling 

The GraphQL Spec

Queries

query {
  cat(name:"Biscuit") {
    name
    location
    mood
  }
}
{
  "data": {
    "cat": {
      "name":"Biscuit",
      "location": "Tahoe City",
      "mood": "pensive"
    }
  }
}

POST     /graphql

Query

Mutations

mutation {
  setLiftStatus(
    name:"Panorama", 
    newStatus: "hold"
  ) {
    name
    newStatus
    oldStatus
  }
}
{
  "data": {
    "setLiftStatus": {
      "name": "Panorama",
      "newStatus": "hold",
      "oldStatus": "open"
    }
  }
}

POST     /graphql

Mutation

Subscriptions

subscription {
  liftStatusChange {
    name
    newStatus
    oldStatus
  }
}
{
  "data": {
    "setLiftStatus": {
      "name": "Panorama",
      "newStatus": "hold",
      "oldStatus": "open"
    }
  }
}

WebSockets

Subscription

{
  "data": {
    "setLiftStatus": {
      "name": "Astra Express",
      "newStatus": "closed",
      "oldStatus": "open"
    }
  }
}
{
  "data": {
    "setLiftStatus": {
      "name": "Panorama",
      "newStatus": "closed",
      "oldStatus": "open"
    }
  }
}
query {
  cat(name: "Biscuit") {
    name
    location
    birthLocation
    weight
    gpa
    astrologicalSign
    hangingInThere
    bicyclePreference
    isADentist
    knowsADentist
    siblings {
      name
      location
    }
  }
}
query {
  cat(name: "Biscuit") {
    name
    location
    birthLocation
    weight
    gpa
    astrologicalSign
    hangingInThere
    bicyclePreference
    isADentist
    knowsADentist
    siblings {
      name
      location
    }
  }
}
query {
  cat(name: "Biscuit") {
    name
    location
    birthLocation
    
    
    
    
    
    
    
    
    
    
    
  }
}

@stream

@defer

@defer Directive

query {
  cat(name: "Biscuit") {
    name
    location
    birthLocation
    weight
    ...ExtraneousCatDetails @defer
  }
}

fragment ExtraneousCatDetails on Cat {
    gpa
    astrologicalSign
    hangingInThere
    bicyclePreference
    isADentist
    knowsADentist
}

@stream

query {
  cat(name: "Biscuit") {
    name
    friends {
      name
    }
  }
}
query {
  cat(name: "Biscuit") {
    name
    friends @stream(initialCount: 3) {
      name
    }
  }
}
query {
  cat(name: "Biscuit") {
    name
    friends @stream(initialCount: 3) {
      name
      ...ExtraneousCatFields @defer
    }
  }
}

Where Can I Learn More?

Where can I try this?

Production Ready GraphQL

By Moon Highway

Production Ready GraphQL

  • 422