Changelog
Notable releases and what they shipped.
For the canonical list, see CHANGELOG.md on GitHub and the npm release page.
v1.15 — Validation, completed
Closes the gap between what a route documents and what it enforces, and fixes the codegen type-safety holes that pushed consumers back to hand-written types. Across Express, Fastify, Hono, Koa, and NestJS:
- Path-parameter schemas + validation —
defineRoute({ request: { params } })validates:idand friends with the same Zod schema that documents them, with a structured 422 on mismatch. - Request write-back —
validate: { writeback: true }writes the parsed payload (Zod coercions +.default()s applied) back onto the request, so the handler reads coerced values instead of re-parsing them. - Dev-mode response assertion —
validate: { response: 'warn' | 'throw' }checks a handler's response against the declared Zodresponseschema. - Status-keyed responses —
response: { 201: schema, 200: schema }documents each status with its own schema. defaultErrorsconfig — declare shared error responses once; they merge into every route (the route's ownerrorswin on a status conflict).- Standard
DoctreenValidationErrorenvelope — validated routes document their 422 body as a named component, so codegen emits the type. defineSchemaworks with Zod — named schemas now emit$ref: '#/components/schemas/<name>'and codegen producesinterface Userinstead of anonymousSchema1/Schema2. Deep schemas no longer collapse tounknown.- Offline OpenAPI emit —
getOpenApiDocument(app)on every adapter and the newdoctreen emit-openapiCLI build a staticopenapi.jsonwithout a server.
v1.13 — Typed codegen
npx doctreen codegen types --from <url|file> emits a strict TypeScript
declaration file: one export interface per components.schemas entry plus
per-operation …Params / …Query / …Body / …Response shapes.
npx doctreen codegen client --from <url|file> emits a self-contained
zero-dependency typed fetch client — createClient({ baseUrl, fetch?, headers?, onRequest? })
with one async method per operation, errors as DoctreenHttpError.
--watch [ms] for dev. Programmatic doctreen/codegen export.
See Typed codegen.
v1.12 — Mock server
npx doctreen mock --from <url|file> spins up an Express-backed fake of any
OpenAPI 3.x document. CRUD short-circuits (with envelope detection) on
/resource and /resource/:id, --latency, --error-rate, --persist
flags, optional @faker-js/faker for realistic values, public
doctreen/example and doctreen/mock exports.
See Mock server.
v1.11 — OpenAPI polish
$ref-basedcomponents.schemasdedup (named + auto-anonymous)- First-class per-route + top-level
tagswith descriptions and external docs - OpenAPI 3.1
callbacks(per-operation) andwebhooks(document-level) - Multi-example bodies and responses, per-status response examples
npx doctreen lint openapi— Spectral-lite linter with CI-ready exit codes
See OpenAPI export.
v1.10.x — Schema drift, production grade
- Structured pipeline with per-route aggregates and hourly buckets
- Opt-in sampling (default 1 %)
onDriftcallback + webhook dispatch- Pluggable
DriftStoreinterface; Redis-backed reference implementation Drifttab in the UI with per-route badgesnpx doctreen drift report --fail-on-mismatchfor CI- Opt-in
POST <docsPath>/drift/reset(gated bydrift.allowReset+ optionalresetToken) - Rolling 7-day
dailyBucketsalongside the hourly 24h buckets
See Schema drift.
v1.9 — headHtml config
Inject analytics scripts, custom CSS, favicons, or OG metadata into the docs
UI <head> without forking.
v1.8 — Security + hidden routes
openapi.servers+securitySchemes+ per-routesecurityAuthorizationheader auto-stripped when a security requirement is in effecthidden: trueper-route — keeps the runtime route reachable while removing it from docs / OpenAPI
v1.7 — OpenAPI 3.1 export
Same schema bag drives Scalar, Redoc, and Swagger UI via
GET /docs/openapi.json.
v1.6 — Runtime validation
Zod schemas validate incoming requests; structured 422 on mismatch.
See Runtime validation.