Skip to content

v0.5.2

Choose a tag to compare

@github-actions github-actions released this 27 Sep 16:59
· 54 commits to main since this release
53dd8ee

Descriptions for the document's tags, a check that holds a response to the document in a test, and the raw bytes of a body for a webhook's signature; a group is eight times cheaper for the type checker.

Added

  • @tetsujs/openapi: tags in openapi() and docs() — what each tag is, by name, in the order a renderer lists the sections. A tag the routes use and tags leaves out is listed after them and reported, and so is a described tag no operation uses: either is usually one tag spelled two ways. docs() describes its own tag when its routes are documented.
  • @tetsujs/openapi/testing: assertDescribed(document, "POST /session", res) throws unless a response a test provoked is one the document describes for the operation — its status declared, its body one of the alternatives of that status, the headers asked about documented — and lists every problem at once. validate checks the body in full with a JSON Schema validator of your choice.
  • @tetsujs/core: rawBody: true on a route keeps the bytes of a json or text body as ctx.rawBody, next to the body parsed and validated from them — for a webhook signed over its bytes. The field is typed only on a route that asks, so a hook requiring it with Requires cannot be mounted where it is missing; a form or a stream with rawBody is refused. rawBody is now the pipeline's own field: a hook that returned a field of that name no longer adds it to the context.

Changed

  • @tetsujs/core: a group() costs the type checker about 130 instantiations where it cost about 1 090 — an application of 100 groups and 200 routes 194 k where it was 288 k, and 83 MB where it was 114. The children met the configuration's own children as an intersection of two array types, and every method of an array was built once per group. Its options besides the children are GroupOptions.
  • @tetsujs/core: the package no longer ships the test helpers of this repository that @tetsujs/core/testing does not export — type assertions, a mock schema, a socket client. They were never importable.

Full Changelog: v0.5.1...v0.5.2