Skip to content

v12.2.0

Choose a tag to compare

@maxholman maxholman released this 02 May 08:45
· 134 commits to master since this release

Features

  • Static response schema validation — when a generated command attaches a static responseSchema (a valibot schema), the client can coerce the raw JSON body before returning it. Closes the int64 round-trip with openapi-codegen v10. Opt-in via validateResponses: true on the client; default off.
  • BigInt serialization in jsonStringify — BigInt values are now serialized as JSON strings (previously threw), so coerced int64 values can flow back to the wire unchanged.
  • valibot is an optional peer dependency — install only if you opt in to validation. Validation is silently skipped when valibot is absent.

Other changes

  • Dropped engines.node and the node24 tsconfig base. The client is platform-agnostic (uses globalThis.fetch and standard Web APIs); now reflected in the package metadata.
  • Switched tooling from eslint+prettier to oxlint+oxfmt (mirrors @block65/openapi-codegen).
  • Added a small README.
  • Bumped stale dependencies.

Round-trip example

// generated command
class GetAccountCommand extends Command<unknown, BillingAccount> {
  static responseSchema = billingAccountSchema; // coerces "123" → 123n
}

// client
const client = new RestServiceClient(url, { validateResponses: true });
const account = await client.json(new GetAccountCommand());
account.id; // bigint

// sending it back
import { jsonStringify } from "@block65/rest-client";
jsonStringify({ id: account.id }); // '{"id":"123"}'