Skip to content

v0.4.2

Choose a tag to compare

@github-actions github-actions released this 26 Sep 19:25
· 67 commits to main since this release
cce3631

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: fields and headers on a response passed to documented() — what a hook adds to the error envelope, and the headers it sets. The envelope stays one definition in components, with the fields in it. Both take the new JsonSchema type, JSON Schema 2020-12 keyword by keyword: a misspelled keyword or an unknown type does not compile.
  • @tetsujs/openapi: a status whose alternatives are all error envelopes has a discriminator on error, 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. assets takes integrity hashes for a renderer of your own.
  • @tetsujs/rate-limit: key reads what earlier beforeParse hooks returned, typed with Requires — 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 with Requires.
  • @tetsujs/lifecycle: onShutdownSignals() and shutdown() 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 against 127.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 in components per 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 of docs() 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's anyOf instead 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 documented 429 now has the retryAfter field and the retry-after header the refusal carries; the document described the bare envelope.

Full Changelog: v0.4.1...v0.4.2