- GraphQL is an alternative to REST APIs that allows clients to specify exactly what data they need from the server in a single request.
- With REST, multiple roundtrips are often needed to fetch nested or related data, but GraphQL allows fetching this data in one request.
- The document discusses implementing GraphQL APIs with Java, including defining the schema, writing data fetchers, and supporting queries, mutations, and other GraphQL features. It also covers lessons learned about understanding abstractions and updating libraries.
GraphQL - when REST API is to less - lessons learnedMarcinStachniuk
We all know the REST architectural style to define a good API for your applications. However, REST has its disadvantages and constraints. That’s why Facebook developed GraphQL as an alternative.
In my talk, I will present you some REST constraints and how GraphQL solves them. I will talk about how we implemented GraphQL in our application and why.
Get to know our successes… and failures from the first row.
BruJUG Brussels GraphQL when RESR API is to less - lessons learnedMarcinStachniuk
We all know the REST architectural style to define a good API for your applications. However, REST has its disadvantages and constraints. That’s why Facebook developed GraphQL as an alternative.
In my talk, I will present you some REST constraints and how GraphQL solves them. I will talk about how we implemented GraphQL in our application and why.
Get to know our successes… and failures from the first row.
[DevCrowd] GraphQL - gdy API RESTowe to za małoMarcinStachniuk
Slajdy z konferencji DevCrowd
Wszyscy znamy architekturę REST do definiowania API naszych aplikacji. Jednak REST ma swoje wady i ograniczenia. To dlatego Facebook stworzył GraphQL jako alternatywę. W mojej prezentacji przedstawię ograniczenia RESTa i jak je rozwiązuje GraphQL. Pokażę składnię, zalety jak i wady. Będzie też o tym jak zaimplementować GraphQL w Javie oraz co jeszcze warto o nim wiedzieć.
Slajdy z konferencji Confitura 2019.
Wszyscy znamy podejście REST do definiowania API naszych aplikacji. Jednak REST ma swoje wady i ograniczenia. To dla tego Facebook stworzył GraphQL jako alternatywę. W mojej prezentacji przedstawię ograniczenia RESTa i jak je rozwiązuje GraphQL. Pokażę składnię, zalety jak i wady. Będzie też jak zaimplementować GraphQL w Javie oraz co jeszcze warto o nim wiedzieć.
GraphQL - when REST API is to less - lessons learnedMarcinStachniuk
This document discusses a presentation about GraphQL and lessons learned from implementing GraphQL APIs. The presentation covers why GraphQL is useful compared to REST APIs, GraphQL concepts like queries and mutations, and examples of implementing GraphQL in Java. It also discusses challenges with REST APIs like over-fetching data, rigid contracts that don't adapt to different clients, and challenges with API versioning.
GraphQL - when REST API is to less - lessons learnedMarcinStachniuk
This document discusses a presentation about GraphQL and lessons learned from implementing GraphQL APIs. The presentation covers why GraphQL is useful when REST APIs are insufficient, including issues with rigid REST contracts, overfetching and underfetching data, and supporting multiple client needs. It also provides examples of GraphQL concepts like queries, mutations, fragments, and demonstrates GraphQL in Java. The presentation aims to convey lessons learned from building GraphQL APIs.
Hypermedia APIs and HATEOAS / Wix EngineeringVladimir Tsukur
The document discusses hypermedia APIs and the Richardson Maturity Model. It provides examples of different levels of hypermedia support, including link semantics, link outbound relations, embedded links, templated queries, non-idempotent updates, and more. It also covers choosing an appropriate media type like JSON-LD, JSON API or HAL and implementing hypermedia controls, profiles and documentation.
The document summarizes a presentation about evolving a CRUD API to a hypermedia API. It discusses moving from basic CRUD endpoints to including business logic and hyperlinks in responses to drive the API workflow. Examples show adding links for publishing and expiring ads and evolving responses to include hypermedia links for available actions. The presentation emphasizes implementing this evolution using Spring projects like Spring Data REST, Spring HATEOAS and Spring REST Docs.
Vladimir Tsukur presented on hypermedia APIs and HATEOAS. He discussed REST, the Richardson Maturity Model, CRUD vs more advanced APIs, and link relations. He demonstrated Mason, a proposed hypermedia format that uses controls and namespaces to define available state transitions and link semantics.
"From CRUD to Hypermedia APIs with Spring" Владимир ЦукурFwdays
Typical way to design and expose HTTP API today is a so called CRUD approach: come up with URL templates for resources, map create-read-update-delete operations to HTTP verbs and serialize domain model as JSON. Nice and easy, isn't it?
This talk will present limitations of CRUD style APIs and how to address them using "real" REST and hypermedia, HAL and ALPS.
We'll take a look how a set of libraries and tools from Spring helps building these APIs.
All the talking is not worth it without an example, so Spring-based application will be our guide. Amazon, PayPal, GitHub and other API providers have already started embracing hypermedia and linking by enhancing their HTTP interfaces.
Are you next?
The document discusses the development of a web and mobile app called "Tech Comm on a Map" that maps events and resources related to technical communication. Key points:
- The app allows users to contribute tech comm events and resources through a web form or Android app, which are stored in a Google Sheet and displayed on an interactive map using the Google Maps API.
- The web app was created using HTML, CSS, JavaScript and jQuery. Data is retrieved from Google Sheets using Apps Script.
- An Android version was also developed using Java and the Google Maps Android API to make the map accessible on mobile.
- The project is open source on GitHub and the developer discusses lessons learned around community collaboration and
Typical way to design and expose HTTP API today is a so called CRUD approach: come up with URL templates for resources, map create-read-update-delete operations to HTTP verbs and serialize domain model as JSON. This approach is nice and easy, but has its limitations.
During this presentation we'll create an application enhancing its primitive CRUD API all the way to modern, business-centric hypermedia style API using a set of tools from Spring, namely Spring Boot, Spring Data REST, Spring HATEOAS and Spring REST Docs!
Deliver Business Value Faster with AWS Step FunctionsDaniel Zivkovic
Step Functions provides a visual workflow orchestration service that allows you to model workflows as state machines. It executes tasks and coordinates work across AWS services like Lambda, DynamoDB, and SQS. Step Functions is useful for coordinating complex multi-step workflows, parallel processing, and dynamic branching logic. It costs $25 per million state transitions, which is significantly cheaper than coordinating workflows solely with Lambda functions.
Designing and building RESTful APIs isn’t easy. On its surface, it may seem simple – after all, we’re only marshaling JSON back and forth over HTTP right? However, that’s only a small part of the equation. There are many things to keep in mind while building the systems that act as the key to your system.
In this session, we’ll delve into several best practices to keep in mind when designing your RESTful API. We’ll discuss authentication, versioning, controller/model design, and testability. We’ll also explore the do’s and don’t’s of RESTful API management so that you make sure your APIs are simple, consistent, and easy-to-use. Finally, we’ll discuss the importance of documentation and change management. The session will show examples using ASP.NET Web API and C#. However, this session will benefit anyone who is or might be working on a RESTful API.
This document provides an overview of GraphQL, comparing it to REST. It discusses how GraphQL allows clients to query exactly what data they need from an API using a type system and query language. It also covers some key GraphQL concepts like object types, queries, enumerations, union types, and interfaces. The document notes that GraphQL performance depends on the underlying data sources and the speed of your slowest resource. It raises some additional topics like file uploads, caching, mutations, and subscriptions with GraphQL.
The document discusses building valuable RESTful APIs. It covers defining value through business models like freemium and subscription. It also discusses design best practices, including using HTTP verbs and status codes, resources, hypermedia controls, authentication, pagination, versioning, and error handling. The goal is to build APIs that are easy to use and provide value to both businesses and developers.
An API isn't stronger than its weakest link and what’s often ignored in the ongoing maintenance and development of an API is the constant effort required to provide great self-servicable error messages. What this means is that without great, user-friendly error messages, your API is not going to be great.
Just think about your first interaction with an API. How many failing requests have you sent before you have dug yourself through swathes of error messages and documentation to get to that one penultimate successful request making your heart sing and fists shaking in the air?
Great error messages make them not feel like errors, but like friendly guidance towards a working request. They should be detailed enough to let the developer fix whatever problem there is themselves, like a dialogue between a customer and a support technician.
This talk will give you ideas of how to handle errors and exceptions that occur in your application, be it with the incoming request, database failures or errors received from a 3rd party and how to serialize them into user friendly and actionable problem messages.
The document discusses eHarmony's plans to migrate their iOS app from Objective-C to Swift. It provides an overview of eHarmony as a company that has successfully matched over 565,000 couples using a scientific matching system. It then discusses Swift features like protocol extensions, error handling, and nullability that improve code safety. Finally, it outlines eHarmony's plan to tackle the migration through modernizing Objective-C code, generating bridging headers, and incrementally migrating parts of the app to Swift.
GraphQL - when REST API is to less - lessons learnedMarcinStachniuk
This document discusses the limitations of REST APIs and how GraphQL addresses those limitations. It begins with examples of how REST APIs can result in underfetching or overfetching data and require multiple roundtrips. It then covers how GraphQL allows clients to specify exactly what data they need in a single request. The document also provides examples of GraphQL queries, mutations, variables, fragments and aliases that simplify data fetching compared to REST APIs.
GraphQL - when REST API is to less - lessons learnedMarcinStachniuk
This document discusses the limitations of REST APIs and how GraphQL addresses those limitations. It begins with examples of how REST APIs can result in underfetching or overfetching data and require multiple roundtrips. It then demonstrates how GraphQL allows clients to specify exactly what data they need in a single request. The document also shows how GraphQL is better suited to the needs of different clients compared to rigid REST APIs. Finally, it provides examples of GraphQL queries and mutations.
GraphQL - when REST API is not enough - lessons learnedMarcinStachniuk
This document discusses lessons learned from implementing GraphQL APIs. It begins by describing some limitations of REST APIs, such as requiring multiple roundtrips to fetch nested data. GraphQL is introduced as an alternative that allows clients to specify exactly what data they need in a single request. The document then covers various GraphQL concepts like queries, mutations, and type systems. It also discusses best practices like using a schema-first approach, pagination support, and the DataLoader library to solve the N+1 problem. Testing GraphQL APIs and integrating with Relay are also briefly outlined. The overall message is that GraphQL is a good alternative to REST when clients have complex data needs.
GraphQL - Piękne API w Twojej Aplikacji - KrakowGraphAcademyMarcinStachniuk
Wszyscy znamy i tworzymy API RESTowe. Jednak to podejście ma swoje wady i ograniczenia. Dlatego Facebook stworzył GraphQL jako alternatywę. W mojej prezentacji przedstawię problemy RESTa oraz jak je rozwiązuje GraphQL. Pokażę składnię, jak projektować takie API oraz zalety i wady.
JavaOne Brasil 2016: JavaEE e HTML5: da web/desktop ao mobileLoiane Groner
This document discusses using Java and HTML5 platforms for desktop, web, and mobile applications. It covers key technologies like JSON, WebSockets, RESTful web services, and frameworks like Angular and Sencha. It also provides examples of building applications with these technologies, including a contacts app example in Java EE and Angular.
How to Leverage APIs for SEO #TTTLive2019Paul Shapiro
Learn the basic of APIs and how they can be leveraged for SEO and marketing. Chalk full of Python code examples.
The URL to the GitHub gist link on slide 54 has changed to the following:
https://gist.github.com/pshapiro/a86dc340f57c38fc22d0545ddec1fc9e
The document summarizes announcements about new features and changes to MercadoLibre's API. It discusses improvements to item validation, listing types, addresses API, feedback API, trends API, classifieds locations, contacts API, and promotion packs. It also notes new forums and subscription options on the developer platform to stay updated on API changes and events.
LINE Shopping provides an e-commerce platform in Taiwan. It has over 9 million monthly visitors, a 40% repurchase rate, and lists over 26 million products from over 1,300 brands. The document discusses how to test the LINE Shopping platform, including unit, API, and UI tests. It also describes tools like Just-API and Pyresttest that can be used to test GraphQL and REST APIs respectively using YAML configuration files.
David Gómez G. - Hypermedia APIs for headless platforms and Data Integration ...Codemotion
We live in a interconnected world, were every day new devices, systems, and applications are connected to share information or interact between them. Thus, the importance of designing systems prepared to offer their services and data to a wide range of customers, that could discover, navigate and use their API in a standard and easy way to be consumed. But designing a headless platform to be used easily through their services is not straightforward. In this talk we will go over the challenges that we've found in adding headless nature to our platform and the foundations and tools that we have
Cdm mil-18 - hypermedia ap is for headless platforms and data integrationDavid Gómez García
Slides from my talk at Codemotion Milan 2018. Speaking about how Headess and Hypermedia REST APIs can leverage the way . we integrate different platforms and share date between them
Vladimir Tsukur presented on hypermedia APIs and HATEOAS. He discussed REST, the Richardson Maturity Model, CRUD vs more advanced APIs, and link relations. He demonstrated Mason, a proposed hypermedia format that uses controls and namespaces to define available state transitions and link semantics.
"From CRUD to Hypermedia APIs with Spring" Владимир ЦукурFwdays
Typical way to design and expose HTTP API today is a so called CRUD approach: come up with URL templates for resources, map create-read-update-delete operations to HTTP verbs and serialize domain model as JSON. Nice and easy, isn't it?
This talk will present limitations of CRUD style APIs and how to address them using "real" REST and hypermedia, HAL and ALPS.
We'll take a look how a set of libraries and tools from Spring helps building these APIs.
All the talking is not worth it without an example, so Spring-based application will be our guide. Amazon, PayPal, GitHub and other API providers have already started embracing hypermedia and linking by enhancing their HTTP interfaces.
Are you next?
The document discusses the development of a web and mobile app called "Tech Comm on a Map" that maps events and resources related to technical communication. Key points:
- The app allows users to contribute tech comm events and resources through a web form or Android app, which are stored in a Google Sheet and displayed on an interactive map using the Google Maps API.
- The web app was created using HTML, CSS, JavaScript and jQuery. Data is retrieved from Google Sheets using Apps Script.
- An Android version was also developed using Java and the Google Maps Android API to make the map accessible on mobile.
- The project is open source on GitHub and the developer discusses lessons learned around community collaboration and
Typical way to design and expose HTTP API today is a so called CRUD approach: come up with URL templates for resources, map create-read-update-delete operations to HTTP verbs and serialize domain model as JSON. This approach is nice and easy, but has its limitations.
During this presentation we'll create an application enhancing its primitive CRUD API all the way to modern, business-centric hypermedia style API using a set of tools from Spring, namely Spring Boot, Spring Data REST, Spring HATEOAS and Spring REST Docs!
Deliver Business Value Faster with AWS Step FunctionsDaniel Zivkovic
Step Functions provides a visual workflow orchestration service that allows you to model workflows as state machines. It executes tasks and coordinates work across AWS services like Lambda, DynamoDB, and SQS. Step Functions is useful for coordinating complex multi-step workflows, parallel processing, and dynamic branching logic. It costs $25 per million state transitions, which is significantly cheaper than coordinating workflows solely with Lambda functions.
Designing and building RESTful APIs isn’t easy. On its surface, it may seem simple – after all, we’re only marshaling JSON back and forth over HTTP right? However, that’s only a small part of the equation. There are many things to keep in mind while building the systems that act as the key to your system.
In this session, we’ll delve into several best practices to keep in mind when designing your RESTful API. We’ll discuss authentication, versioning, controller/model design, and testability. We’ll also explore the do’s and don’t’s of RESTful API management so that you make sure your APIs are simple, consistent, and easy-to-use. Finally, we’ll discuss the importance of documentation and change management. The session will show examples using ASP.NET Web API and C#. However, this session will benefit anyone who is or might be working on a RESTful API.
This document provides an overview of GraphQL, comparing it to REST. It discusses how GraphQL allows clients to query exactly what data they need from an API using a type system and query language. It also covers some key GraphQL concepts like object types, queries, enumerations, union types, and interfaces. The document notes that GraphQL performance depends on the underlying data sources and the speed of your slowest resource. It raises some additional topics like file uploads, caching, mutations, and subscriptions with GraphQL.
The document discusses building valuable RESTful APIs. It covers defining value through business models like freemium and subscription. It also discusses design best practices, including using HTTP verbs and status codes, resources, hypermedia controls, authentication, pagination, versioning, and error handling. The goal is to build APIs that are easy to use and provide value to both businesses and developers.
An API isn't stronger than its weakest link and what’s often ignored in the ongoing maintenance and development of an API is the constant effort required to provide great self-servicable error messages. What this means is that without great, user-friendly error messages, your API is not going to be great.
Just think about your first interaction with an API. How many failing requests have you sent before you have dug yourself through swathes of error messages and documentation to get to that one penultimate successful request making your heart sing and fists shaking in the air?
Great error messages make them not feel like errors, but like friendly guidance towards a working request. They should be detailed enough to let the developer fix whatever problem there is themselves, like a dialogue between a customer and a support technician.
This talk will give you ideas of how to handle errors and exceptions that occur in your application, be it with the incoming request, database failures or errors received from a 3rd party and how to serialize them into user friendly and actionable problem messages.
The document discusses eHarmony's plans to migrate their iOS app from Objective-C to Swift. It provides an overview of eHarmony as a company that has successfully matched over 565,000 couples using a scientific matching system. It then discusses Swift features like protocol extensions, error handling, and nullability that improve code safety. Finally, it outlines eHarmony's plan to tackle the migration through modernizing Objective-C code, generating bridging headers, and incrementally migrating parts of the app to Swift.
GraphQL - when REST API is to less - lessons learnedMarcinStachniuk
This document discusses the limitations of REST APIs and how GraphQL addresses those limitations. It begins with examples of how REST APIs can result in underfetching or overfetching data and require multiple roundtrips. It then covers how GraphQL allows clients to specify exactly what data they need in a single request. The document also provides examples of GraphQL queries, mutations, variables, fragments and aliases that simplify data fetching compared to REST APIs.
GraphQL - when REST API is to less - lessons learnedMarcinStachniuk
This document discusses the limitations of REST APIs and how GraphQL addresses those limitations. It begins with examples of how REST APIs can result in underfetching or overfetching data and require multiple roundtrips. It then demonstrates how GraphQL allows clients to specify exactly what data they need in a single request. The document also shows how GraphQL is better suited to the needs of different clients compared to rigid REST APIs. Finally, it provides examples of GraphQL queries and mutations.
GraphQL - when REST API is not enough - lessons learnedMarcinStachniuk
This document discusses lessons learned from implementing GraphQL APIs. It begins by describing some limitations of REST APIs, such as requiring multiple roundtrips to fetch nested data. GraphQL is introduced as an alternative that allows clients to specify exactly what data they need in a single request. The document then covers various GraphQL concepts like queries, mutations, and type systems. It also discusses best practices like using a schema-first approach, pagination support, and the DataLoader library to solve the N+1 problem. Testing GraphQL APIs and integrating with Relay are also briefly outlined. The overall message is that GraphQL is a good alternative to REST when clients have complex data needs.
GraphQL - Piękne API w Twojej Aplikacji - KrakowGraphAcademyMarcinStachniuk
Wszyscy znamy i tworzymy API RESTowe. Jednak to podejście ma swoje wady i ograniczenia. Dlatego Facebook stworzył GraphQL jako alternatywę. W mojej prezentacji przedstawię problemy RESTa oraz jak je rozwiązuje GraphQL. Pokażę składnię, jak projektować takie API oraz zalety i wady.
JavaOne Brasil 2016: JavaEE e HTML5: da web/desktop ao mobileLoiane Groner
This document discusses using Java and HTML5 platforms for desktop, web, and mobile applications. It covers key technologies like JSON, WebSockets, RESTful web services, and frameworks like Angular and Sencha. It also provides examples of building applications with these technologies, including a contacts app example in Java EE and Angular.
How to Leverage APIs for SEO #TTTLive2019Paul Shapiro
Learn the basic of APIs and how they can be leveraged for SEO and marketing. Chalk full of Python code examples.
The URL to the GitHub gist link on slide 54 has changed to the following:
https://gist.github.com/pshapiro/a86dc340f57c38fc22d0545ddec1fc9e
The document summarizes announcements about new features and changes to MercadoLibre's API. It discusses improvements to item validation, listing types, addresses API, feedback API, trends API, classifieds locations, contacts API, and promotion packs. It also notes new forums and subscription options on the developer platform to stay updated on API changes and events.
LINE Shopping provides an e-commerce platform in Taiwan. It has over 9 million monthly visitors, a 40% repurchase rate, and lists over 26 million products from over 1,300 brands. The document discusses how to test the LINE Shopping platform, including unit, API, and UI tests. It also describes tools like Just-API and Pyresttest that can be used to test GraphQL and REST APIs respectively using YAML configuration files.
David Gómez G. - Hypermedia APIs for headless platforms and Data Integration ...Codemotion
We live in a interconnected world, were every day new devices, systems, and applications are connected to share information or interact between them. Thus, the importance of designing systems prepared to offer their services and data to a wide range of customers, that could discover, navigate and use their API in a standard and easy way to be consumed. But designing a headless platform to be used easily through their services is not straightforward. In this talk we will go over the challenges that we've found in adding headless nature to our platform and the foundations and tools that we have
Cdm mil-18 - hypermedia ap is for headless platforms and data integrationDavid Gómez García
Slides from my talk at Codemotion Milan 2018. Speaking about how Headess and Hypermedia REST APIs can leverage the way . we integrate different platforms and share date between them
GraphQL Isn't An Excuse To Stop Writing DocsPronovix
The main goal of API documentation is to help developers understand how to use an API. With GraphQL, developers often assume it's self-documenting capabilities are sufficient for anyone that consumes their GraphQL API. But did you ever validate this?
Good API documentation offers both static and interactive ways to learn how to consume the API. API's that support GraphQL often only come with interactive documentation, in the shape of a GraphiQL Playground. However, the first time you (or your users) use a GraphQL API can be very frustrating as GraphQL APIs typically only have an interactive playground. it increases the complexity for newcomers to GraphQL as it assumes you’re already familiar with GraphQL. But with GraphQL, you’re not limited to just an interactive playground, as you can create static or interactive documentation next to having this playground. This talk explores which forms of documentation you can use and how they add value to your GraphQL API.
The document provides an overview of GraphQL and GraphQL clients. It discusses:
- The evolution of APIs from RESTful to GraphQL, which provides a more efficient way to query complex data.
- How GraphQL uses a single endpoint and allows clients to specify exactly the data they need through queries.
- Basic GraphQL queries, including selecting fields, nested fields, arguments, variables, fragments, and mutations.
- GraphQL type definitions that serve as documentation.
- GraphQL clients like Relay that optimize data fetching and caching.
- Tools like GraphiQL that allow testing GraphQL queries in an interactive environment.
This document provides an introduction to API technical writing. It begins with definitions of APIs and their role in software development. It then discusses different types of APIs and provides demonstrations of JavaScript and REST APIs. The document outlines key components of API documentation and provides examples. It also discusses how API technical writers work with engineering teams and how to get started in the field.
The Serverless GraphQL Backend ArchitectureNikolas Burk
This document discusses serverless GraphQL backend architectures. It introduces GraphQL concepts like queries, mutations, schemas and resolver functions. It then outlines how a serverless GraphQL backend can be built using automatically generated CRUD APIs from a data model, event-driven business logic via serverless functions, and a global type system defined in the GraphQL schema. It provides Graphcool as an example platform for building serverless GraphQL backends that leverages request pipelines, subscriptions and schema extensions.
GraphQL is a query language and execution engine that was created by Facebook in 2012 and became an open standard in 2015. It provides improvements over REST such as allowing queries to retrieve multiple resources with one endpoint. Symfony implementations of GraphQL include the GraphQLBundle and OverblogGraphQLBundle which allow defining types, fields, resolvers, and security rules in YAML configuration files. Security features include limiting query depth and complexity as well as controlling access to fields.
- GraphQL is a query language and execution engine that allows clients to request specific data from an API rather than retrieve predefined resources. It was created by Facebook in 2012 and became an open standard in 2015.
- GraphQL provides improvements over REST APIs such as allowing clients to request specific data in one endpoint using queries rather than making multiple requests to different endpoints.
- Symfony implementations of GraphQL include the GraphQLBundle which allows defining types, fields, and resolvers in YAML configuration and connecting them to Symfony services and repositories.
- Security measures for GraphQL APIs include limiting query depth and complexity, field access control, and marking fields as deprecated.
AMS adapters in Rails 5 are important for building a wonderful RESTful API because they provide hypermedia controls and links in the API response. The JSON API adapter in particular generates responses that follow the JSON API specification by including links, relationships, pagination metadata, and embedded resources. Adapters allow Rails to render different representation formats like JSON API, customize the API structure, and improve the developer experience of the API through conventions like hypermedia controls and links. However, there is still work to be done on adapters, like improving deserialization, documentation, and better supporting JSON API conventions fully.
Connecting the Dots: Kong for GraphQL EndpointsJulien Bataillé
GraphQL is a popular alternative to REST for front-end applications as it offers flexibility and developer-friendly tooling. In this talk, we will look into the differences between REST and GraphQL, how GraphQL API Management presents a new set of challenges, and finally, how we can address those challenges by leveraging Kong extensibility.
Slides from presentation, I've made on the BuildStuff LT 2018. Here I'm talking about issues, many people have found when using RESTful APIs and how GraphQL addresses them. Also I'm trying to cover the tradeoffs made by the standard, solutions proposed by different implementations and some ideas for the future.
Moje slajdy z prezentacji na GraphQL Wroclaw #3 https://www.meetup.com/GraphQL-Wroclaw/events/261828347/
Większość prezentacji dotyczących GraphQL opowiada o JavaSkryptowych narzędziach, natomiast mało kto mówi o tym jak korzystać z GraphQL w Javie. Prezentacja będzie o tym, jak sprawić aby nasz backendowy, Javowy serwer korzystał z GraphQL. Będzie o możliwych podejściach w implementacji, dobrych praktykach i 4-letnim doświadczeniu z GraphQL na produkcji.
[WroclawJUG] Continuous Delivery in OSS using ShipkitMarcinStachniuk
Shipkit is a framework that helps automate continuous delivery of open source software projects. It allows developers to easily manage releases by automatically bumping versions, generating release notes, creating tags, and publishing releases when code is merged to master. Shipkit integrates with Travis CI to run release tasks like tests and publication. It aims to reduce the manual work of releases so developers can focus on coding.
Do you know how Continuous Delivery of Java Open Source libraries looks? How big is your release overhead? Do you update release notes and include contributors manually? How do you handle versioning? Do you use semantic versioning?
During this workshop, you will learn how to set up Continuous Delivery for your library. You’ll never have to manually release new versions again. We will use the following tools: GitHub, TravisCI, Bintray, Maven Central. We will glue everything using Shipkit.org - a project born from Mockito (and still used there). You’ll additionally learn SerVer.
This workshop is mostly for Java open source and Gradle plugins developers. We will use a library prepared especially for this training, so no worries if you don’t have your own open source project (yet).
Prerequisites: GitHub account, Java & Gradle basics.
Automatic mechanism data migration between relational and object databaseMarcinStachniuk
This document discusses automatically migrating data between a relational database and an object database. It presents the problem of impedance mismatch between the different data models and dispersal of data across tables in a relational database. The solution reads the relational database schema, generates object-oriented persistence classes, loads the classes, uses reflection to access the relational data and invoke methods to store it in the object database. Data types are mapped between the databases. Future work could support additional data types, databases and customization.
Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017MarcinStachniuk
This document discusses continuous delivery in an open source project. It begins with an introduction of the speaker and then discusses various tools used in the continuous delivery process like Travis CI for continuous integration. It outlines the build pipeline for the project including deploying to Bintray and updating GitHub pages. It also covers code quality tools like Codecov and promoting the project on the internet through blogs, conferences and other forums.
Continuous delivery w projekcie open source - Marcin StachniukMarcinStachniuk
Continuous delivery is a software engineering approach where code changes are automatically built, tested, and prepared for a release to production. The presentation discusses setting up a continuous delivery pipeline for an open source project including continuous integration with Travis CI, deploying to Bintray, tracking code quality with Codecov, and promoting the project online. Alternatives to Travis CI, Codecov and other tools are also presented.
Liquibase - Zarządzanie zmianami w relacyjnych bazach danychMarcinStachniuk
Prezentacja wygłoszona na Wrocławskim JUGu 30 września 2015. Prezentacja opisuje w jaki sposób można zarządzać zmianami w relacyjnych bazach danych i jak ten problem rozwiązuje Liquibase.
Poznaj lepiej swoje srodowisko programistyczne i zwieksz swoja produktywnosc ...MarcinStachniuk
Prezentacja do warsztatów na konferencję Warsjawa.pl 2014
Kod, stworzony przez uczestników warsztatu:
https://github.com/mstachniuk/WarsjawaCodingDojo
Podstawy tworzenia gier w J2ME, dla początkujących adeptów sztuki programowaniaMarcinStachniuk
Prezentacja pokazująca podstawy tworzenia gier w technologii J2ME z wykorzystaniem niskopoziomowego API.
Prezentacja dla osób zaczynających przygodę z programowaniem.
VFP-Report-Copy-Data-Environment details.
I am MCTS - (Microsoft Certified Tech. Specialist).
I had started my journey with COBOL, dbaseIII+, Clipper, Foxpro - DOS/WIndows/Visual, VB6.
My 130+ Articles on .NET : https://www.c-sharpcorner.com/members/manoj-kalla3
My YouTube Channel: https://www.youtube.com/@manojkalla4174/playlists
Total 200+ Videos on Visual Foxpro.
My Medium Article : https://medium.com/@manojkalla
Ahmedabad Information Technology IT college Syllabus for BCA, MCA and online teaching for Asp.Net MVC, Asp.Net Core, Java, C Language, C++ Language, Entity Framework, Linq To SQL, Android.
The Maharaja Sayajirao University (M.S. University), Dr. Babasaheb Ambedkar Open University (BAOU), Indus University (IU), Ahmedabad courses and G.L.S. Institute Of Computer Application (GLSICA), Gujarat University online courses BCA, MCA and BTech, MTech online.
Mehsana Information Technology IT college Syllabus for BCA, MCA.
Mehsana online teaching for Asp.Net MVC, Asp.Net Core, Java, C Language, C++ Language, Entity Framework, Linq To SQL, Android.
Yashwantrao Chavan Maharashtra Open University (YCMOU) course online training institute.
YCMOU Java Notes, YCMOU Android Training, YCMOU Java Training, YCMOU Linux Course, YCMOU syllabus online Training insitute, YCMOU C++ Notes, YCMOU C++ online training, YCMOU C++ online tutor.
YCMOU BCA tutor , YCMOU BCA training,
Bharati Vidyapeeth University (BVP) courses online training ,
Bharati Vidyapeeth University (BVP) courses online tutor,
Bharati Vidyapeeth University (BVP) courses BCA online training ,
Bharati Vidyapeeth University (BVP) courses BTECH online tutor,
Angular online tutor in malad mumbai,
Angular online tutor in kandivali mumbai,
Angular online tutor in bhayandar mumbai,
Angular online tutor in vapi gujrat,
Angular online tutor in surat gujrat,
Angular online tutor in baroda gujrat,
Angular online tutor in vadodara gujrat,
Angular online tutor in indore MP,
Angular online tutor in bhopal MP,
Angular online tutor in nashik maharashtra,
Angular online tutor in pune maharashtra,
Angular online training institute in Bandra Mumbai,
Angular online training institute in mehsana Gujrat,
Angular online tutor in malad mumbai,
Angular online tutor in kandivali mumbai,
Angular online tutor in bhayandar mumbai,
Angular online tutor in vapi gujrat,
Angular online tutor in surat gujrat,
Angular online tutor in baroda gujrat,
Angular online tutor in vadodara gujrat,
Angular online tutor in indore MP,
Angular online tutor in bhopal MP,
Angular online tutor in nashik maharashtra,
Angular online tutor in pune maharashtra,
Angular online training institute in Bandra Mumbai,
Angular online training institute in mehsana Gujrat,
In today’s workplace, staying connected is more important than ever. Whether teams are remote, hybrid, or back in the office, communication and collaboration are at the heart of getting things done. But here’s the truth — outdated intranets just don’t cut it anymore.
Custom Software Development: Types, Applications and Benefits.pdfDigital Aptech
Discover the different types of custom software, their real-world applications across industries, and the key benefits they offer. Learn how tailored solutions improve efficiency, scalability, and business performance in this comprehensive overview.
Marketing And Sales Software Services.pptxjulia smits
Marketing and Sales Software Services refer to digital solutions designed to streamline, automate, and enhance a company’s marketing campaigns and sales processes. These services include tools for customer relationship management (CRM), email marketing, lead generation, sales analytics, campaign tracking, and more—helping businesses attract, engage, and convert prospects more efficiently.
Multiple Platforms of Unity Game Development.pdfNova Carter
Unity Game Development stands out for its unparalleled flexibility across multiple platforms, making it a top choice for developers aiming to reach a broad audience. With Unity, creators can build a game once and deploy it seamlessly across mobile devices, desktops, gaming consoles, web browsers, and even AR/VR systems. This multi-platform capability reduces development costs and effort while ensuring consistent performance and user experience across devices. Whether targeting casual mobile gamers or console enthusiasts, Unity empowers developers to scale their games effectively and maintain a competitive edge in today’s diverse gaming landscape.
VALiNTRY360’s Salesforce Experience Cloud Consulting services empower organizations to build personalized, engaging digital experiences for customers, partners, and employees. Our certified Salesforce experts help you design, implement, and optimize Experience Cloud portals tailored to your business goals. From self-service communities to partner collaboration hubs, we ensure seamless integration, enhanced user engagement, and scalable solutions. Whether you're improving customer support or streamlining partner communication, VALiNTRY360 delivers strategic consulting to maximize the value of Salesforce Experience Cloud. Trust us to transform your digital experiences into powerful tools that drive loyalty, efficiency, and growth. Partner with VALiNTRY360 to elevate every user interaction.
For more info visit us https://valintry360.com/salesforce-experience-cloud
Top 10 Mobile Banking Apps in the USA.pdfLL Technolab
📱💸 Top Mobile Banking Apps in the USA!
Are you thinking to invest in mobile banking apps in USA? If yes, then explore this infographic and know the top 10 digital banking apps which creating ripples in USA. From seamless money transfers to powerful budgeting tools, these apps are redefining how America banks on the go.
BoxLang is the new CF-compatible server and CLI tool. It’s extensible easily with modules, which means you can write your own built in functions, tags, and more for your own use or to share with the community on ForgeBox. Let’s find out how.
Agentic AI Desgin Principles in five slides.pptxMOSIUOA WESI
Discover the core design patterns that enable AI agents to think, learn, and collaborate like never before. From breaking down goals to coordinating across systems, these patterns form the foundation of advanced intelligent behavior. Learn how reinforcement learning, hierarchical planning, and multi-agent systems are transforming AI capabilities. This presentation offers a concise yet powerful overview of agentic design in action. Perfect for developers, researchers, and AI enthusiasts ready to build smarter systems.
A Claims Processing System enhances customer satisfaction, efficiency, and compliance by automating the claims lifecycle—enabling faster settlements, fewer errors, and greater transparency. Explore More - https://www.damcogroup.com/insurance/claims-management-software
Secure and Simplify IT Management with ManageEngine Endpoint Central.pdfNorthwind Technologies
ManageEngine Endpoint Central (formerly known as Desktop Central) is an all-in-one endpoint management solution designed for managing a diverse and distributed IT environment. It supports Windows, macOS, Linux, iOS, Android, and Chrome OS devices, offering a centralized approach to managing endpoints — whether they’re on-premise, remote, or hybrid.
3. Who is using REST?
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
4. REST - REpresentational State Transfer
https://api.example.com/customers/123
DELETE
PUT
POST
GET
PATCH
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
6. REST consequences: several roundtrips
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
7. REST response with nested data
GET /customers/111
{
"customer": {
"id": "111",
"name": "John Doe",
"email": "[email protected]",
"company": {
"id": "222",
"name": "My Awesome Corporation",
"website": "MyAwesomeCorporation.com"
},
"orders": [
{
"id": "333",
"status": "delivered",
"items": [
{
"id": "555",
"name": "Silver Bullet",
"amount": "42",
"price": "10000000",
"currency": "USD",
"producer": {
"id": "777",
"name": "Lorem Ipsum",
"website": "LoremIpsum.com"
}
}
]
},
{
"id": "444",
"name": "Golden Hammer",
"amount": "5",
"price": "10000",
"currency": "USD",
"producer": {
...
}
}
] } }
RE
ST
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
8. REST response with nested data and limit fields
GET /customers/111?fields=name,company/*,orders.status,orders.items(name,producer/name)
{
"customer": {
"id": "111",
"name": "John Doe",
"email": "[email protected]",
"company": {
"id": "222",
"name": "My Awesome Corporation",
"website": "MyAwesomeCorporation.com"
},
"orders": [
{
"id": "333",
"status": "delivered",
"items": [
{
"id": "555",
"name": "Silver Bullet",
"amount": "42",
"price": "10000000",
"currency": "USD",
"producer": {
"id": "777",
"name": "Lorem Ipsum",
"website": "LoremIpsum.com"
}
}
]
},
{
"id": "444",
"name": "Golden Hammer",
"amount": "5",
"price": "10000",
"currency": "USD",
"producer": {
...
}
}
] } }
RE
ST
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
9. Different clients - different needs
/web /iphone /android /tv
Application
Web iPhone Android TV
RE
ST
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
10. Different clients - different needs
/web /iphone /android /tv
Application
Web iPhone Android TV
Content-Type: application/vnd.myawesomecorporation.com+v1+web+json
iphone
android
tv
RE
ST
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
11. Different clients - different needs
/web /iphone /android /tv
Application
Web iPhone Android TV
Content-Type: application/vnd.myawesomecorporation.com+v1+web+json
iphone
android
tv
RE
ST
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
15. GraphQL
● Graph Query Language
● Published by Facebook in 2015
● Growth from Facebook Graph API
● Reference implementation in JavaScript
● First version of Java Library: 18 Jul 2015
https://github.com/graphql-java/graphql-java
● First usage: 21 Sep 2015
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
16. Lessons Learned #1
Never add a library to your project
few days after init release
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
● No community
● A lot of bugs
● Bad documentation
● Strict following reference
implementation and specification
DO NOT TRY
THIS AT WORK
17. GraphQL main concepts
● One endpoint for all operations
● Always define in request what you need
● Queries, Mutations and Subscriptions
● Defined by schema
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
18. Data is a graph
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
19. GraphQL Simple API
GET /customers/2?fields=id,name,email
type Customer {
#fields with ! are not null
id: ID!
name: String!
email: String!
}
type Query {
customer(id: String!): Customer!
}
{
"data": {
"customer": {
"id": "2",
"name": "name",
"email": "[email protected]"
}
}
}
{
customer(id: "2") {
id
name
email
}
}
RE
ST
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
20. GraphQL Bad Request
GET /custo!@#$ -> 404
{
"data": null,
"errors": [
{
"message": "Invalid Syntax",
"locations": [
{
"line": 2,
"column": 8
}
],
"errorType": "InvalidSyntax",
"path": null,
"extensions": null
} ] }
{
custo!@#$
}
RE
ST
http.cat/200
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
21. Go back to the roots
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
22. GraphQL Simple API
GET /customers/2?fields=id,name,email,company(id,name)
type Customer {
id: ID!
name: String!
email: String!
company: Company
}
type Company {
id: ID!
name: String!
website: String!
}
type Query {
customer(id: String!): Customer!
}
{
"data": {
"customer": {
"id": "2",
"name": "name",
"email": "[email protected]",
"company": {
"id": "211",
"name": "Company Corp."
}
}
}
}
{
customer(id: "2") {
id
name
email
company {
id
name
}
}
}
RE
ST
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
23. GraphQL Simple API
GET /customers/2?fields=id,name,email,orders(id,status)
type Customer {
id: ID!
name: String!
email: String!
company: Company
orders: [Order]
}
type Order {
id: ID!
status: Status
}
enum Status {
NEW, CANCELED, DONE
}
{
"data": {
"customer": {
"id": "2",
"name": "name",
"orders": [
{
"id": "55",
"status": "NEW"
},
{
"id": "66",
"status": "DONE"
}
] } } }
{
customer(id: "2") {
id
name
orders {
id
status
}
}
}
RE
ST
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
24. How to implement DataFetcher for queries
GET /customers/2?fields=id,name,email,orders(id,status)
@Component
public class CustomerFetcher extends PropertyDataFetcher<Customer> {
@Autowired
private CustomerService customerService;
@Override
public Customer get(DataFetchingEnvironment environment) {
String id = environment.getArgument("id");
return customerService.getCustomerById(id);
}
}
RE
ST
{
customer(id: "2") {
id
name
orders {
id
status
}
}
}
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
25. How to implement DataFetcher for queries
GET /customers/2?fields=id,name,email,orders(id,status)
public class Customer {
private String id;
private String name;
private String email; // getters are not required
}
RE
ST
{
customer(id: "2") {
id
name
orders {
id
status
}
}
}
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
public class OrderDataFetcher extends PropertyDataFetcher<List<Order>> {
@Override
public List<Order> get(DataFetchingEnvironment environment) {
Customer source = environment.getSource();
String customerId = source.getId();
return orderService.getOrdersByCustomerId(customerId);
}
}
26. GraphQL mutations
input CreateCustomerInput {
name: String
email: String
clientMutationId: String!
}
type CreateCustomerPayload {
customer: Customer
clientMutationId: String!
}
type Mutation {
createCustomer(input: CreateCustomerInput):
CreateCustomerPayload!
}
{
"data": {
"createCustomer": {
"customer": {
"id": "40",
},
"clientMutationId":
"123"
}
}
}
POST /customers PUT /customers/123 DELETE /customers/123 PATCH /customers/123
mutation {
createCustomer(input: {
name: "MyName"
email: "[email protected]"
clientMutationId: "123"
}) {
customer {
id
}
clientMutationId
}
}
RE
ST
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
27. How to implement DataFetcher for mutations
POST /customers PUT /customers/123 DELETE /customers/123 PATCH /customers/123
@Component
public class CreateCustomersFetcher extends
PropertyDataFetcher<CreateCustomersPayload> {
@Override
public CreateCustomerPayload get(DataFetchingEnvironment env) {
Map<String, Object> input = env.getArgument("input");
String name = (String) input.get("name");
String email = (String) input.get("email");
String clientMutationId = (String) input.get("clientMutationId");
Customer customer = customerService.create(name, email);
return new CreateCustomerPayload(customer, clientMutationId);
}
RE
ST
mutation {
createCustomer(input: {
name: "MyName"
email: "[email protected]"
clientMutationId: "123"
}) {
customer {
id
}
clientMutationId
}
}
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
28. Abstraction over GraphQL Java
Our abstraction
Data Fetcher 2
Inputs mapping to objects
Schema definition
Pagination
...
Data Fetcher 1 Data Fetcher N...
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
29. Lessons Learned #2
Abstraction is not good if you don’t understand
how it works under the hood
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
● Copy paste errors
● Wrong usage
● Hard to update to new version
30. GraphQL can do more!
● Variables
● Aliases
● Fragments
● Operation name
● Directives
● Interfaces
● Unions
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
31. GraphQL type system
How to define your schema?
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
32. Code First approach
private GraphQLFieldDefinition customerDefinition() {
return GraphQLFieldDefinition.newFieldDefinition()
.name("customer")
.argument(GraphQLArgument.newArgument()
.name("id")
.type(new GraphQLNonNull(GraphQLString)))
.type(new GraphQLNonNull(GraphQLObjectType.newObject()
.name("Customer")
.field(GraphQLFieldDefinition.newFieldDefinition()
.name("id")
.description("fields with ! are not null")
.type(new GraphQLNonNull(GraphQLID))
.build())
….
.build()))
.dataFetcher(customerFetcher)
.build();
}
Schema First approach
type Query {
customer(id: String!): Customer!
}
type Customer {
#fields with ! are not null
id: ID!
name: String!
email: String!
company: Company
orders: [Order]
}
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
33. Code First approach - How to build
Introspection
query
Introspection
response
Replace Relay
definitions
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
Typescript relay
plugin
34. Schema First approach
type Customer {
# fields with ! are required
id: ID!
name: String!
email: String!
company: Company
orders: [Order]
}
*.graphqls
SchemaParser schemaParser = new SchemaParser();
File file = // ...
TypeDefinitionRegistry registry = schemaParser.parse(file);
SchemaGenerator schemaGenerator = new SchemaGenerator();
RuntimeWiring runtimeWiring = RuntimeWiring.newRuntimeWiring()
.type("Query", builder ->
builder.dataFetcher("customer", customerFetcher))
// ...
.build();
return schemaGenerator.makeExecutableSchema(registry, runtimeWiring);
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
35. Schema First approach - project building diagram
model.graphqls
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
36. Lessons Learned #3
Schema First Approach is better
Schema First Approach:
● Easy to maintain and
understand
● Helps organise work
● Demo schema is 2x smaller
Code First approach:
● Hard to maintain
● It was the only way at the
beginning to define a schema
● No possibility to mix both
● No easy way to migrate to
Schema First
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
37. From Code First to Schema First migration
https://github.com/mstachniuk/graphql-schema-from-introspection-generator
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
38. GraphQL - How to define pagination, filtering, sorting?
Pagination:
● before, after
● offset, limit
Filtering:
● filter(name: “Bob” email: “%@gmail.com”)
● filter: {
OR: [{
email: “%@gmail.com”
}]
}, name: “Bob”
}
Sorting:
● orderBy: ASC, DESC
● sort: NEWEST, IMPORTANCE
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
39. Lessons Learned #4
GraphQL is not full query language
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
● Flexibility
● Less common conventions
● Dgraph.io created GraphQL+-
41. GraphQL downsides: N+1 problem
{
customers { 1 call
id
name
orders { n calls
id
status
}
}
}
java-dataloader
● Add async BatchLoader
● Add caching
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
42. Lessons Learned #5
If you have N + 1 problem
use java-dataloader
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
43. GraphQL downsides: Bad GraphQL API definition - examples
{
customer(id: "2") { … }
customerFull(id: "2") { … }
customerFull2(id: "2") { … }
customerWithDetails(id: "2") { … }
...
}
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
{
customer(id: "2") {
id
name
orders {
id
status
}
}
}
44. GraphQL downsides: Bad GraphQL API definition - examples
{
usersOrGroups(id: "123") {
... on User {
id
userName
}
... on UserGroup {
id
name
}
}
}
{
user(id: "123") {
id
userName
}
userGroup(id: "123") {
id
userName
}
}
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
45. GraphQL downsides: Bad GraphQL API definition - examples
{
orders (input: {
status: "NEW"
first: "2"
offset: "3"
}, first: "1", offset: "3") {
Items { … }
}
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
46. Lessons Learned #6
Thinking shift is a key
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
● Let’s think in graphs and NOT in
endpoints / resources / entities / DTOs
● Bad design of our API
48. Testing GraphQL
@SpringBootTest
@ContextConfiguration(classes = Main)
class CustomerFetcherSpec extends Specification {
@Autowired
GraphQLSchema graphQLSchema
GraphQL graphQL
def setup() {
graphQL = GraphQL.newGraphQL(graphQLSchema).build()
}
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
49. Testing GraphQL
def "should get customer by id"() {
given:
def query = """{ customer(id: "2") { … } }"""
def expected = [ "customer": [ … ] ]
when:
def result = graphQL.execute(query)
then:
result.data == expected
}
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
50. Lessons Learned #7
Testing is easy
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
Trap Adventure 2 - "The Hardest Retro Game"
53. Tools Relay
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned @MarcinStachniukGraphQL - when REST API is not enough - lessons learned
user(...) {
photo(width: "120", height: "120")
}
user(...) {
name
}
user(...) {
email
}
user(...) {
name
email
photo(width: "120", height: "120")
}
56. More libraries and projects related to graphql-java
https://github.com/graphql-java/awesome-graphql-java
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
● Generates a GraphQL schema from a JDBC data source
● Annotations-based syntax for GraphQL schema definition
● JPA Implementation of GraphQL (builds on graphql-java)
● And more examples
57. Apollo
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
Build a universal GraphQL API on top of your existing REST
APIs, so you can ship new application features fast without
waiting on backend changes.
58. Lessons Learned #8
Tooling is nice
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
now
59. Summary
GraphQL Pros:
● Nice alternative to REST
● It can be used together with REST
● Good integration with Relay / ReactJS
● You get exactly what you want to get
● Good for API with different clients
● Good to use on top of existing API
● Self documented
● Easy testing
● Nice tooling
GraphQL Cons:
● High entry barrier
● Hard to return simple Map
● Not well know (yet)
● Performance overhead
● A lot of similar code to write
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned
60. Nothing is a silver bullet
@MarcinStachniukGraphQL - when REST API is not enough - lessons learned