Intermediate GraphQL #client #fragments #variables #persisted-queries

GraphQL Client Vocabulary

5 exercises — master GraphQL client vocabulary: operations and naming, fragments and co-location, variables, over-fetching vs under-fetching, and persisted queries.

0 / 5 completed
GraphQL client vocabulary quick reference
  • Operation — a single GraphQL request: query, mutation, or subscription
  • Named operationquery GetUser; appears in logs, traces, and monitoring tools
  • Fragment — reusable selection set: fragment UserCard on User { id name }
  • Variable — typed operation parameter: $userId: ID! — always use instead of inline literals
  • Over-fetching — receiving more data than needed; under-fetching — needing extra round-trips
  • Persisted query — pre-registered operation sent by hash instead of full text; improves security and performance
1 / 5

What is a GraphQL operation, and why is it important to give operations names in production applications?

# Anonymous (avoid in production)
query { user(id: "123") { name email } }

# Named (recommended)
query GetUserProfile { user(id: "123") { name email } }