SlideShare a Scribd company logo
1 of 24
Download to read offline
GraphQL – the future
of APIs?
- OR -

GraphQL in a brief
Dmitry Stropalov, Sizmek Kraków 2017
What is GraphQL
• GraphQL is a (query) language
- declarative

- hierarchical 

- strongly typed
• GraphQL is a runtime

- execution layer

- technology agnostic
2
Yet another technology?
• Era of mobile devices

• Flexibility & Transparency

• Productivity & Costs
3
Some example
4
I have a data. What’s next?
5
1. Define a schema for data representation
GraphQL Schema:
type Campaign {
name: ID!
title: String
running: Boolean
ads: [Ad]
}
Elixir DSL:
object :campaign do
field :id, non_null(:id)
field :title, :string
field :running, :boolean
field :ads, list_of(:ad),
resolve: assoc(:ads)
end
I have a data. What’s next?
6
2. Define a schema of queries and mutations
GraphQL Schema:
type Query {
campaign(id: ID!): Campaign
}
Elixir DSL:
field :campaign, :campaign do
arg :id, non_null(:id)
resolve &CampaignResolver.find/2
end
I have a data. What’s next?
7
3. Implement resolvers for queries and mutations
Elixir:
def find(%{id: id}, _info) do
case Repo.get(Campaign, id) do
nil -> {:error, "Campaign #{id} not found"}
campaign -> {:ok, campaign}
end
end
I have a data. What’s next?
8
4. Make some queries
GraphQL query:
query {
campaign(id: 1) {
running
ads {
budget {
amount
}
}
}
}
GraphQL mutation:
mutation {
createCampaign(
title: "New campaign",
running: false, ads: [
{title: “LI 1"}
]) {
id
}
}
GraphQL Schema
9
• Scalar Types

• Lists & Enumeration Types

• Object Types

• Interfaces & Unions

• Arguments

• Input types
Scalar Types
10
• Int: A signed 32‐bit integer.

• Float: A signed double-precision floating-point value.

• String: A UTF‐8 character sequence.

• Boolean: true or false.

• ID: non human-readable String.

• Custom scalars via scalar keyword.
Lists & Enumeration Types
• Lists defined with [ and ] around type.

• Enum – special type of scalar with a restricted set of
possible values:



enum Episode {

FIRST

SECOND

THIRD

}
11
Object Types
• Object type – named set of fields with theirs types.

• Fields could be scalars or other object types, enums, lists.

• Fields could be marked as non-nullable:



type Ad {

title: String!

targetings: [Targeting!]!

}
12
Interfaces & Unions
• Interface – an abstract object type:

interface Player {

nickname: String!

}

type User implements Player {

nickname: String!

…

}

• Union – specifies a set of possible object types:

union SearchResult = Picture | Video | Document



search(text: "Kraków") {

… on Picture { size }

… on Video { length }

… on Document { format }

}
13
Arguments
• Every field of an object type can have zero or more
arguments:

type FuelTank {

volume(unit: VolumeUnit = LITRE): Float

}

• All arguments are named.

• Could be required or optional.
14
Input Types
• Input types – object types used for mutations.

• Input and output object types can’t be mixed.

• No arguments on input object fields.
15
GraphQL Queries
16
Fields, aliases, fragments and other things
Introspection & Docs
• Introspection is built-in via special __schema object.

• Any type introspection via __type object.

• Documentation is a part of schema definition:



@desc "Get campaign by ID."

field :campaign, :campaign do

arg :id, non_null(:id), description: "Specifies campaign ID.”

resolve &CampaignResolver.find/2

end
17
API Versioning
• GraphQL can’t have “v1”-style versioning.

• Evolution is the key.
18
One more “v1” thing
19
–Monty Python
“And now for something completely different …”
20
The Glory of REST
21
From the article “Richardson Maturity Model” by M.Fowler
GraphQL & REST
• GraphQL is a language, specification and tools while REST is an
architectural concept.

• GraphQL is completely independent of a transport protocol used.

• With GraphQL you can think in terms of a business logic objects
instead of resources.

• Different caching approaches.

• API payload optimisations.

• Field usage monitoring.
22
Adoption
• Facebook

• GitHub

• Twitter

• Airbnb

• The New York Times

• Wirtualna Polska

• Coursera

• Dailymotion
23
The End

More Related Content

Similar to GraphQL – the future of APIs?

MongoDB World 2019: Building a GraphQL API with MongoDB, Prisma, & TypeScript
MongoDB World 2019: Building a GraphQL API with MongoDB, Prisma, & TypeScriptMongoDB World 2019: Building a GraphQL API with MongoDB, Prisma, & TypeScript
MongoDB World 2019: Building a GraphQL API with MongoDB, Prisma, & TypeScriptMongoDB
 
Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...
Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...
Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...All Things Open
 
Tutorial: Building a GraphQL API in PHP
Tutorial: Building a GraphQL API in PHPTutorial: Building a GraphQL API in PHP
Tutorial: Building a GraphQL API in PHPAndrew Rota
 
How and Where in GLORP
How and Where in GLORPHow and Where in GLORP
How and Where in GLORPESUG
 
Building a GraphQL API in PHP
Building a GraphQL API in PHPBuilding a GraphQL API in PHP
Building a GraphQL API in PHPAndrew Rota
 
classes object fgfhdfgfdgfgfgfgfdoop.pptx
classes object  fgfhdfgfdgfgfgfgfdoop.pptxclasses object  fgfhdfgfdgfgfgfgfdoop.pptx
classes object fgfhdfgfdgfgfgfgfdoop.pptxarjun431527
 
Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...
Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...
Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...Databricks
 
OODP Unit 1 OOPs classes and objects
OODP Unit 1 OOPs classes and objectsOODP Unit 1 OOPs classes and objects
OODP Unit 1 OOPs classes and objectsShanmuganathan C
 
Chapter02 graphics-programming
Chapter02 graphics-programmingChapter02 graphics-programming
Chapter02 graphics-programmingMohammed Romi
 
OpenAPI development with Python
OpenAPI development with PythonOpenAPI development with Python
OpenAPI development with PythonTakuro Wada
 
Enforcing API Design Rules for High Quality Code Generation
Enforcing API Design Rules for High Quality Code GenerationEnforcing API Design Rules for High Quality Code Generation
Enforcing API Design Rules for High Quality Code GenerationTim Burks
 
The advantage of developing with TypeScript
The advantage of developing with TypeScript The advantage of developing with TypeScript
The advantage of developing with TypeScript Corley S.r.l.
 

Similar to GraphQL – the future of APIs? (20)

GraphQl Introduction
GraphQl IntroductionGraphQl Introduction
GraphQl Introduction
 
Angular
AngularAngular
Angular
 
GraphQL + relay
GraphQL + relayGraphQL + relay
GraphQL + relay
 
HyperGraphQL
HyperGraphQLHyperGraphQL
HyperGraphQL
 
MongoDB World 2019: Building a GraphQL API with MongoDB, Prisma, & TypeScript
MongoDB World 2019: Building a GraphQL API with MongoDB, Prisma, & TypeScriptMongoDB World 2019: Building a GraphQL API with MongoDB, Prisma, & TypeScript
MongoDB World 2019: Building a GraphQL API with MongoDB, Prisma, & TypeScript
 
Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...
Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...
Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...
 
Tutorial: Building a GraphQL API in PHP
Tutorial: Building a GraphQL API in PHPTutorial: Building a GraphQL API in PHP
Tutorial: Building a GraphQL API in PHP
 
Graphql usage
Graphql usageGraphql usage
Graphql usage
 
How and Where in GLORP
How and Where in GLORPHow and Where in GLORP
How and Where in GLORP
 
GraphQL 101
GraphQL 101GraphQL 101
GraphQL 101
 
Revealing ALLSTOCKER
Revealing ALLSTOCKERRevealing ALLSTOCKER
Revealing ALLSTOCKER
 
Building a GraphQL API in PHP
Building a GraphQL API in PHPBuilding a GraphQL API in PHP
Building a GraphQL API in PHP
 
classes object fgfhdfgfdgfgfgfgfdoop.pptx
classes object  fgfhdfgfdgfgfgfgfdoop.pptxclasses object  fgfhdfgfdgfgfgfgfdoop.pptx
classes object fgfhdfgfdgfgfgfgfdoop.pptx
 
Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...
Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...
Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...
 
OODP Unit 1 OOPs classes and objects
OODP Unit 1 OOPs classes and objectsOODP Unit 1 OOPs classes and objects
OODP Unit 1 OOPs classes and objects
 
Chapter02 graphics-programming
Chapter02 graphics-programmingChapter02 graphics-programming
Chapter02 graphics-programming
 
OpenAPI development with Python
OpenAPI development with PythonOpenAPI development with Python
OpenAPI development with Python
 
Enforcing API Design Rules for High Quality Code Generation
Enforcing API Design Rules for High Quality Code GenerationEnforcing API Design Rules for High Quality Code Generation
Enforcing API Design Rules for High Quality Code Generation
 
The advantage of developing with TypeScript
The advantage of developing with TypeScript The advantage of developing with TypeScript
The advantage of developing with TypeScript
 
AngularConf2015
AngularConf2015AngularConf2015
AngularConf2015
 

Recently uploaded

Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 

Recently uploaded (20)

Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 

GraphQL – the future of APIs?

  • 1. GraphQL – the future of APIs? - OR - GraphQL in a brief Dmitry Stropalov, Sizmek Kraków 2017
  • 2. What is GraphQL • GraphQL is a (query) language - declarative - hierarchical - strongly typed • GraphQL is a runtime - execution layer - technology agnostic 2
  • 3. Yet another technology? • Era of mobile devices • Flexibility & Transparency • Productivity & Costs 3
  • 5. I have a data. What’s next? 5 1. Define a schema for data representation GraphQL Schema: type Campaign { name: ID! title: String running: Boolean ads: [Ad] } Elixir DSL: object :campaign do field :id, non_null(:id) field :title, :string field :running, :boolean field :ads, list_of(:ad), resolve: assoc(:ads) end
  • 6. I have a data. What’s next? 6 2. Define a schema of queries and mutations GraphQL Schema: type Query { campaign(id: ID!): Campaign } Elixir DSL: field :campaign, :campaign do arg :id, non_null(:id) resolve &CampaignResolver.find/2 end
  • 7. I have a data. What’s next? 7 3. Implement resolvers for queries and mutations Elixir: def find(%{id: id}, _info) do case Repo.get(Campaign, id) do nil -> {:error, "Campaign #{id} not found"} campaign -> {:ok, campaign} end end
  • 8. I have a data. What’s next? 8 4. Make some queries GraphQL query: query { campaign(id: 1) { running ads { budget { amount } } } } GraphQL mutation: mutation { createCampaign( title: "New campaign", running: false, ads: [ {title: “LI 1"} ]) { id } }
  • 9. GraphQL Schema 9 • Scalar Types • Lists & Enumeration Types • Object Types • Interfaces & Unions • Arguments • Input types
  • 10. Scalar Types 10 • Int: A signed 32‐bit integer. • Float: A signed double-precision floating-point value. • String: A UTF‐8 character sequence. • Boolean: true or false. • ID: non human-readable String. • Custom scalars via scalar keyword.
  • 11. Lists & Enumeration Types • Lists defined with [ and ] around type. • Enum – special type of scalar with a restricted set of possible values:
 
 enum Episode {
 FIRST
 SECOND
 THIRD
 } 11
  • 12. Object Types • Object type – named set of fields with theirs types. • Fields could be scalars or other object types, enums, lists. • Fields could be marked as non-nullable:
 
 type Ad {
 title: String!
 targetings: [Targeting!]!
 } 12
  • 13. Interfaces & Unions • Interface – an abstract object type:
 interface Player {
 nickname: String!
 }
 type User implements Player {
 nickname: String!
 …
 } • Union – specifies a set of possible object types:
 union SearchResult = Picture | Video | Document
 
 search(text: "Kraków") {
 … on Picture { size }
 … on Video { length }
 … on Document { format }
 } 13
  • 14. Arguments • Every field of an object type can have zero or more arguments:
 type FuelTank {
 volume(unit: VolumeUnit = LITRE): Float
 } • All arguments are named. • Could be required or optional. 14
  • 15. Input Types • Input types – object types used for mutations. • Input and output object types can’t be mixed. • No arguments on input object fields. 15
  • 16. GraphQL Queries 16 Fields, aliases, fragments and other things
  • 17. Introspection & Docs • Introspection is built-in via special __schema object. • Any type introspection via __type object. • Documentation is a part of schema definition:
 
 @desc "Get campaign by ID."
 field :campaign, :campaign do
 arg :id, non_null(:id), description: "Specifies campaign ID.”
 resolve &CampaignResolver.find/2
 end 17
  • 18. API Versioning • GraphQL can’t have “v1”-style versioning. • Evolution is the key. 18
  • 19. One more “v1” thing 19
  • 20. –Monty Python “And now for something completely different …” 20
  • 21. The Glory of REST 21 From the article “Richardson Maturity Model” by M.Fowler
  • 22. GraphQL & REST • GraphQL is a language, specification and tools while REST is an architectural concept. • GraphQL is completely independent of a transport protocol used. • With GraphQL you can think in terms of a business logic objects instead of resources. • Different caching approaches. • API payload optimisations. • Field usage monitoring. 22
  • 23. Adoption • Facebook • GitHub • Twitter • Airbnb • The New York Times • Wirtualna Polska • Coursera • Dailymotion 23