liveBook · Manning

GraphQL operation

As explained in Quarkus in Action

A GraphQL operation is an executable request that specifies a query, mutation, or other interaction with a GraphQL schema.

A GraphQL operation is an executable request sent to a GraphQL endpoint. It follows the schema’s contract, accepts parameters, and returns a defined type. Clients select the fields they need rather than receiving an entire object by default. section 4.4

GraphQL defines three operation types:

  • Query reads data without changing it, roughly corresponding to SQL SELECT or a REST GET. section 4.4
  • Mutation changes or adds data, roughly corresponding to SQL UPDATE or INSERT and REST PUT or POST; it can also return the updated data. section 4.4
  • Subscription produces a potentially infinite stream of responses as new items appear, commonly for event notifications and usually implemented with WebSockets. section 4.4

Operations use schema-defined types and fields. In the Quarkus GraphQL UI, write the operation, supply variables or HTTP headers when needed, and press Play to execute it. Schema-aware autocompletion suggests available operations and fields. section 4.5.2

Selecting fleet data

A query can request only the required fields from each car: cars, then id, licensePlateNumber, model, and manufacturer. The response contains those selected fields under data.cars. A mutation can instead register a car and return its assigned id and submitted details.

Figure 4.3 GraphiQL is an HTML and JavaScript-based UI for manually executing GraphQL operations.
figure

Use the GraphiQL-style UI to compose and manually execute operations while inspecting their results. section 4.5.2

How Quarkus in Action covers it

How deep it goes
Explains operation categories, contracts, field selection, UI execution, and examples, but does not deeply cover GraphQL features.
Examples
Demonstrates fleet car queries, register mutations, returned data, and GraphiQL autocompletion.
What it assumes
Assumes familiarity with schemas and data models, while relating GraphQL operations to SQL and REST equivalents.
What you can do after
Apply it via the Quarkus GraphQL UI to compose, parameterize, execute, and inspect GraphQL operations.
How it connects
Connects GraphQL schema, types, fields, SQL queries, REST methods, WebSockets, and MicroProfile GraphQL.

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.