Product
When Partner A needs fields Partner B skips, one static schema fails. It blocks everyone or checks too little.
Tech and architecture
- TypeScript
- Zod
- OpenAPI
- JSON Schema
- Node.js
Architecture
- npm packages (@adaptate/core, utils, adaptate) for runtime validation in Node
- Consumer adapters apply per-consumer rules keyed by route or caller
- Validation stays TypeScript-first on top of Zod
- OpenAPI / JSON Schema bridges generate or align contracts from the same model
Key components
- Base model: fields optional by default so the shared shape stays honest
- Consumer adapters: runtime per-consumer rules keyed by consumer or route context
- Interop helpers: bridges toward OpenAPI / JSON Schema for docs and gateways
Data flow
- Request context selects consumer contract
- Adapter composes base + per-consumer rules
- Parse / validate payload
- Typed result or structured error
Failed validation stays local to the request. Schema authorship stays in code review, not in a detached CMS of JSON files.
Tradeoffs
- Runtime per-consumer rules are more flexible than codegen-per-partner and harder to exhaustively type than a closed Zod union
- Publishing as npm packages forces semver discipline; breaking rule semantics is a major version
- OpenAPI interop lags exotic Zod refinements — document the subset you promise
Testing and ops
- Unit tests lock per-consumer rule precedence, unknown-key policy, and missing-field errors
- Package publish is the release train; consumers pin versions
- CI runs type-check and the validation matrix before npm
More shipped walkthroughs in this set, or back to the landscape.