liveBook · Manning

Typesafe GraphQL client

As explained in Quarkus in Action

A typesafe GraphQL client is a GraphQL client that derives requests from statically typed application model classes and client interfaces.

A typesafe GraphQL client derives requests from domain classes and a client interface. In Quarkus, the interface describes the client-side GraphQL contract while configuration supplies the server URL. section 4.5.4

Inventory availability

A Reservation service can call its injected client to retrieve inventory as List<Car>. The availability endpoint returns cars such as a Mazda 6 and a Ford Mustang. A dynamic GraphQL client remains an alternative when requests must be constructed explicitly.

How Quarkus in Action covers it

How deep it goes
Defines extension setup, interface annotations, query mapping, URL configuration, injection, and endpoint verification; contrasts dynamic clients briefly.
Examples
Uses a GraphQLInventoryClient, a cars query, an inventory URL, and an availability response containing Mazda and Ford cars.
What it assumes
Assumes domain classes and a GraphQL server query, while teaching the client interface, annotations, configuration, and injection steps.
What you can do after
Build it from scratch by adding the client extension, declaring the contract, configuring its URL, injecting it, and calling the endpoint.
How it connects
Ties GraphQL to domain classes, client interfaces, dependency injection, configuration, and dynamic GraphQL clients.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Quarkus in Action. The section links point to the parts of the book it draws on.