Repository navigation
v0.4.2
The generated document describes each error once: every envelope is one definition per status and code, whoever declared it, and a status of envelopes can be discriminated by its code.
Added
@tetsujs/openapi:fieldsandheaderson a response passed todocumented()— what a hook adds to the error envelope, and the headers it sets. The envelope stays one definition incomponents, with the fields in it. Both take the newJsonSchematype, JSON Schema 2020-12 keyword by keyword: a misspelled keyword or an unknowntypedoes not compile.@tetsujs/openapi: a status whose alternatives are all error envelopes has adiscriminatoronerror, mapping each code to its definition, so a generated client narrows on the code.@tetsujs/openapi:docs({ ui: false })serves the document without a page — for an origin that carries a session, where the page would run a CDN's code as the signed-in user.assetstakesintegrityhashes for a renderer of your own.@tetsujs/rate-limit:keyreads what earlierbeforeParsehooks returned, typed withRequires— a client address worked out once, for the limiter and whatever else needs it. The limiter then demands the field where it is mounted, like any hook withRequires.@tetsujs/lifecycle:onShutdownSignals()andshutdown()take a list of servers — one process serving several surfaces. They drain within one grace period, only a server still draining is cut, and the closers run once, after the last server.@tetsujs/core/testing:serve(app, { hostname }). Bun listens on both IPv4 and IPv6 by default and reports an IPv4 client as::ffff:127.0.0.1;hostname: "127.0.0.1"makes a test an IPv4 client, for checks that compare against127.0.0.1.
Changed
@tetsujs/openapi: the default renderers are pinned to an exact version and carry a Subresource Integrity hash — Scalar 1.72.1, Swagger UI 5.33.0, Redoc 2.5.4. Scalar used to load whatever version was latest.@tetsujs/openapi: every error envelope is one definition incomponentsper status and code, named after the code — a route's own included, which used to be inlined next to a named twin from a hook or the framework. The route's definition is the one kept; a definition with different fields is reported as a warning. A client regenerated from the document gets named types where it had anonymous ones.
Fixed
@tetsujs/openapi: the page ofdocs()mounted in a group fetched the document from the path as configured, without the group's prefix, and showed nothing.@tetsujs/openapi: a status and code declared by both the route and a hook was listed twice under the status, and a union the route declared was nested inside the status'sanyOfinstead of joining it.@tetsujs/openapi: a status the route declared and a hook or the framework described was documented as"Response 403; <their description>". The placeholder is left out when something else describes the status, and a status only the route declares is named by its reason phrase —"Not Found", not"Response 404".@tetsujs/rate-limit: the documented429now has theretryAfterfield and theretry-afterheader the refusal carries; the document described the bare envelope.
Full Changelog: v0.4.1...v0.4.2