SlideShare ist ein Scribd-Unternehmen logo
1 von 25
1
GraphQL Introduction
Serge Huber, Jahia CTO
shuber@jahia.com
#graphql
Make some noise
WHAT IS GRAPHQL ?
…and what it isn’t.
3
WHAT IS GRAPHQL ?
I like opposites
It is not:
• A query language like SQL, JCR-SQL, etc…
• A URL specification
• A finalized standard
• A standard submitted to a standards body
• A 100% JSON standard
• A mature standard, changes are still
happening
4
WHAT IS GRAPHQL ?
A (very) quick look
Courtesy of the GraphQL.org home page
5
WHAT IS GRAPHQL ?
Some users
Courtesy of the GraphQL.org home page
See more on http://graphql.org/users
6
WHAT IS GRAPHQL ?
A quick demo
https://www.graphqlhub.com
7
WHAT IS GRAPHQL ?
Schemas
• A schema that describes:
• Objects
• Object fields
• Field arguments & directives
• Interfaces
• Unions
8
WHAT IS GRAPHQL ?
Fields, the key to understanding GraphQL !
A field may be:
• a static value
• a value resolved through code
Field may have:
• Arguments that are like
parameters to a method call
• Constraints to filter data
• Directives that make the field
conditional in the result
Don’t think of fields as variables,
think of them as methods !
9
WHAT IS GRAPHQL ?
Queries
• Queries
• Specify what fields are part of the
result
• Only fields specified in the schema
are acceptable
• Field may be the result of
computations
• Fields may specify arguments that
will constrain the results (such as
id:10)
• Directives may also be used (such as
@include)
• Variables may be used
• Fragments
• Type casts !
• Pagination (Relay schema)
10
WHAT IS GRAPHQL ?
Mutations
• Mutations
• Make it possible to write/modify
data
• Very similar syntax to queries
11
WHAT IS GRAPHQL ?
Compared to REST APIs
REST GraphQL
Specifies URL structure YES NO
Specifies request /
response body structure
NO YES
Validation NO YES
Requires a declared
schema
NO YES
Key-Value friendly YES NO
Extra (non CRUD) methods
standardized
NO YES
GRAPHQL INTEGRATION
Mapping to existing stuff
13
GRAPHQL INTEGRATION
Typical architecture
Client
Server
React / React Native
Relay
GraphQL
Data & Services
14
GRAPHQL INTEGRATION
Relay
15
GRAPHQL INTEGRATION
Angular 2 and Relay
https://tech.small-improvements.com/2016/02/25/angular-2-and-relay/
16
GRAPHQL INTEGRATION
Java Libraries
• graphql-java : Java implementation of GraphQL
• graphql-java-servlet : A relay-compatible OSGI Java
servlet
• graphql-java-annotations : Can generate GraphQL
schemas from Pojo annotations !
GRAPHQL TOOLING
What there’s tooling already ?
18
GRAPHQL TOOLING
GraphiQL
19
GRAPHQL TOOLING
GraphiQL
Features
• Auto-completion based on GraphQL schema
• Execution of GraphQL queries and mutations
• Input of variables
• Result viewer
• Built-in documentation browser
20
GRAPHQL TOOLING
GraphQLHub
A hub to test public GraphQL
services such as :
• Hacker News
• Reddit
• GitHub
• Twitter
• Giphy
• Relay-compatible Key-
Value store
But (strangely) not Facebook
(probably because of API
keys)
21
GRAPHQL TOOLING
Awesome GraphQL
Best list of tools & libraries at :
https://github.com/chentsulin/awesome-graphql
Some cool examples:
SQL Libraries
• GraphpostgresQL - GraphQL for Postgres.
• sql-to-graphql - Generate a GraphQL API based on your SQL database
structure.
• PostGraphQL - A GraphQL schema created by reflection over a PostgreSQL
schema.
DX INTEGRATION DEMO
You’re not serious are you ?
23
DX INTEGRATION DEMO
The source
Project available here:
http://www.github.com/Jahia/graphql-core-feature
• Built as a Karaf features, requires DX 7.2 to run
• Embeds GraphiQL as an administration UI !
• Extensible through other modules, they simply provide query and mutation
providers !
• Dynamic schema, re-generated every time a new mutation or query provider is
registered in the OSGi services registry
• Based on the graphql-java-servlet project, available at:
http://www.github.com/graphql/graphql-java-servlet
• Still a lot to do, just beginning
• Code is clearly a proof of concept prototype, lots of things will need cleaning up
and refactoring
• Mapping to JCR content still to be defined.
24
QUESTIONS AND ANSWERS
Ask away, don’t be shy
25
shuber@jahia.com
THANK YOU FOR LISTENING

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

GraphQL
GraphQLGraphQL
GraphQL
 
Better APIs with GraphQL
Better APIs with GraphQL Better APIs with GraphQL
Better APIs with GraphQL
 
REST vs GraphQL
REST vs GraphQLREST vs GraphQL
REST vs GraphQL
 
GraphQL: Enabling a new generation of API developer tools
GraphQL: Enabling a new generation of API developer toolsGraphQL: Enabling a new generation of API developer tools
GraphQL: Enabling a new generation of API developer tools
 
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
 
How to GraphQL
How to GraphQLHow to GraphQL
How to GraphQL
 
Introduction to graphQL
Introduction to graphQLIntroduction to graphQL
Introduction to graphQL
 
GraphQL
GraphQLGraphQL
GraphQL
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
GraphQL Fundamentals
GraphQL FundamentalsGraphQL Fundamentals
GraphQL Fundamentals
 
Graphql Intro (Tutorial and Example)
Graphql Intro (Tutorial and Example)Graphql Intro (Tutorial and Example)
Graphql Intro (Tutorial and Example)
 
Graphql
GraphqlGraphql
Graphql
 
React & GraphQL
React & GraphQLReact & GraphQL
React & GraphQL
 
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
 
Getting Started with Spring for GraphQL
Getting Started with Spring for GraphQLGetting Started with Spring for GraphQL
Getting Started with Spring for GraphQL
 
Intro GraphQL
Intro GraphQLIntro GraphQL
Intro GraphQL
 
Spring GraphQL
Spring GraphQLSpring GraphQL
Spring GraphQL
 
Wroclaw GraphQL - GraphQL in Java
Wroclaw GraphQL - GraphQL in JavaWroclaw GraphQL - GraphQL in Java
Wroclaw GraphQL - GraphQL in Java
 
GraphQL vs REST
GraphQL vs RESTGraphQL vs REST
GraphQL vs REST
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 

Andere mochten auch

Andere mochten auch (9)

Jahia DX 7.2 : Bye bye felix, hello karaf
Jahia DX 7.2 : Bye bye felix, hello karafJahia DX 7.2 : Bye bye felix, hello karaf
Jahia DX 7.2 : Bye bye felix, hello karaf
 
Introducing Apache Unomi - JavaOne 2015 Session
Introducing Apache Unomi - JavaOne 2015 SessionIntroducing Apache Unomi - JavaOne 2015 Session
Introducing Apache Unomi - JavaOne 2015 Session
 
OSGi in 5 minutes
OSGi in 5 minutesOSGi in 5 minutes
OSGi in 5 minutes
 
Introducing the Jahia Log Analyzer
Introducing the Jahia Log AnalyzerIntroducing the Jahia Log Analyzer
Introducing the Jahia Log Analyzer
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
The Zero Bullshit Architecture
The Zero Bullshit ArchitectureThe Zero Bullshit Architecture
The Zero Bullshit Architecture
 
GraphQL Story: Intro To GraphQL
GraphQL Story: Intro To GraphQLGraphQL Story: Intro To GraphQL
GraphQL Story: Intro To GraphQL
 
楽天のプライベートクラウドを支えるフラッシュストレージ
楽天のプライベートクラウドを支えるフラッシュストレージ楽天のプライベートクラウドを支えるフラッシュストレージ
楽天のプライベートクラウドを支えるフラッシュストレージ
 
Java modularity: life after Java 9
Java modularity: life after Java 9Java modularity: life after Java 9
Java modularity: life after Java 9
 

Ähnlich wie GraphQL Introduction

Training Series: Build APIs with Neo4j GraphQL Library
Training Series: Build APIs with Neo4j GraphQL LibraryTraining Series: Build APIs with Neo4j GraphQL Library
Training Series: Build APIs with Neo4j GraphQL Library
Neo4j
 

Ähnlich wie GraphQL Introduction (20)

CONDG April 23 2020 - Baskar Rao - GraphQL
CONDG April 23 2020 - Baskar Rao - GraphQLCONDG April 23 2020 - Baskar Rao - GraphQL
CONDG April 23 2020 - Baskar Rao - GraphQL
 
Building Fullstack Serverless GraphQL APIs In The Cloud
Building Fullstack Serverless GraphQL APIs In The CloudBuilding Fullstack Serverless GraphQL APIs In The Cloud
Building Fullstack Serverless GraphQL APIs In The Cloud
 
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
 
Adding GraphQL to your existing architecture
Adding GraphQL to your existing architectureAdding GraphQL to your existing architecture
Adding GraphQL to your existing architecture
 
PHP, the GraphQL ecosystem and GraphQLite
PHP, the GraphQL ecosystem and GraphQLitePHP, the GraphQL ecosystem and GraphQLite
PHP, the GraphQL ecosystem and GraphQLite
 
The GraphQL Ecosystem in 2018
The GraphQL Ecosystem in 2018The GraphQL Ecosystem in 2018
The GraphQL Ecosystem in 2018
 
Kotlin REST & GraphQL API
Kotlin REST & GraphQL APIKotlin REST & GraphQL API
Kotlin REST & GraphQL API
 
Training Week: GraphQL 2022
Training Week: GraphQL 2022Training Week: GraphQL 2022
Training Week: GraphQL 2022
 
Training Series: Build APIs with Neo4j GraphQL Library
Training Series: Build APIs with Neo4j GraphQL LibraryTraining Series: Build APIs with Neo4j GraphQL Library
Training Series: Build APIs with Neo4j GraphQL Library
 
GraphQL-ify your APIs - Devoxx UK 2021
 GraphQL-ify your APIs - Devoxx UK 2021 GraphQL-ify your APIs - Devoxx UK 2021
GraphQL-ify your APIs - Devoxx UK 2021
 
Marco Liberati - Graph analytics
Marco Liberati - Graph analyticsMarco Liberati - Graph analytics
Marco Liberati - Graph analytics
 
GraphQL ♥︎ GraphDB
GraphQL ♥︎ GraphDBGraphQL ♥︎ GraphDB
GraphQL ♥︎ GraphDB
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
GraphQL + relay
GraphQL + relayGraphQL + relay
GraphQL + relay
 
Create GraphQL server with apolloJS
Create GraphQL server with apolloJSCreate GraphQL server with apolloJS
Create GraphQL server with apolloJS
 
Graph ql and enterprise
Graph ql and enterpriseGraph ql and enterprise
Graph ql and enterprise
 
Modular GraphQL with Schema Stitching
Modular GraphQL with Schema StitchingModular GraphQL with Schema Stitching
Modular GraphQL with Schema Stitching
 
Implementing OpenAPI and GraphQL services with gRPC
Implementing OpenAPI and GraphQL services with gRPCImplementing OpenAPI and GraphQL services with gRPC
Implementing OpenAPI and GraphQL services with gRPC
 
GraphQL-ify your APIs
GraphQL-ify your APIsGraphQL-ify your APIs
GraphQL-ify your APIs
 
GraphQL Bangkok meetup 5.0
GraphQL Bangkok meetup 5.0GraphQL Bangkok meetup 5.0
GraphQL Bangkok meetup 5.0
 

Mehr von Serge Huber

Mehr von Serge Huber (8)

ApacheCon NA 2019 : Adding AI to customer segmentation using Apache Unomi and...
ApacheCon NA 2019 : Adding AI to customer segmentation using Apache Unomi and...ApacheCon NA 2019 : Adding AI to customer segmentation using Apache Unomi and...
ApacheCon NA 2019 : Adding AI to customer segmentation using Apache Unomi and...
 
ApacheCon NA 2019 : Customer segmentation and personalization using apache unomi
ApacheCon NA 2019 : Customer segmentation and personalization using apache unomiApacheCon NA 2019 : Customer segmentation and personalization using apache unomi
ApacheCon NA 2019 : Customer segmentation and personalization using apache unomi
 
ApacheCon NA 2018 : Apache Unomi, an Open Source Customer Data Platformapache...
ApacheCon NA 2018 : Apache Unomi, an Open Source Customer Data Platformapache...ApacheCon NA 2018 : Apache Unomi, an Open Source Customer Data Platformapache...
ApacheCon NA 2018 : Apache Unomi, an Open Source Customer Data Platformapache...
 
DEVOXX FR 2016 We're Watching You (Apache Unomi)
DEVOXX FR 2016 We're Watching You (Apache Unomi)DEVOXX FR 2016 We're Watching You (Apache Unomi)
DEVOXX FR 2016 We're Watching You (Apache Unomi)
 
UXDev Summit Keynote : A real world story of Angular and Apache Unomi integra...
UXDev Summit Keynote : A real world story of Angular and Apache Unomi integra...UXDev Summit Keynote : A real world story of Angular and Apache Unomi integra...
UXDev Summit Keynote : A real world story of Angular and Apache Unomi integra...
 
Apache Unomi In Depth - ApacheCon EU 2015 Session
Apache Unomi In Depth - ApacheCon EU 2015 SessionApache Unomi In Depth - ApacheCon EU 2015 Session
Apache Unomi In Depth - ApacheCon EU 2015 Session
 
Webinar Présentation jahia en collaboration avec Developpez.com
Webinar Présentation jahia en collaboration avec Developpez.comWebinar Présentation jahia en collaboration avec Developpez.com
Webinar Présentation jahia en collaboration avec Developpez.com
 
Portets to composite applications
Portets to composite applicationsPortets to composite applications
Portets to composite applications
 

Kürzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Kürzlich hochgeladen (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 

GraphQL Introduction

  • 1. 1 GraphQL Introduction Serge Huber, Jahia CTO shuber@jahia.com #graphql Make some noise
  • 2. WHAT IS GRAPHQL ? …and what it isn’t.
  • 3. 3 WHAT IS GRAPHQL ? I like opposites It is not: • A query language like SQL, JCR-SQL, etc… • A URL specification • A finalized standard • A standard submitted to a standards body • A 100% JSON standard • A mature standard, changes are still happening
  • 4. 4 WHAT IS GRAPHQL ? A (very) quick look Courtesy of the GraphQL.org home page
  • 5. 5 WHAT IS GRAPHQL ? Some users Courtesy of the GraphQL.org home page See more on http://graphql.org/users
  • 6. 6 WHAT IS GRAPHQL ? A quick demo https://www.graphqlhub.com
  • 7. 7 WHAT IS GRAPHQL ? Schemas • A schema that describes: • Objects • Object fields • Field arguments & directives • Interfaces • Unions
  • 8. 8 WHAT IS GRAPHQL ? Fields, the key to understanding GraphQL ! A field may be: • a static value • a value resolved through code Field may have: • Arguments that are like parameters to a method call • Constraints to filter data • Directives that make the field conditional in the result Don’t think of fields as variables, think of them as methods !
  • 9. 9 WHAT IS GRAPHQL ? Queries • Queries • Specify what fields are part of the result • Only fields specified in the schema are acceptable • Field may be the result of computations • Fields may specify arguments that will constrain the results (such as id:10) • Directives may also be used (such as @include) • Variables may be used • Fragments • Type casts ! • Pagination (Relay schema)
  • 10. 10 WHAT IS GRAPHQL ? Mutations • Mutations • Make it possible to write/modify data • Very similar syntax to queries
  • 11. 11 WHAT IS GRAPHQL ? Compared to REST APIs REST GraphQL Specifies URL structure YES NO Specifies request / response body structure NO YES Validation NO YES Requires a declared schema NO YES Key-Value friendly YES NO Extra (non CRUD) methods standardized NO YES
  • 13. 13 GRAPHQL INTEGRATION Typical architecture Client Server React / React Native Relay GraphQL Data & Services
  • 15. 15 GRAPHQL INTEGRATION Angular 2 and Relay https://tech.small-improvements.com/2016/02/25/angular-2-and-relay/
  • 16. 16 GRAPHQL INTEGRATION Java Libraries • graphql-java : Java implementation of GraphQL • graphql-java-servlet : A relay-compatible OSGI Java servlet • graphql-java-annotations : Can generate GraphQL schemas from Pojo annotations !
  • 17. GRAPHQL TOOLING What there’s tooling already ?
  • 19. 19 GRAPHQL TOOLING GraphiQL Features • Auto-completion based on GraphQL schema • Execution of GraphQL queries and mutations • Input of variables • Result viewer • Built-in documentation browser
  • 20. 20 GRAPHQL TOOLING GraphQLHub A hub to test public GraphQL services such as : • Hacker News • Reddit • GitHub • Twitter • Giphy • Relay-compatible Key- Value store But (strangely) not Facebook (probably because of API keys)
  • 21. 21 GRAPHQL TOOLING Awesome GraphQL Best list of tools & libraries at : https://github.com/chentsulin/awesome-graphql Some cool examples: SQL Libraries • GraphpostgresQL - GraphQL for Postgres. • sql-to-graphql - Generate a GraphQL API based on your SQL database structure. • PostGraphQL - A GraphQL schema created by reflection over a PostgreSQL schema.
  • 22. DX INTEGRATION DEMO You’re not serious are you ?
  • 23. 23 DX INTEGRATION DEMO The source Project available here: http://www.github.com/Jahia/graphql-core-feature • Built as a Karaf features, requires DX 7.2 to run • Embeds GraphiQL as an administration UI ! • Extensible through other modules, they simply provide query and mutation providers ! • Dynamic schema, re-generated every time a new mutation or query provider is registered in the OSGi services registry • Based on the graphql-java-servlet project, available at: http://www.github.com/graphql/graphql-java-servlet • Still a lot to do, just beginning • Code is clearly a proof of concept prototype, lots of things will need cleaning up and refactoring • Mapping to JCR content still to be defined.
  • 24. 24 QUESTIONS AND ANSWERS Ask away, don’t be shy