SlideShare a Scribd company logo
GraphQL-ify your APIs
Soham Dasgupta
Soham Dasgupta
• Father, Husband and Football lover
• Capgemini Netherlands
• Oracle ACE
• Tech Enthusiast/Programmer/Architect
• Speaker & Blogger
• Twitter : @iamsoham
• LinkedIn: dasguptasoham
• Github: sohamda
• Medium: @iam.soham
Who am I?
What’s in store today
GraphQL
What
Queries & Mutation
Schemas & Types
Show me some code
graphql-java
graphql-java-kickstart
graphql-dgs-framework
What’s better
Implementation easiness – code,
generation, error handling, testing,
clients
N+1 problem
Memory footprint
GraphQL is a query language for your API, and a
server-side runtime for executing queries.
Backed by your existing code and data.
It was designed by Facebook to get around
common constraints in fetching data via REST.
It was open sourced by Facebook in 2015.
Nothing to do with Graph DB.
Not a replacement of REST.
Not going to magically solve every API design
issues.
What’s GraphQL
Schema Query Results
Schema , Query & Results
GraphQL provides description of the data in your API, gives clients the power to ask for exactly
what they need.
https://landscape.graphql.org/card-mode?category=graph-ql-adopter&grouping=category&style=borderless
Who is using it ?
GraphQL vs REST API vs SOAP
https://trends.google.com/trends/explore?date=today%205-y&q=%2Fg%2F11cn3w0w9t,REST%20API,%2Fm%2F077dn
Hierarchical & Aggregator Strongly Typed
Validation & Type check
out-of-the-box
API evolution without
versioning
GraphQL
Characteristics
Query & Mutation
• Ask what you need.
• Expand the same
query.
• Send arguments.
• Use Aliases, Fragment
Schemas & Types
• GraphQL schema language -
allows us to talk about
GraphQL schemas in a
language-agnostic way.
• Scalar : Int, String, Boolean, ID,
Float
• Lists & Non-Null
• Union, Interfaces, Input Types
N+1 queries Caching complexity
Community presence File Upload
GraphQL
Maturity
Show me some code
graphql-java
graphql-java-kickstart
graphql-dgs-framework
https://github.com/sohamda/serivce-repository-swagger
graphql-java https://www.graphql-java.com/documentation/v17/
https://github.com/graphql-java - Version 17.3 : Last updated on Sep’21
https://github.com/graphql-java/graphql-java-spring
https://github.com/sohamda/graphql-java
graphql-java- kickstart https://graphql-java-kickstart.com/
https://github.com/graphql-java-kickstart
Version 12 : Last updated on Sep’21
https://github.com/sohamda/graphql-java-kickstart
dgs-framework
https://netflix.github.io/dgs/
https://github.com/Netflix/dgs-framework
Version 4.9.2 : Last updated on Oct’21
https://github.com/sohamda/graphql-dgs-netflix
What’s better
Implementation easiness – code, generation, error
handling, testing, clients
N+1 problem
Memory footprint
DataFetchers
graphql-java
Piece of code that fetches the data
graphql-java-kickstart dgs
1. Define a @Component which
defines datafetching methods.
2. Register them in while
building/parsing the schema
1. Define @Component which
implements
GraphQLQueryResolver.
2. For field-level define a
@Component which
implements
GraphQLResolver<T>.
1. Define a @DgsComponent.
2. Map the schema operations
with @DgsData
DataLoaders
graphql-java
Piece of code that is responsible for N+1 query issue
graphql-java-kickstart dgs
1. Define a BatchLoader which
return s a CompletableFuture.
2. Define a DataLoaderRegistry
@Bean which registers the
Loader.
3. Define a DataFetcher using
that Loader.
1. Define @Component which
defines a loader and adds it to
the registry.
2. Define a @Component which
implements
GraphQLServletContextBuild
er and associate the registry.
1. Define a @DgsDataLoader.
2. Map the schema operations
with @DgsData
Mutations
graphql-java
Piece of code that persist the data
graphql-java-kickstart dgs
1. Define a @Component which
defines datafetching methods.
2. Register them in while
building/parsing the schema
• Define @Component which
implements
GraphQLMutationResolver.
1. Define a @DgsComponent.
2. Map the schema operations
with @DgsData
Error Handling
graphql-java
Piece of code that handles exceptions/errors
graphql-java-kickstart dgs
Implement GraphQLError 1. Enable ExceptionHandler
property and handle
them in a Spring way.
2. Implement
GraphQLErrorHandler
and manage the errors in
overridden method.
Define a @Component which
implements
DataFetcherExceptionHandle
r
Client
graphql-java
How to call a GraphQL API
graphql-java-kickstart dgs
1. No defined way.
2. Needs text templates to
generate requests.
1. Gives a Webclient library.
2. Needs text templates to
generate requests.
1. GraphQLClient uses String as
query which is same as the
previous two.
2. Code generation using
Gradle/Maven. This is the type-
safe option.
Testing
graphql-java
How to test your code
graphql-java-kickstart dgs
1. No defined way.
2. Only can test the service-repo
layer.
1. No defined way.
2. Only can test the service-repo
layer.
1. Code generation using Gradle.
This is the type-safe option.
2. Use the generated classes to
build request and test using
DgsAutoConfiguration class.
graphql-java graphql-java-kickstart dgs
1. No defined way. 1. No defined way. 1. Code generation using
Gradle/Maven.
Code Generation
Runtime memory & Image Size
Final Words
graphql-java graphql-java-kickstart dgs-framework
• Is there since long, so evolved
and matured.
• A lot of Boilerplate code just
to write a simple API.
• Need extra library to work in
Springboot. With other Java
• Not a easy way to Unit Test
everything you write.
• No Clients avaiable. Need to
use text templates to create
queries.
• Looks very matured but
missing extended
documentation.
• Still a bit of Boilerplate code.
• Directly usable within
Springboot. Although other
modules available to work on
Java only environments.
• Not a easy way to UT
everything you write.
• Basic Client avaiable.
• Not sure about maturity, but
Netflix is behind this, so faith
is there.
• No Boilerplate code.
• Directly usable within
Springboot.
• You can UT everything you
write.
• Client avaiable.
• Code generation using
Gradle/Maven.
https://medium.com/springboot-chronicles/graphql-in-springboot-a-comparative-study-
among-the-libraries-and-their-implementation-know-how-b0e8d544f2fc
This presentation contains information that may be privileged or confidential and
is the property of the Capgemini Group.
Copyright © 2021 Capgemini. All rights reserved.
Capgemini is a global leader in partnering with companies to transform and manage their
business by harnessing the power of technology. The Group is guided everyday by its
purpose of unleashing human energy through technology for an inclusive and sustainable
future. It is a responsible and diverse organization of 270,000 team members in nearly 50
countries. With its strong 50 year heritage and deep industry expertise, Capgemini is
trusted by its clients to address the entire breadth of their business needs, from strategy
and design to operations, fuelled by the fast evolving and innovative world of cloud, data,
AI, connectivity, software, digital engineering and platforms. The Group reported in 2020
global revenues of €16 billion.
About Capgemini
Get the Future You Want | www.capgemini.com

More Related Content

PPTX
GraphQL-ify your APIs
PPTX
Taking Control of your Data with GraphQL
PDF
GraphQL in an Age of REST
PDF
Enterprise build tool gradle
PDF
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
PDF
Meteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern Apps
PDF
Real-time GraphQL API with minimum coding and maximum benefit
PPTX
GraphQL Introduction
GraphQL-ify your APIs
Taking Control of your Data with GraphQL
GraphQL in an Age of REST
Enterprise build tool gradle
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
Meteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern Apps
Real-time GraphQL API with minimum coding and maximum benefit
GraphQL Introduction

What's hot (20)

PPTX
Azure DevOps for the Data Professional
PDF
Building the Web with Gradle
PPTX
Making Angular2 lean and Fast
PDF
London React August - GraphQL at The Financial Times - Viktor Charypar
PDF
Boost your APIs with GraphQL 1.0
PDF
Boost your API with GraphQL
PDF
Kafka and GraphQL: Misconceptions and Connections | Gerard Klijs, Open Web
PPTX
Neo4J and Grails
PPT
Introduction to Grails
PPTX
Gradle build capabilities
PDF
Gradle(the innovation continues)
PDF
Angular vs React - Devoxx BE 2017
PDF
What's new in Gradle 4.0
PPTX
PDF
Enterprise graph applications
PDF
The Apollo and GraphQL Stack
PDF
Continuous integration and delivery for java based web applications
PDF
Gradle by Example
PDF
The Graph-Native Advantage
KEY
Enterprise Architectures with Ruby (and Rails)
Azure DevOps for the Data Professional
Building the Web with Gradle
Making Angular2 lean and Fast
London React August - GraphQL at The Financial Times - Viktor Charypar
Boost your APIs with GraphQL 1.0
Boost your API with GraphQL
Kafka and GraphQL: Misconceptions and Connections | Gerard Klijs, Open Web
Neo4J and Grails
Introduction to Grails
Gradle build capabilities
Gradle(the innovation continues)
Angular vs React - Devoxx BE 2017
What's new in Gradle 4.0
Enterprise graph applications
The Apollo and GraphQL Stack
Continuous integration and delivery for java based web applications
Gradle by Example
The Graph-Native Advantage
Enterprise Architectures with Ruby (and Rails)
Ad

Similar to GraphQL-ify your APIs - Devoxx UK 2021 (20)

PPTX
GraphQL_devoxx_2023.pptx
PDF
GraphQL-ify your API - JFall 2022
PDF
GraphQL-ify your APIs
PPTX
GraphQL.net
PDF
Spring GraphQL
PPT
Graphql presentation
PDF
Adding GraphQL to your existing architecture
PDF
apidays LIVE Paris - GraphQL meshes by Jens Neuse
PDF
Sashko Stubailo - The GraphQL and Apollo Stack: connecting everything together
PPTX
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
PDF
GraphQL over REST at Reactathon 2018
PDF
Implementing OpenAPI and GraphQL services with gRPC
PDF
GraphQL across the stack: How everything fits together
PDF
Boost your APIs with GraphQL
PPTX
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
PPTX
Introduction to Testing GraphQL Presentation
PPTX
Testing Graph QL Presentation (Test Automation)
PPTX
Create GraphQL server with apolloJS
PDF
React and GraphQL at Stripe
PDF
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
GraphQL_devoxx_2023.pptx
GraphQL-ify your API - JFall 2022
GraphQL-ify your APIs
GraphQL.net
Spring GraphQL
Graphql presentation
Adding GraphQL to your existing architecture
apidays LIVE Paris - GraphQL meshes by Jens Neuse
Sashko Stubailo - The GraphQL and Apollo Stack: connecting everything together
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
GraphQL over REST at Reactathon 2018
Implementing OpenAPI and GraphQL services with gRPC
GraphQL across the stack: How everything fits together
Boost your APIs with GraphQL
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
Introduction to Testing GraphQL Presentation
Testing Graph QL Presentation (Test Automation)
Create GraphQL server with apolloJS
React and GraphQL at Stripe
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
Ad

More from Soham Dasgupta (6)

PPTX
Are you testing your unit tests?
PPTX
Spring Native : Why not YET!
PPTX
OneBot: A Comprehensive Case Study on Enterprise Digital Assistants
PPTX
No-Java Enterprise Applications: It’s All About JavaScript [DEV5107]
PDF
Javascript for Enterprise Application
PPTX
How the Dutch Police became “Chatbot” interactive
Are you testing your unit tests?
Spring Native : Why not YET!
OneBot: A Comprehensive Case Study on Enterprise Digital Assistants
No-Java Enterprise Applications: It’s All About JavaScript [DEV5107]
Javascript for Enterprise Application
How the Dutch Police became “Chatbot” interactive

Recently uploaded (20)

PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
cuic standard and advanced reporting.pdf
PDF
Encapsulation theory and applications.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
Spectroscopy.pptx food analysis technology
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPT
Teaching material agriculture food technology
PDF
Machine learning based COVID-19 study performance prediction
Digital-Transformation-Roadmap-for-Companies.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
NewMind AI Weekly Chronicles - August'25 Week I
MIND Revenue Release Quarter 2 2025 Press Release
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Empathic Computing: Creating Shared Understanding
Per capita expenditure prediction using model stacking based on satellite ima...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Chapter 3 Spatial Domain Image Processing.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Review of recent advances in non-invasive hemoglobin estimation
Understanding_Digital_Forensics_Presentation.pptx
cuic standard and advanced reporting.pdf
Encapsulation theory and applications.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Spectroscopy.pptx food analysis technology
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Teaching material agriculture food technology
Machine learning based COVID-19 study performance prediction

GraphQL-ify your APIs - Devoxx UK 2021

  • 2. Soham Dasgupta • Father, Husband and Football lover • Capgemini Netherlands • Oracle ACE • Tech Enthusiast/Programmer/Architect • Speaker & Blogger • Twitter : @iamsoham • LinkedIn: dasguptasoham • Github: sohamda • Medium: @iam.soham Who am I?
  • 3. What’s in store today GraphQL What Queries & Mutation Schemas & Types Show me some code graphql-java graphql-java-kickstart graphql-dgs-framework What’s better Implementation easiness – code, generation, error handling, testing, clients N+1 problem Memory footprint
  • 4. GraphQL is a query language for your API, and a server-side runtime for executing queries. Backed by your existing code and data. It was designed by Facebook to get around common constraints in fetching data via REST. It was open sourced by Facebook in 2015. Nothing to do with Graph DB. Not a replacement of REST. Not going to magically solve every API design issues. What’s GraphQL
  • 5. Schema Query Results Schema , Query & Results GraphQL provides description of the data in your API, gives clients the power to ask for exactly what they need.
  • 7. GraphQL vs REST API vs SOAP https://trends.google.com/trends/explore?date=today%205-y&q=%2Fg%2F11cn3w0w9t,REST%20API,%2Fm%2F077dn
  • 8. Hierarchical & Aggregator Strongly Typed Validation & Type check out-of-the-box API evolution without versioning GraphQL Characteristics
  • 9. Query & Mutation • Ask what you need. • Expand the same query. • Send arguments. • Use Aliases, Fragment Schemas & Types • GraphQL schema language - allows us to talk about GraphQL schemas in a language-agnostic way. • Scalar : Int, String, Boolean, ID, Float • Lists & Non-Null • Union, Interfaces, Input Types
  • 10. N+1 queries Caching complexity Community presence File Upload GraphQL Maturity
  • 11. Show me some code graphql-java graphql-java-kickstart graphql-dgs-framework
  • 13. graphql-java https://www.graphql-java.com/documentation/v17/ https://github.com/graphql-java - Version 17.3 : Last updated on Sep’21 https://github.com/graphql-java/graphql-java-spring
  • 19. What’s better Implementation easiness – code, generation, error handling, testing, clients N+1 problem Memory footprint
  • 20. DataFetchers graphql-java Piece of code that fetches the data graphql-java-kickstart dgs 1. Define a @Component which defines datafetching methods. 2. Register them in while building/parsing the schema 1. Define @Component which implements GraphQLQueryResolver. 2. For field-level define a @Component which implements GraphQLResolver<T>. 1. Define a @DgsComponent. 2. Map the schema operations with @DgsData
  • 21. DataLoaders graphql-java Piece of code that is responsible for N+1 query issue graphql-java-kickstart dgs 1. Define a BatchLoader which return s a CompletableFuture. 2. Define a DataLoaderRegistry @Bean which registers the Loader. 3. Define a DataFetcher using that Loader. 1. Define @Component which defines a loader and adds it to the registry. 2. Define a @Component which implements GraphQLServletContextBuild er and associate the registry. 1. Define a @DgsDataLoader. 2. Map the schema operations with @DgsData
  • 22. Mutations graphql-java Piece of code that persist the data graphql-java-kickstart dgs 1. Define a @Component which defines datafetching methods. 2. Register them in while building/parsing the schema • Define @Component which implements GraphQLMutationResolver. 1. Define a @DgsComponent. 2. Map the schema operations with @DgsData
  • 23. Error Handling graphql-java Piece of code that handles exceptions/errors graphql-java-kickstart dgs Implement GraphQLError 1. Enable ExceptionHandler property and handle them in a Spring way. 2. Implement GraphQLErrorHandler and manage the errors in overridden method. Define a @Component which implements DataFetcherExceptionHandle r
  • 24. Client graphql-java How to call a GraphQL API graphql-java-kickstart dgs 1. No defined way. 2. Needs text templates to generate requests. 1. Gives a Webclient library. 2. Needs text templates to generate requests. 1. GraphQLClient uses String as query which is same as the previous two. 2. Code generation using Gradle/Maven. This is the type- safe option.
  • 25. Testing graphql-java How to test your code graphql-java-kickstart dgs 1. No defined way. 2. Only can test the service-repo layer. 1. No defined way. 2. Only can test the service-repo layer. 1. Code generation using Gradle. This is the type-safe option. 2. Use the generated classes to build request and test using DgsAutoConfiguration class. graphql-java graphql-java-kickstart dgs 1. No defined way. 1. No defined way. 1. Code generation using Gradle/Maven. Code Generation
  • 26. Runtime memory & Image Size
  • 27. Final Words graphql-java graphql-java-kickstart dgs-framework • Is there since long, so evolved and matured. • A lot of Boilerplate code just to write a simple API. • Need extra library to work in Springboot. With other Java • Not a easy way to Unit Test everything you write. • No Clients avaiable. Need to use text templates to create queries. • Looks very matured but missing extended documentation. • Still a bit of Boilerplate code. • Directly usable within Springboot. Although other modules available to work on Java only environments. • Not a easy way to UT everything you write. • Basic Client avaiable. • Not sure about maturity, but Netflix is behind this, so faith is there. • No Boilerplate code. • Directly usable within Springboot. • You can UT everything you write. • Client avaiable. • Code generation using Gradle/Maven. https://medium.com/springboot-chronicles/graphql-in-springboot-a-comparative-study- among-the-libraries-and-their-implementation-know-how-b0e8d544f2fc
  • 28. This presentation contains information that may be privileged or confidential and is the property of the Capgemini Group. Copyright © 2021 Capgemini. All rights reserved. Capgemini is a global leader in partnering with companies to transform and manage their business by harnessing the power of technology. The Group is guided everyday by its purpose of unleashing human energy through technology for an inclusive and sustainable future. It is a responsible and diverse organization of 270,000 team members in nearly 50 countries. With its strong 50 year heritage and deep industry expertise, Capgemini is trusted by its clients to address the entire breadth of their business needs, from strategy and design to operations, fuelled by the fast evolving and innovative world of cloud, data, AI, connectivity, software, digital engineering and platforms. The Group reported in 2020 global revenues of €16 billion. About Capgemini Get the Future You Want | www.capgemini.com

Editor's Notes

  • #12: Who coded graphQL
  • #21: Some people call them resolvers as well.
  • #22: Or MapLoader. : is
  • #23: Some people call them resolvers as well.
  • #24: Or MapLoader. : is
  • #25: Or MapLoader. : is
  • #26: Or MapLoader. : is
  • #27: Or MapLoader. : is
  • #28: Or MapLoader. : is