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.
Use the GraphiQL-style UI to compose and manually execute operations while inspecting their results. section 4.5.2
