Quick revision
The short answer
A single large schema accumulates fields because removing one requires knowing every client query that uses it, and without that knowledge nobody dares to delete anything. To fix it we need field-level usage tracking, through operation names and persisted queries, so we can retire fields safely, clear ownership per domain through federation or modules so one team is not the bottleneck, and a published process of marking fields @deprecated and removing them on a schedule. The general lesson is that every API technology needs governance for growth and retirement; GraphQL makes adding easy but does not remove that need.
What to remember
In this answer, we saw why a GraphQL schema grows to thousands of fields: adding is safe and cheap, while removing requires knowing every client's queries. The cure is field-level usage tracking through operation names and persisted queries, ownership per domain through federation or clear modules, and a published process of @deprecated fields removed on a schedule driven by usage. The lasting lesson is that every API technology needs governance for growth and retirement from the start; GraphQL does not remove that need.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
A single large schema accumulates fields because removing one requires knowing every client query that uses it, and without that knowledge nobody dares to delete anything. To fix it we need field-level usage tracking, through operation names and persisted queries, so we can retire fields safely, clear ownership per domain through federation or modules so one team is not the bottleneck, and a published process of marking fields @deprecated and removing them on a schedule. The general lesson is that every API technology needs governance for growth and retirement; GraphQL makes adding easy but does not remove that need.
Why this question is asked
Five years in, the picture is common: 3,000 fields, a schema file nobody reads end to end, a review queue for every change, and many fields that may or may not be used by an old mobile version somewhere. Teams start to route around the schema, adding near-duplicate fields because changing the existing ones is too risky. Interviewers ask this question to see whether we can draw a general lesson from a specific technology's history and then act on it. In this answer, we will understand why the schema grew this way, measure usage, restructure ownership, set up a deprecation and removal process, and generalise the lesson for future technology choices.
1Why the Schema Grew to 3,000 Fields
GraphQL makes adding a field cheap and safe: existing queries are not affected, because clients only receive the fields they ask for. So every new screen adds a few fields, and nothing is ever taken away. Removal is the opposite: deleting a field breaks every query that selects it, and in an open schema we do not know who those are. Web clients can be updated in a day, but mobile apps installed years ago still send their old queries.
So the incentives are lopsided. Adding costs nothing today, removing costs research and risk today, and the benefit of removing is spread thinly over the future. Without a process that makes removal routine, a schema can only grow. Add one central team reviewing every change, and the growth also becomes slow, because every team waits in the same queue.
2Measuring Field Usage First
We cannot retire what we cannot see. The first investment is field-level usage tracking: for every request, record which operation ran and which fields it touched. Two practices make this reliable. Operation names, a required name on every query such as HomeScreen or OrderDetails, together with a client name and version header, tell us who sent the query. Persisted queries, where clients register their documents at build time and send only a hash, give us a complete inventory of every query each client version can send, without even waiting for traffic.
With Spring for GraphQL, an instrumentation or interceptor can record per field and per operation counters, for example as metrics tagged with the field coordinate (Order.legacyStatus) and the client name. After a few weeks, we can sort all 3,000 fields by usage. In a schema like this it is typical to find a large share with zero use in 90 days, a group used only by old client versions, and a core that carries almost all traffic.
| Group | Share of fields | Action |
|---|---|---|
| No use in 90 days | about 35% | deprecate now, remove after notice |
| Used only by old app versions | about 15% | remove when version share is low |
| Used by current clients, duplicated | about 10% | migrate to one field, then deprecate |
| Core, actively used | about 40% | keep, assign clear owner |
3Ownership per Domain
The slowness has a structural cause: one schema, one review queue. We split ownership by domain. With federation, each domain team owns a subgraph, its types and fields, and a router composes them; with a single service, clear modules in the code and CODEOWNERS-style ownership per schema file achieve something similar. Either way, every type and field has an owner who can approve changes to it without a central team in the loop.
A small central group still exists, but its role changes from approving every change to setting rules: naming conventions, pagination style, error handling and the deprecation process, enforced by automated checks such as schema linting and breaking-change detection in CI. That way consistency comes from tools, and throughput comes from ownership.
4Deprecation and Removal on a Published Schedule
GraphQL has a built-in way to signal intent: the @deprecated directive with a reason. Tools and client code generators show warnings for deprecated fields, so client developers learn about them in their own editors.
- Usage data shows low or no useper field, per client and version
- Mark @deprecated with reason and datetools warn client developers
- Still used by supported clients?YesContact owners, wait or migrateNoRemove on the scheduled date
- Breaking-change check in CIconfirms no registered query uses it
4 steps in order. Play them, or step through them one at a time.
The directive alone is not enough; the important part is the schedule. We publish a policy, for example: a deprecated field is removed 90 days after deprecation if it has no traffic from supported clients, and fields used only by unsupported app versions are removed once those versions fall below an agreed share. The usage data drives each step: when a deprecated field still has traffic, we contact the client that sends it, by name, from the operation tracking. Removal then becomes a regular, low-drama activity, like a monthly release, rather than a heroic project.
5The Lesson for Long-Lived API Choices
The broader lesson is that no API technology removes the need for governance. REST APIs accumulate endpoints and versions, gRPC services accumulate fields and methods, and GraphQL accumulates fields. What differs is where the pressure shows. GraphQL removed the pain of adding, so the pain moved entirely to retiring, and we did not plan for it.
When adopting any long-lived technology, a senior person plans for its whole life: who owns each part, how usage is measured, how things are deprecated and removed, and what the review and automation look like at ten times the current size. If I were making the original GraphQL decision again, I would require operation names and persisted queries from day one, assign ownership per domain from the start, and publish the deprecation policy before the first field shipped. Those are cheap at the beginning and very expensive to add five years later.
6Follow-up questions
Should we replace GraphQL with something else after five years of pain?
Usually not. The problem is missing governance, not the technology, and a replacement would bring its own migration cost and, without governance, the same growth. Fixing usage tracking, ownership and the retirement process solves the actual problem and keeps the investment clients have made.
What if a client cannot send operation names or use persisted queries?
Accept anonymous queries only for a transition period and track them by client name and version headers. New client versions are required to use named, registered operations, and anonymous traffic gets stricter limits. As old versions fade, the gap closes.
How do you avoid duplicate fields being added in the first place?
Make the schema discoverable and reviewed by its owner. With ownership per domain, a proposal for orderStatusText reaches the team that owns Order, which can point to the existing field. Linting rules and a schema registry with search help teams find what exists before adding.
7Conclusion
In this answer, we saw why a GraphQL schema grows to thousands of fields: adding is safe and cheap, while removing requires knowing every client's queries. The cure is field-level usage tracking through operation names and persisted queries, ownership per domain through federation or clear modules, and a published process of @deprecated fields removed on a schedule driven by usage. The lasting lesson is that every API technology needs governance for growth and retirement from the start; GraphQL does not remove that need.
Open with
What it teaches me is that every API technology needs governance for growth and retirement, and GraphQL made adding so easy that we forgot the retirement half. A field can be added without breaking anyone, but removing it means knowing every query from every client, including old mobile versions, and without that knowledge nobody deletes anything, so the schema only grows.
Then, if they want more
And one schema with one review queue makes changes slow. What I would do now: first, measure. I would require operation names and client name and version on every request, move our own apps to persisted queries, and record usage per field and per client. That usually shows a big share of fields with no use at all.
Second, ownership: split the schema by domain, through federation or at least clear modules with owners, so each team approves its own fields, and turn the central group into a rule-setter with linting and breaking-change checks in CI.
Third, a published deprecation policy: mark fields @deprecated with a reason and a removal date, contact the clients still using them, which the usage data identifies by name, and remove them on schedule, for example 90 days after deprecation if supported clients no longer use them.
And for future technology choices, I would plan ownership, usage tracking and retirement on day one.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Spring Framework reference, Spring Web MVC
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Five years after adopting GraphQL as the API layer for all clients, your schema has...": https://scrivio-interview-library.netlify.app/spring-boot/web-other/4edb60d5b7/