Quick revision
The short answer
Each service publishes its OpenAPI document as a build artifact with version and owner metadata, and an internal developer portal indexes those documents so consumers can find APIs and their owners. In CI, every spec is linted against the company guideline and diffed against the last released version, and breaking changes need explicit approval. Consumer-driven contract tests cover behaviour the schema cannot express, and gateway or tracing data shows which callers still use deprecated operations.
What to remember
In this answer, we built OpenAPI-based governance for 200 services. Each service publishes its spec as a build artifact with owner and version metadata, a developer portal indexes the specs for discovery and ownership, CI lints every spec against the guideline and diffs it against the last release so breaking changes need explicit approval, consumer-driven contract tests cover behaviour the schema cannot capture, and gateway and tracing data tracks deprecated operations until their last caller is gone.
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.
Each service publishes its OpenAPI document as a build artifact with version and owner metadata, and an internal developer portal indexes those documents so consumers can find APIs and their owners. In CI, every spec is linted against the company guideline and diffed against the last released version, and breaking changes need explicit approval. Consumer-driven contract tests cover behaviour the schema cannot express, and gateway or tracing data shows which callers still use deprecated operations.
Why this question is asked
With 200 services, two problems grow faster than the number of APIs. Consumers cannot find what exists, so they build duplicates or ask around in chat, and providers cannot see who depends on them, so breaking changes are discovered in production. Interviewers ask this design question to see whether a candidate can build a system of tools and rules that scales without a central team reviewing every change. In this answer, we will make each service publish its spec, build the catalog on top, add the CI checks that catch breaking changes, complement them with contract tests, and track deprecated operations to retirement.
1Every Service Publishes Its Spec as an Artifact
The foundation is that every service produces its OpenAPI document as part of its build, exactly like a JAR. With code-first services, the build starts the application in a test and exports /v3/api-docs from springdoc; with design-first services, the YAML in the repository is the artifact. The document carries metadata in extensions or the info section: the owning team, the service name, the API's lifecycle state (beta, stable, deprecated) and a version tied to the release.
The build uploads the document to an artifact repository or a schema registry together with the service release. Publishing at build time, rather than scraping running services, means the catalog always knows which spec belongs to which release, including what is about to ship.
Notice the deprecated flag at operation level. OpenAPI lets us mark single operations, which the tracking in the last step depends on.
2A Catalog in an Internal Developer Portal
An internal developer portal, Backstage is a common example, indexes every published spec. It shows each API with its owner, documentation rendered from the spec, lifecycle state, versions and links to the source repository and on-call channel. Search across all specs lets a developer type customer address and find every operation that deals with it, which is how duplicates are avoided. Because the data comes from build artifacts, nobody has to keep the catalog up to date by hand; a service that does not publish a spec simply does not appear, which becomes a visible reason to fix its build.
- Developer portalsearch, owners, docs, lifecycle
- Spec registryversioned OpenAPI artifacts per release
- CI checkslint against guideline, diff against last release
- Contract testsconsumer expectations verified by providers
- Runtime datagateway and tracing: who calls which operation
5 layers, from the top down. Step through them one at a time.
3Lint and Diff in CI
Two checks run in every service's pipeline before release. The linter, for example Spectral with the company ruleset, checks the spec against the API guideline: naming, error format, pagination parameters. The diff compares the new spec with the last released one from the registry and classifies every change as additive or breaking.
- Build exports the specwith owner and version metadata
- Lint passes?YesDiff against last released specNoFix guideline violations
- Breaking change?YesApproval and version plan requiredNoRelease and publish to registry
- Catalog updates automaticallyportal shows the new version
4 steps in order. Play them, or step through them one at a time.
The approval path matters as much as the check. A breaking change is not forbidden; it needs an explicit decision. The merge request must carry an approval from the API owners and, for widely used APIs, a version and deprecation plan. Everything else, additive changes, passes without anyone waiting for a review, which keeps 200 teams moving.
4Contract Tests for What the Schema Cannot Say
A schema describes shapes, not behaviour. It cannot say that GET /orders?status=PAID only returns paid orders, that a field consumers rely on is always present in practice, or that a 404 is returned for a missing order rather than an empty 200. Consumer-driven contract tests, with tools such as Pact or Spring Cloud Contract, fill this gap. Each consumer records the interactions it relies on as a contract, the contracts are shared through a broker, and the provider's pipeline verifies them against its real implementation. If a provider change would break a consumer, the provider learns it before release, and it also learns exactly who its consumers are, which the spec alone never tells it.
5Track Deprecated Operations to Retirement
Deprecation only ends when the last caller moves. The API gateway and distributed tracing already record which client called which operation, so we join that data with the deprecated flags from the registry. The portal then shows, for each deprecated operation, its remaining callers by team and their traffic over time. Owners contact those teams directly, and the operation is removed when traffic reaches zero or the sunset date passes after notice. The same data helps the catalog show real usage of every API, which tells providers where changes are most risky.
6Follow-up questions
What if a service does not have an OpenAPI spec yet?
We make it the first adoption step, supported by a starter that adds springdoc and the export task to the build. Until then the service shows up in the portal as missing a spec, which is usually enough pressure. Legacy services that will not get one are marked as such, so consumers know to avoid building new dependencies on them.
Who approves breaking changes?
The owning team approves its own changes, with an API review group involved only for public or very widely used APIs. Central approval of every change would not scale to 200 services; the tools make the decision explicit and visible instead.
Why not rely only on contract tests?
Contract tests cover only the consumers that wrote contracts, and many consumers will not. The spec diff protects every consumer at the schema level, and contract tests add behaviour for the consumers that matter most. Together they catch far more than either alone.
7Conclusion
In this answer, we built OpenAPI-based governance for 200 services. Each service publishes its spec as a build artifact with owner and version metadata, a developer portal indexes the specs for discovery and ownership, CI lints every spec against the guideline and diffs it against the last release so breaking changes need explicit approval, consumer-driven contract tests cover behaviour the schema cannot capture, and gateway and tracing data tracks deprecated operations until their last caller is gone.
Open with
I would build it from the bottom up. First, every service publishes its OpenAPI document as a build artifact, exported from springdoc in a test for code-first services or taken from the YAML for design-first ones, with metadata for the owning team, lifecycle state and a version tied to the release, and uploads it to a registry.
Then, if they want more
Second, an internal developer portal such as Backstage indexes those specs, so consumers can search across all APIs, see the owner and documentation, and avoid building duplicates; since it is fed by builds, nobody maintains it by hand.
Third, CI runs two checks on every change: a Spectral lint against the company guideline, and a diff with a tool like oasdiff against the last released spec. Additive changes pass straight through, and breaking changes fail the build unless the owners explicitly approve them with a version plan.
Fourth, consumer-driven contract tests with Pact or Spring Cloud Contract cover behaviour the schema cannot express, and they tell providers who their consumers are. Finally, I would join gateway and tracing data with the deprecated flags in the specs, so the portal shows the remaining callers of each deprecated operation and owners can drive them to zero before removing it.
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 "How would you build an API catalog and governance process based on OpenAPI documents for...": https://scrivio-interview-library.netlify.app/spring-boot/rest-api-design/09cdbdbcdc/