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

GraphQL In Real Life

GraphQL In Real Life

Roberto Orgiu

April 05, 2019
Tweet

More Decks by Roberto Orgiu

Other Decks in Programming

Transcript

  1. > Task :apollo:generateDebugApolloIR FAILED .../android/apollo/Query.graphql: Cannot query field "nam" on

    type "YourType". Did you mean "name"? error: Validation of GraphQL query document failed FAILURE: Build failed with an exception.
  2. Solutions 2 solutions O k H t t p I

    n t e r c e p t o r A u t o m a t i c P e r s i s t e d Q u e r i e s W e f o u n d
  3. query filmById($filmId: ID){ film(filmID :$filmId){ title episodeID characterConnectionT{ charactersT{ name

    homeworldT{ name }A speciesT{ name classification }B filmConnectionT{ filmsT{ title episodeID }C }D }E }F }G }H A u t o m a t i c P e r s i s t e d Q u e r i e s
  4. query filmById($filmId: ID){ film(filmID :$filmId){ title episodeID characterConnectionT{ charactersT{ name

    homeworldT{ name }A speciesT{ name classification }B filmConnectionT{ filmsT{ title episodeID }C }D }E }F }G }H A u t o m a t i c P e r s i s t e d Q u e r i e s variables { "filmId" : 1 }A query: query filmById($filmId: ID) { film(filmId :$filmId) { title episodeID characterConnection { name homeworld{ name }B species { name classification }C filmConnection { films { title episodeID }D }E }F }G }H operationName: filmById
  5. query filmById($filmId: ID){ film(filmID :$filmId){ title episodeID characterConnectionT{ charactersT{ name

    homeworldT{ name }A speciesT{ name classification }B filmConnectionT{ filmsT{ title episodeID }C }D }E }F }G }H A u t o m a t i c P e r s i s t e d Q u e r i e s variables { "filmId" : 1 }A query: query filmById($filmId: ID) { film(filmId :$filmId) { title episodeID characterConnection { name homeworld{ name }B species { name classification }C filmConnection { films { title episodeID }D }E }F }G }H operationName: filmById operationName: filmById variables { "filmId" : 1 }T
  6. query filmById($filmId: ID){ film(filmID :$filmId){ title episodeID characterConnectionT{ charactersT{ name

    homeworldT{ name }A speciesT{ name classification }B filmConnectionT{ filmsT{ title episodeID }C }D }E }F }G }H A u t o m a t i c P e r s i s t e d Q u e r i e s variables { "filmId" : 1 }A query: query filmById($filmId: ID) { film(filmId :$filmId) { title episodeID characterConnection { name homeworld{ name }B species { name classification }C filmConnection { films { title episodeID }D }E }F }G }H operationName: filmById operationName: filmById variables { "filmId" : 1 }T
  7. A u t o m a t i c P

    e r s i s t e d Q u e r i e s operationName: filmById variables { "filmId" : 1 }T extensions: { persistedQuery: { "version": 1, "sha256Hash": "queryHash" } }
  8. Tricks Tricks J U S T S O M E

    query SampleQuery { assetID: sourceId fingerprint: modified headlineInfo: headline { __typename headline: default }A lastUpdated: lastModification }B
  9. Tricks Tricks L A B E L F I E

    L D S C A N G O A L O N G D I S T A N C E J U S T S O M E query SampleQuery { assetID: sourceId fingerprint: modified headlineInfo: headline { __typename headline: default }A lastUpdated: lastModification }B
  10. Tricks Tricks A P O L L O A D

    D S T Y P E N A M E E V E R Y W H E R E J U S T S O M E query SampleQuery { assetID: sourceId fingerprint: modified headlineInfo: headline { __typename headline: default }A lastUpdated: lastModification }B
  11. Tricks Tricks S C H E M A A N

    D Q U E R I E S C A N B E M O V E D J U S T S O M E apollo { schemaFilePath = "/path/my-schema.json" outputPackageName = "pkg.graphql.api" }
  12. Tricks Tricks S U P P O R T S

    F O R J A V A B E A N S E M A N T I C S J U S T S O M E class Type { public Another getAnother() { ... } } //build.gradle apollo { useJavaBeansSemanticNaming = true }
  13. Tricks Tricks R E M E M B E R

    T O B E O N L I N E ¯ \ _ ( ツ ) _ / ¯ J U S T S O M E