Quick revision
The short answer
I would keep every partner schema in one central repository with versions and change history, build a binding library per partner and version in CI with semantic versioning, and require contract tests in each consuming service using the partner's sample messages and schema validation. On top of that come written rules for unknown elements and backward compatibility agreed with each partner, and clear ownership: one team or maintainer per partner integration, with monitoring of rejected messages so problems are seen before partners complain.
What to remember
In this answer, we designed governance for 30 partner XML contracts. Schemas live unchanged in one central repository with versions, metadata and history, CI builds a binding library per partner and version with semantic versioning, and each consuming service runs contract tests with partner samples and schema validation. Compatibility rules for unknown elements and version transitions are agreed with each partner, and every integration has a named owner with monitoring of rejected messages per partner.
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.
I would keep every partner schema in one central repository with versions and change history, build a binding library per partner and version in CI with semantic versioning, and require contract tests in each consuming service using the partner's sample messages and schema validation. On top of that come written rules for unknown elements and backward compatibility agreed with each partner, and clear ownership: one team or maintainer per partner integration, with monitoring of rejected messages so problems are seen before partners complain.
Why this question is asked
Thirty partners means thirty sets of schemas, each with its own release rhythm, quirks and people. Without governance, the usual result is schemas copied into service repositories in different versions, generated code nobody can rebuild, and production incidents when a partner adds an element. Interviewers ask this design question of senior engineers because it is about building a system of rules and tools that many teams can follow, not about one integration. In this answer, we will design where schemas live, how bindings are built and versioned, how services test against contracts, what compatibility rules we agree, and who owns each integration.
1The Problems Governance Must Solve
Before designing, it helps to name what goes wrong without it. Nobody can say which version of a partner's schema a service uses, because the XSD was copied into its repository years ago. When a partner announces a change, nobody knows which services are affected. Generated code was produced on someone's laptop with an unknown tool version. A partner adds an optional element, one service rejects it because it validates strictly, another ignores it, and a third loses data. And when messages start failing, the partner notices first.
Each part of the design answers one of these: storage answers 'which version', a binding build answers 'reproducible code', contract tests answer 'will this change break us', compatibility rules answer 'what to do with the unexpected', and ownership with monitoring answers 'who notices and who fixes'.
2A Central Schema Repository
All partner schemas live in one repository, organised by partner and version, for example schemas/bank-x/payments/2.3.0/. Each version is stored exactly as the partner published it, never edited, with a small metadata file: the partner's own version name, the date received, where it came from, and the release notes or a link to them. Changes come in through pull requests, so the history shows who added which version and when.
One repository also gives us a catalogue. A simple generated page lists every partner, its current and supported versions, and which services consume each one. When a partner announces version 2.4, we can see at once which services are affected and who owns them.
3Generated Binding Libraries per Partner and Version
CI builds a binding library for each partner and version from that repository: it runs xjc with the agreed binding files, adds the standard adapters for dates, money and code lists, runs tests against the partner's samples, and publishes the result to our artifact repository, for example com.acme.partners:bank-x-payments-binding. Services depend on these libraries instead of generating code themselves, so every service gets the same classes from the same tool versions.
The libraries use semantic versioning that reflects the effect on consumers. A partner change that only adds optional elements is a minor release, because existing code keeps working. A change that removes or renames elements, changes types or changes namespaces is a major release. Fixes to our adapters or bindings with no schema change are patch releases. That tells each consuming team how much work an upgrade is before they start.
- Partner publishes a new XSD version
- Owner adds it to the schema repositoryunchanged, with metadata, via pull request
- CI generates and tests the binding librarypartner samples must validate and unmarshal
- Breaking change for consumers?YesMajor version, migration notesNoMinor version
- Publish to the artifact repository
- Consuming services upgradetheir contract tests must pass
6 steps in order. Play them, or step through them one at a time.
Every service gets the same generated classes from the same build.
4Contract Tests in Each Consuming Service
The binding library proves that the classes match the schema. Each consuming service must still prove that its own use of them is right. So every service keeps contract tests: it reads the partner's sample messages, published with the binding library, through its real mapping code and checks the resulting domain objects; and it validates every message it produces against the partner's schema, with the compiled Schema set on the marshaller.
We also collect real production messages over time, anonymised, and add them to the samples. Partners' official samples are often cleaner than what their systems actually send, and the real messages are what catch the surprises.
5Compatibility Rules Agreed With Partners
The most common incident is a partner adding something. Whether that breaks us depends on rules we should decide in advance and agree with each partner in writing. A typical policy is to be strict about what we send and tolerant about what we receive: our outgoing messages always validate against the partner's schema, while for incoming messages we validate against the version we support and, by agreement, ignore unknown optional elements added in a newer minor version rather than rejecting the whole message.
The agreement with each partner covers how much notice they give before a change, how long they accept the old version alongside the new one, how version is indicated in messages, for example by namespace or a version attribute, and where their test environment is. Writing it down turns surprises into scheduled work. For partners that are large institutions or standards bodies and will not negotiate, we record their published policy instead and plan around it.
6Ownership and Monitoring of Rejected Messages
Each of the 30 integrations has one owning team and a named maintainer, recorded in the catalogue. The owner adds new schema versions, maintains the binding library, keeps the partner relationship at the technical level and is the first contact when messages fail. Without a named owner, a new schema version sits in an email inbox until something breaks.
Finally, monitoring. Every service counts messages accepted and rejected per partner and per reason, such as schema violation, unknown code or mapping failure, and rejected messages are stored for investigation. An alert fires when a partner's rejection rate rises above its normal level, for example from 0.1 percent to 5 percent in an hour, and goes to the owning team. That is how we notice an unannounced partner change in minutes rather than from an angry phone call days later.
| Concern | Owner | Evidence |
|---|---|---|
| Schema versions in the repository | integration maintainer | pull request history |
| Binding library per version | integration maintainer | CI build, published artifact |
| Mapping and contract tests | each consuming service | tests on partner samples |
| Compatibility agreement | maintainer with partner contact | written policy per partner |
| Rejection monitoring | owning team | dashboard and alerts per partner |
7Follow-up questions
Should consuming services validate incoming messages strictly?
At the boundary, yes against the version they support, but with the agreed tolerance for newer optional elements. Many teams validate strictly in a gateway or integration service and are more tolerant further inside. What matters is that the behaviour is decided and tested, not left to defaults.
How do you handle a partner that changes schemas without notice?
Monitoring catches it quickly through rejection rates, stored rejected messages show what changed, and the binding pipeline lets us add the new version and release in hours. Then we raise it with the partner under the written agreement, so it is less likely next time.
Is a central integration service better than libraries here?
For some partners, yes, especially when many services consume the same data or the connection is complex. Governance stays the same either way: schemas, bindings, tests and owners. The central service simply becomes the single consumer of the binding library.
8Conclusion
In this answer, we designed governance for 30 partner XML contracts. Schemas live unchanged in one central repository with versions, metadata and history, CI builds a binding library per partner and version with semantic versioning, and each consuming service runs contract tests with partner samples and schema validation. Compatibility rules for unknown elements and version transitions are agreed with each partner, and every integration has a named owner with monitoring of rejected messages per partner.
Open with
I would build it around five parts. First, one central schema repository, organised by partner and version, where each XSD is stored exactly as published with metadata and change history, added through pull requests, and a catalogue showing which services consume which version.
Then, if they want more
Second, CI generates a binding library per partner and version with xjc, standard adapters and binding files, tests it against the partner's samples, and publishes it with semantic versioning: minor for additive optional elements, major for anything that breaks consumers. Services depend on those libraries instead of generating code themselves.
Third, each consuming service has contract tests: partner sample messages, plus anonymised real ones we collect, go through the real mapping code, and everything we send is validated against the partner schema with setSchema on the marshaller.
Fourth, compatibility rules agreed with each partner in writing: we are strict about what we send and tolerant of unknown optional elements in newer minor versions, with notice periods and overlap windows for old versions.
Fifth, ownership: one team and a named maintainer per integration, and monitoring of accepted and rejected messages per partner and reason, with alerts on spikes, so we see a partner change before they call us.
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 official documentation for the version you use. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
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 "Design how XML contracts with 30 external partners are governed: schema storage...": https://scrivio-interview-library.netlify.app/java/jaxb/8af9fbc381/